[asterisk-users] Macro to Dial a Channel Group using Round-robin

A J Stiles asterisk_list at earthshod.co.uk
Wed Jul 20 07:34:53 CDT 2011


On Wednesday 20 Jul 2011, Antonio Modesto wrote:
>     I am writing a Asterisk dialplan from scratch (for learning and
> testing purposes), but i'm having trouble with a algorithm to dial a SIP
> group using round-robin. I want that asterisk dial the member of the
> group in a circular way, until the call be answered. For example, i have
> the group TEST="SIP/1&SIP/2&SIP/3&SIP/4", asterisk would dial SIP/1, if
> it doesn't answer in a period of time then asterisk would dial SIP/2 and
> so on. Can somebody help me?

Start with this and experiment!  You may want to set a variable initially to 
0, increment it each time around the loop and use a GotoIf() to jump out 
after too many cycles.

[macro-round-robin]
exten => s, 1, Dial(SIP/1, 30)  ;  dial SIP/1 for 30"
exten => s, n, Dial(SIP/2, 30)  ;  dial SIP/2 for 30"
exten => s, n, Dial(SIP/3, 30)  ;  dial SIP/3 for 30"
exten => s, n, Dial(SIP/4, 30)  ;  dial SIP/4 for 30"
exten => s, n, Goto(1)  ; start again

-- 
AJS

Answers come *after* questions.



More information about the asterisk-users mailing list