[macro-dialcnet] ; ; Collectors' Network ; exten => s,1,Set(E164NETWORKS=std.ckts.info) ; ; Check to see if ARG1 is preceded by a "+" exten => s,2,GotoIf($[ ${ARG1:0:1} = "+"]?startloop) ; ; Skip next line if it already is prefixed by a plus; ; Otherwise, add one to the beginning. exten => s,3,Set(ARG1=+${ARG1}) exten => s,4(startloop),Set(ENUM=${ENUMLOOKUP(${ARG1},ALL,,1,std.ckts.info)}) ;exten =>s,4(startloop),Set(ENUM=${ENUMLOOKUP(${ARG1}.std.ckts.info,ALL,,std.ckts.info)}) ; ; Sanity check the return, make sure there's something in there. ; If not, send it to CONTINUE. exten => s,5,GotoIf($[${LEN(${ENUM})} = 0 ]?continue) ; ; If the return includes the word SIP, go to SIPURI exten => s,6,GotoIf($[${ENUM:0:3} = sip ]?sipuri) ; ; Otherwise, if the return includes the word IAX, go IAXURI exten => s,7,GotoIf($[${ENUM:0:3} = iax ]?iaxuri) ; ; And, if the return includes the word H323, send it to H323URI exten => s,8,GotoIf($[${ENUM:0:3} = h32 ]?h323uri) ; ; If we're here, it's not a protocol we know about. Let's increment the pointer ; and if it's more than ENUMCOUNT, we know we've run out of options. ; ; This is the generic CANT BE ROUTED spot exten => s,9(continue),Macro(invalid-office-code,${ARG1}) exten => s,10,Wait(5) exten => s,11,Hangup ; ; If the prefix is 'sip:'... exten => s,12(sipuri),Set(DIALSTR=SIP/${ENUM:4}) exten => s,13,Goto(dodial) ; ; If it's IAX2... exten => s,14(iaxuri),Set(DIALSTR=IAX2/${ENUM:5}) exten => s,15,Goto(dodial) ; ; Or even if it's H323. exten => s,16(h323uri),Set(DIALSTR=H323/${ENUM:5}) ; ; And this is where we end up if we actually CAN route the call. exten => s,17(dodial),Dial(${DIALSTR}) exten => s,18,Goto(q-${DIALSTATUS},1) ; exten => q-CONGESTION,1,Macro(congestion) exten => q-CONGESTION,n,Hangup ; exten => q-CHANUNAVAIL,1,Macro(chanunavail) exten => q-CHANUNAVAIL,n,Hangup ; exten => q-BUSY,1,Busy exten => q-BUSY,n,Hangup ; exten => _q-.,1,Hangup() ;