[macro-superdial]
; add some abilities to Dial(Technology/resource[&Technology2/resource2...][|timeout][|options][|URL]):
; ${ARG1} - Technology/resource[&Technology2/resource2...]
; ${ARG2} - timeout
; ${ARG3} - options
; ${ARG4} - URL
; ${ARG5} - Group
; ${ARG6} - Max. group number
; ${ARG7} - Caller ID name (typically for outgoing calls only)
; ${ARG8} - Caller ID number (typically for outgoing calls only)
; ${ARG9} - CDR account name (over-rides account group setting in sip.conf or iax.conf)
; ${ARG10} - voicemail to send to if noanswer (typically for incoming calls only)
; Usage instructions:
; for an outgoing call, in extensions.conf you just list multiple lines like:
; exten => s,1,Macro(superdial,IAX2/voipjet/${tfnumber},,,,voip,${MAXVOIPCALLS},,,voipjet)
; exten => s,2,Macro(superdial,IAX2/alpeh-com/${tfnumber},,,,voip,${MAXVOIPCALLS},,,aleph)
; and it will take the first one that is available
;
; it also works for incoming like so ..
; exten => s,3,Macro(superdial,${PHONE1},15,Ttm,,pstn,${MAXPSTNCALLS},,,,u${GENERALVM})
; exten => s,4,Macro(superdial,${PHONE1},15,Ttm,,pstn,${MAXPSTNCALLS},,,,u${GENERALVM})
; exten => s,5,Voicemail(b${GENERALVM})
; and then goes to unavailable voicemail if one times out .. otherwise (eg if busy) it tries the next extension
; if all are busy or unavailable .. it gets to the last priority which is the busy voicemail
;
exten => s,1,SetGroup(${ARG5})
exten => s,2,CheckGroup(${ARG6}) ; jump to 103 if count on group ${ARG5} is already at ${ARG6}
exten => s,3,GotoIf($["${ARG7}" = ""]?macro-superdial,s,5)
exten => s,4,SetCIDName(${ARG7}) ; skip this if ARG7 is empty
exten => s,5,GotoIf($["${ARG8}" = ""]?macro-superdial,s,7)
exten => s,6,SetCIDNum(${ARG8}) ; skip this if ARG8 is empty
exten => s,7,GotoIf($["${ARG9}" = ""]?macro-superdial,s,9)
exten => s,8,SetAccount(${ARG9}) ; skip this if ARG9 is empty
exten => s,9,Dial(${ARG1},${ARG2},${ARG3},${ARG4})
exten => s,10,Goto(s-${DIALSTATUS},1)
exten => s,103,Goto(s-CHANUNAVAIL,1)
;exten => s-BUSY,1,Busy
exten => s-BUSY,1,Noop
;exten => s-CHANUNAVAIL,1,Noop
exten => s-NOANSWER,1,GotoIf($["${ARG10}" = ""]?macro-superdial,s-NOANSWER,3)
exten => s-NOANSWER,2,Voicemail(${ARG10})
exten => s-NOANSWER,3,Noop
;exten => _s-.,1,Congestion
exten => _s-.,1,Noop