; Rings one or more extensions. Handles things like call forwarding and DND ; We don't call dial directly for anything internal anymore. ; ARGS: $TIMER, $OPTIONS, $EXT1, $EXT2, $EXT3, ... ; Use a Macro call such as the following: ; Macro(dial,$DIAL_TIMER,$DIAL_OPTIONS,$EXT1,$EXT2,$EXT3,...) [macro-dial] exten => s,1,GotoIf($[ "${MACRO_CONTEXT}" = "macro-rg-group" ]?4:2) ; if this is from rg-group, don't strip prefix exten => s,2,GotoIf($["${CALLERIDNAME:0:${LEN(${RGPREFIX})}}" != "${RGPREFIX}"]?5:4) ; check for ring-group prefix exten => s,3,SetCIDName(${CALLERIDNAME:${LEN(${RGPREFIX})}}) ; strip off prefix exten => s,4,AGI,dialparties.agi exten => s,5,NoOp(Returned from dialparties with no extensions to call) exten => s,6,SetVar(DIALSTATUS=BUSY) exten => s,10,Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null exten => s,20,NoOp(Returned from dialparties with hunt groups to dial ) exten => s,21,SetVar(HuntLoop=0) exten => s,22,GotoIf($[$[${HuntMembers} >= 1]?30 ) ; if this is from rg-group, don't strip prefix exten => s,23,NoOp(Returning there are no members left in the hunt group to ring) exten => s,30,SetVar(HuntMember=HuntMember${HuntLoop}) exten => s,31,GotoIf($[$[${CALLTRACE_HUNT} != "" ] & $["${RingGroupMethod}" = "hunt" ]]?32:35 ) ; Set CAll Trace for Hunt member we are going to call exten => s,32,Cut(CT_EXTEN=ARG3,,$[${HuntLoop} + 1]) exten => s,33,DBput(CALLTRACE/${CT_EXTEN}=${CALLTRACE_HUNT}) exten => s,34,Goto(s,42) exten => s,35,GotoIf($[$[${CALLTRACE_HUNT} != "" ] & $["${RingGroupMethod}" = "memoryhunt" ]]?36:50 ) ;Set Call Trace for each hunt member we are going to call "Memory groups have multiple members to set CALL TRACE For hence the loop exten => s,36,SetVar(CTLoop=0) exten => s,37,GotoIf($[${CTLoop} > ${HuntLoop}]?42 ) ; if this is from rg-group, don't strip prefix exten => s,38,Cut(CT_EXTEN=ARG3,,$[${CTLoop} + 1]) exten => s,39,DBput(CALLTRACE/${CT_EXTEN}=${CALLTRACE_HUNT}) exten => s,40,SetVar(CTLoop=$[1 + ${CTLoop}]) exten => s,41,Goto(s,37) exten => s,42,Dial(${${HuntMember}}${ds} ) ; dialparties will set the priority to 20 if $ds is not null and its a hunt group exten => s,43,SetVar(HuntLoop=$[1 + ${HuntLoop}]) exten => s,44,SetVar(HuntMembers=$[${HuntMembers} - 1]) exten => s,45,Goto(s,22) exten => s,50,DBdel(CALLTRACE/${CT_EXTEN}) exten => s,51,Goto(s,42)