[asterisk-users] Check if SIP is avaible to dial

Jakub Syrek arkon at nast.pl
Fri Nov 23 07:51:30 CST 2007


I thing there was an error in last version of my macro, correct one (i 
hope):

[macro-call]
;sip1 - firs channel from sip outgoing cals operator
;sip2 - second channel from sip outgoing cals operator
;sipn - N channel from sip outgoing cals operator
;ARG1 - outgoing telephone number
exten => s,1,SetGroup(${ARG1})
exten => s,2,GotoIf($[ ${GROUP_COUNT(${ARG1})} < 2 ]?dial-ok)

;outgoing number was called previously by someone else?
exten => s,n,NoOp(-- Call destination was previously called and its busy --)
exten => s,n,Hangup

;we can dial
;now chack witch chanel is free to meake a call with
exten => s,n(dial-ok),SetGroup(sip1)
exten => s,n,GotoIf($[ ${GROUP_COUNT(sip1)} > 1 ]?sip1-busy)
exten => s,n,Dial(SIP/sip1/${ARG1},25,m)
exten => s,n,Hangup

exten => s,n(sip1-busy),SetGroup(sip2)
exten => s,n,GotoIf($[ ${GROUP_COUNT(sip2)} > 1 ]?sip2-busy)
exten => s,n,Dial(SIP/sip2/${ARG1},25,m)
exten => s,n,Hangup

;and so on to last one

exten => s,n(sipN-busy),SetGroup(sipn)
exten => s,n,GotoIf($[ ${GROUP_COUNT(sipn)} > 1 ]?all-busy)
exten => s,n,Dial(SIP/sip2/${ARG1},25,m)
exten => s,n,Hangup

;every channel is busy
exten => s,n(all-busy),Hangup




More information about the asterisk-users mailing list