Retry Loop In Ansible ?

Home » Asterisk Users » Retry Loop In Ansible ?
Asterisk Users 2 Comments

I have a simple config with some phones ringing simultaneously. Some of them are softphones (zoiper apps on iPhone w/o push notification). If such an app did bot register in time, it has no chance to pick up the call. If I could configure a retry loop checking for registered candidates, say once a second until one phone takes the call, this would allow me to pick up the call with zoiper app registered late.

How could this be done in ansible?

Axel

PGP-Key: CDE74120 ☀ mobile: +49 160 7568212
computing @ chaos claudius

2 thoughts on - Retry Loop In Ansible ?

  • Did you mean asterisk ?

    If so, then you might look into the While()/EndWhile() applications, combined with timeouts to Dial() application, starting with something very basic such as the following:

    same = n,Set(tries=0)
    same = n,While($[${INC(tries)}<99])
    same = n,Set(PUSH(team,&)=${PJSIP_DIAL_CONTACTS(1234)})
    same = n,Set(PUSH(team,&)=${PJSIP_DIAL_CONTACTS(5678)})
    same = n,Dial(${team},10)
    same = n,Wait(1)
    same = n,EndWhile()

    ...at most that would be 11 seconds in between registration of x5678 and the next time it gets called when x1234 is not answering.

    Other approaches might involve Queue()'s with some ChannelRedirect()'s or even Bridge()'s, maybe AGI/ARI, etc.

    BTW the Asterisk Forums are a great place to post these kinds of questions in the future: https://community.asterisk.org

    Regards,

  • Hi,

    Yes. Thanks a lot for this example.

    I will try this in the future,

    Regards, Axel

    PGP-Key: CDE74120 ☀ mobile: +49 160 7568212
    computing @ chaos claudius