[macro-dial] exten => s,1,GotoIf($["${MOHCLASS}" = ""]?dial) exten => s,n,SetMusicOnHold(${MOHCLASS}) exten => s,n(dial),AGI(dialparties.agi) exten => s,n,NoOp(Returned from dialparties with no extensions to call and DIALSTATUS: ${DIALSTATUS}) exten => s,n+2(normdial),Dial(${ds}) ; dialparties will set the priority to 10 if $ds is not null exten => s,n,Set(DIALSTATUS=${IF($["${DIALSTATUS_CW}"!="" ]?${DIALSTATUS_CW}:${DIALSTATUS})}) exten => s,20(huntdial),NoOp(Returned from dialparties with hunt groups to dial ) exten => s,n,Set(HuntLoop=0) exten => s,n(a22),GotoIf($[${HuntMembers} >= 1]?a30) ; if this is from rg-group, don't strip prefix exten => s,n,NoOp(Returning there are no members left in the hunt group to ring) ; dialparties.agi has setup the dialstring for each hunt member in a variable labeled HuntMember0, HuntMember1 etc for each iteration ; and The total number in HuntMembers. So for each iteration, we will update the CALLTRACE Data. ; exten => s,n+2(a30),Set(HuntMember=HuntMember${HuntLoop}) exten => s,n,GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "hunt" ]]?a32:a35) exten => s,n(a32),Set(CT_EXTEN=${CUT(FILTERED_DIAL,,$[${HuntLoop} + 1])}) exten => s,n,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT}) exten => s,n,Goto(s,a42) ;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,n(a35),GotoIf($[$["${CALLTRACE_HUNT}" != "" ] & $["${RingGroupMethod}" = "memoryhunt" ]]?a36:a50) exten => s,n(a36),Set(CTLoop=0) exten => s,n(a37),GotoIf($[${CTLoop} > ${HuntLoop}]?a42) ; if this is from rg-group, don't strip prefix exten => s,n,Set(CT_EXTEN=${CUT(FILTERED_DIAL,,$[${CTLoop} + 1])}) exten => s,n,Set(DB(CALLTRACE/${CT_EXTEN})=${CALLTRACE_HUNT}) exten => s,n,Set(CTLoop=$[1 + ${CTLoop}]) exten => s,n,Goto(s,a37) exten => s,n(a42),Dial(${${HuntMember}}${ds}) exten => s,n,Set(HuntLoop=$[1 + ${HuntLoop}]) exten => s,n,GotoIf($[$[$["foo${RingGroupMethod}" != "foofirstavailable"] & $["foo${RingGroupMethod}" != "foofirstnotonphone"]] | $["foo${DialStatus}" = "fooBUSY"]]?a46) exten => s,n,Set(HuntMembers=0) exten => s,n(a46),Set(HuntMembers=$[${HuntMembers} - 1]) exten => s,n,Goto(s,a22) exten => s,n(a50),DBdel(CALLTRACE/${CT_EXTEN}) exten => s,n,Goto(s,a42) ; make sure hungup calls go here so that proper cleanup occurs from call confirmed calls and the like ; exten => h,1,Macro(hangupcall) ; Ring an extension, if the extension is busy or there is no answer send it ; to voicemail ; ARGS: $VMBOX, $EXT