his macro helps to define an outbound hunting group for the outbound dialing. In the situation where you have multiple PSTN lines registered as multiple SIP channels (e.g. SIP/line1, SIP/line2, SIP/line3, etc...), on the same or multiple gateways, and you wants to arrange them into an ordered hunting group for outbound calling. You can use the following hunt-dial macro. This solution is brought to you by Asterisk*HK, your Asterisk solution provider in Hong Kong. If you have any enquiry or suggestions, please feel free to contact us at info@asterisk.hk [default] include => pstn-out [macro-hunt-dial] ; ${ARG1} channel ; ${ARG2} Dialed Number exten => s,1,SetGroup(${ARG1}) ; increment GROUPCOUNT exten => s,2,GetGroupCount() exten => s,3,NoOp(GROUPCOUNT:${GROUPCOUNT}) exten => s,4,GotoIf($["${GROUPCOUNT}" = "1"]?5:6) ; if GROUPCOUNT = 1, then it's free for dialing. exten => s,5,Dial(SIP/${ARG2}@${ARG1}) ; use it to call out. exten => s,6,NoOp(${ARG1} is inused) [pstn-out] exten => _XXXXXXXX,1,Macro(hunt-dial,line1,${EXTEN}) ; list your SIP channels here in the hunting order exten => _XXXXXXXX,n,Macro(hunt-dial,line2,${EXTEN}) exten => _XXXXXXXX,n,Macro(hunt-dial,line3,${EXTEN}) exten => _XXXXXXXX,n,Macro(hunt-dial,line4,${EXTEN}) . . . exten => _XXXXXXXX,n,NoOp("No Channel available") exten => _XXXXXXXX,n,Hangup()