[from-axb]
exten => _X.,1,NoOp(${EXTEN}) 
same => n,NoOp(${UNIQUEID})
same => n,Set(AXRES=${SHELL(php /var/www/html/asterCC/app/vendors/shells/ax.php ${EXTEN} ${UNIQUEID})})
same => n,NoOp(${AXRES})
same => n,GotoIf($[${AXRES:0:6} = failed]?failed)
same => n,NoOp(${AXRES})
same => n,Set(XNUM=${CUT(AXRES,&,1)})
same => n,Set(__XSUBID=${CUT(AXRES,&,2)})
same => n,Goto(hosted-dialin,${XNUM},1)
same => n(failed),hangup

[hosted-dialinner]
exten => _.,1,NoOp(${EXTEN})
exten => _.,n,AGI(agi://127.0.0.1:4577/dialinnerprocess)
exten => _.,n,hangup

exten => h,1,hangup

[hosted-dialout]
exten => voicecode,1,NoOp(${CALLERID(num)})
exten => voicecode,n,AGI(agi://127.0.0.1:4577/voicecode)
exten => voicecode,n,hangup

exten => _X.,1,NoOp(${EXTEN})
;exten => _X.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _X.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _X.,n,NoOp(${sessionId})
exten => _X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _X.,n,hangup


exten => _[0-9a-zA-Z].,1,NoOp(${EXTEN})
;same => n,AGI(agi://127.0.0.1:4577/dialoutprocess)
same => n,Macro(execute-ccc,dialoutprocess,${EXTEN})
same => n,NoOp(${sessionId})
same => n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;same => n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
same=> n,hangup

exten => failed,1,NoOp(${CHANNEL})
same => n,hangup

exten => _+X.,1,NoOp(${EXTEN})
;exten => _+X.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _+X.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _+X.,n,NoOp(${sessionId})
exten => _+X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _+X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _+X.,n,hangup

exten => _***XXX.,1,NoOp(${EXTEN})
;exten => _***XXX.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _***XXX.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _***XXX.,n,NoOp(${sessionId})
exten => _***XXX.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten =>_***XXX.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _***XXX.,n,hangup

exten => _*X.,1,NoOp(${EXTEN})
;exten => _*X.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _*X.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _*X.,n,NoOp(${sessionId})
exten => _*X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _*X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _*X.,n,hangup

exten => _*X,1,NoOp(${EXTEN})
;exten => _*X,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _*X,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _*X,n,NoOp(${sessionId})
exten => _*X,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _*X,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _*X,n,hangup

exten => _SX.,1,NoOp(${EXTEN})
;exten => _SX.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _SX.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _SX.,n,NoOp(${sessionId})
exten => _SX.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten =>_SX.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _SX.,n,hangup

exten => _SX,1,NoOp(${EXTEN})
exten => _SX,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _SX,n,NoOp(${sessionId})
exten => _SX,n,AGI(agi://127.0.0.1:4577/updateHangcupstatus)
exten => _SX,n,hangup

include => BLF_group_pickup

exten => h,1,NoOp(${sessionId})

[hosted-fax-dialout]
exten => _**X.,1,Answer()
exten => _**X.,n,AGI(agi://127.0.0.1:4577/handFaxHold)
exten => _**X.,n,MusicOnHold(default,600)
exten => _**X.,n,hangup

exten => _**X,1,Answer()
exten => _**X,n,AGI(agi://127.0.0.1:4577/handFaxHold)
exten => _**X,n,MusicOnHold(default,600)
exten => _**X,n,hangup

exten => _X.,1,NoOp(${EXTEN})
exten => _X.,n,Set(FROM-FAX=YES)
;exten => _X.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _X.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _X.,n,NoOp(${sessionId})
exten => _X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _X.,n,hangup

exten => _*X.,1,NoOp(${EXTEN})
;exten => _*X.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _*X.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
exten => _*X.,n,NoOp(${sessionId})
exten => _*X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _*X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _*X.,n,hangup

exten => h,1,NoOp(${sessionId})


[hosted-dialout-transfer]
exten => _X.,1,NoOp(${EXTEN})
exten => _X.,n,Set(FROM-TRANSFER=YES)
;;exten => _X.,n,AGI(agi://127.0.0.1:4577/dialoutprocess)
exten => _X.,n,Macro(execute-ccc,dialoutprocess,${EXTEN})
;exten => _X.,n,Dial(SIP/astercc-1002)
exten => _X.,n,hangup
exten => h,1,hangup

exten => transfer,1,NoOp("i am transfer")
exten => transfer,n,hangup

[hosted-dialin]
;exten => _X.,1,Answer()
;exten => _X.,n,MusicOnHold()
;exten => _X.,n,Hangup

exten => s,1,NoOp(${EXTEN})
exten => s,n,NoOp(CALLERID:${CALLERID(num)})
exten => s,n,AGI(agi://127.0.0.1:4577/dialinprocess)
exten => s,n,NoOp(${sessionId})
exten => s,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => s,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => s,n,hangup

exten => _X.,1,NoOp(${EXTEN})
exten => _X.,n,NoOp(CALLERID:${CALLERID(num)})
exten => _X.,n,Ringing()
exten => _X.,n,AGI(agi://127.0.0.1:4577/dialinprocess)
exten => _X.,n,NoOp(${sessionId})
exten => _X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _X.,n,NoOp(${AAAA11})
exten => _X.,n,hangup

exten => _***XXX.,1,NoOp(${EXTEN})
exten => _***XXX.,n,NoOp(CALLERID:${CALLERID(num)})
exten => _***XXX.,n,AGI(agi://127.0.0.1:4577/dialinprocess)
exten => _***XXX.,n,NoOp(${sessionId})
exten => _***XXX.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _***XXX.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _***XXX.,n,hangup

exten => _+X.,1,NoOp(${EXTEN})
exten => _+X.,n,NoOp(CALLERID:${CALLERID(num)})
exten => _+X.,n,AGI(agi://127.0.0.1:4577/dialinprocess)
exten => _+X.,n,NoOp(${sessionId})
exten => _+X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _+X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _+X.,n,hangup

exten => _*X.,1,NoOp(${EXTEN})
exten => _*X.,n,NoOp(CALLERID:${CALLERID(num)})
exten => _*X.,n,AGI(agi://127.0.0.1:4577/dialinprocess)
exten => _*X.,n,NoOp(${sessionId})
exten => _*X.,n,AGI(agi://127.0.0.1:4577/updateHangupstatus)
;exten => _*X.,n,Macro(execute-ccc,updateHangupstatus,${EXTEN})
exten => _*X.,n,hangup

exten => o,1,NoOp(user exit voicemail)
same => n,SET(RECEPTIONIST=yes)
same => n,Goto(hosted-dialin,${DIDNUM},1)

exten => a,1,NoOp(user exit voicemail)
same => n,VoicemailMain(${VMUSER}@${VMREALM})

;exten => h,1,AGI(agi://127.0.0.1:4577/hangupset)

[hosted-from-pstn]
exten => s,1,NoOp(${EXTEN})
exten => s,n,wait(2)
exten => s,n,Goto(hosted-dialin,${DID},1)
exten => s,n,hangup

exten => _X.,1,NoOp(${EXTEN})
exten => _X.,n,wait(2)
exten => _X.,n,Goto(hosted-dialin,${EXTEN},1)
exten => _X.,n,hangup

exten => _+X.,1,NoOp(${EXTEN})
exten => _+X.,n,wait(2)
exten => _+X.,n,Goto(hosted-dialin,${EXTEN},1)
exten => _+X.,n,hangup

[hosted-from-analog]
exten => s,1,NoOp(${EXTEN})
exten => s,n,wait(2)
exten => s,n,Answer()
exten => s,n,Goto(hosted-dialin,${DID},1)
exten => s,n,hangup

exten => _X.,1,NoOp(${EXTEN})
exten => _X.,n,wait(2)
exten => _X.,n,Answer()
exten => _X.,n,Goto(hosted-dialin,${EXTEN},1)
exten => _X.,n,hangup

exten => _+X.,1,NoOp(${EXTEN})
exten => _+X.,n,wait(2)
exten => _+X.,n,Answer()
exten => _+X.,n,Goto(hosted-dialin,${EXTEN},1)
exten => _+X.,n,hangup

[hosted-internal]
;exten => _.,1,NoCDR()
;exten => _.,n,AGI(agi://127.0.0.1:4577/dialinnerprocess)
;exten => _.,n,hangup

;exten => h,1,hangup


;;;;;;;;;;;;DIAL TO AGENT;;;;;;;;;;;;;;;;

[queue-invitemember]
exten => _X.,1,AGI(agi://127.0.0.1:4577/queueinvitemember)

;exten => h,1,hangup

[queue-gotomeetroom]
exten => _X.,1,AGI(agi://127.0.0.1:4577/playagentno)
exten => _X.,n,GotoIf($["${DIALPART}" = "caller"]?mcount:agent)
exten => _X.,n(mcount),MeetMeCount(${EXTEN},MCOUNT)
exten => _X.,n,Noop(${MCOUNT})
exten => _X.,n,GotoIf($["${MCOUNT}" = "0"]?changup:caller)
exten => _X.,n(caller),Meetme(${EXTEN},'qrdMF')
exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n(changup),Hangup
;
;exten => _X.,n(agent),AGI(agi://127.0.0.1:4577/queuemeetme)
exten => _X.,n(agent),Meetme(${EXTEN},'qdMF')
exten => _X.,n,Hangup

exten => _X,1,AGI(agi://127.0.0.1:4577/playagentno)
exten => _X,n,GotoIf($["${DIALPART}" = "caller"]?caller:agent)
exten => _X,n(caller),Meetme(${EXTEN},'qrdMF')
exten => _X,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X,n,Hangup
;
;exten => _X,n(agent),AGI(agi://127.0.0.1:4577/queuemeetme)
exten => _X,n(agent),Meetme(${EXTEN},'qdMF')
exten => _X,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),NoOp(${MCOUNT});MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup

[queue-bridge]
;exten => _X.,1,AGI(agi://127.0.0.1:4577/playagentno)
exten => _X.,1,Macro(execute-ccc,playagentno,${EXTEN})
exten => _X.,n,GotoIf($["${DIALPART}" = "caller"]?bridge:agent)
exten => _X.,n(bridge),Bridge(\${AGENTCHAN})
exten => _X.,n,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => _X.,n,Hangup
;exten => _X.,n(agent),MusicOnHold(default,${DEFAULTMOHTIMEOUT})
exten => _X.,n(agent),SET(DIALPART=agent)
exten => _X.,n,Macro(execute-ccc,playagentno,${EXTEN})
exten => _X.,n,MusicOnHold(default,${DEFAULTMOHTIMEOUT})
exten => _X.,n,Hangup

;exten => _X,1,AGI(agi://127.0.0.1:4577/playagentno)
exten => _X,1,Macro(execute-ccc,playagentno,${EXTEN})
exten => _X,n,GotoIf($["${DIALPART}" = "caller"]?bridge:agent)
exten => _X,n(bridge),Bridge(\${AGENTCHAN})
exten => _X,n,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => _X,n,Hangup
;exten => _X,n(agent),MusicOnHold(default,${DEFAULTMOHTIMEOUT})
exten => _X,n(agent),SET(DIALPART=agent)
exten => _X,n,Macro(execute-ccc,playagentno,${EXTEN})
exten => _X,n,MusicOnHold(default,${DEFAULTMOHTIMEOUT})
exten => _X,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,Hangup

[queue-bridge-new]
exten => _X.,1,SET(DIALPART=caller)
exten => _X.,n,GotoIf($["${DIALPART}" = "caller"]?caller:agent)
exten => _X.,n(caller),SET(TRYPLAYAGENTNO=1)
exten => _X.,n(tryplay),AGI(agi://127.0.0.1:4577/playagentno)
exten => _X.,n,SET(TRYPLAYAGENTNO=${TRYPLAYAGENTNO} + 1)
exten => _X.,n,Noop(${TRYPLAYAGENTNO})
exten => _X.,n,GotoIf($["${AGENTCHAN}" != ""]?bridge)
exten => _X.,n,GotoIf($[${TRYPLAYAGENTNO} = 4]?nhangup:tryplay)
exten => _X.,n(bridge),Bridge(\${AGENTCHAN})
exten => _X.,n,Hangup
exten => _X.,n(agent),MusicOnHold()
exten => _X.,n,Hangup
exten => _X.,n(nhangup),AGI(agi://127.0.0.1:4577/bridgefailed)
exten => _X.,n,Hangup

exten => _X,1,SET(DIALPART=caller)
exten => _X,n,GotoIf($["${DIALPART}" = "caller"]?caller:agent)
exten => _X,n(caller),SET(TRYPLAYAGENTNO=1)
exten => _X,n(tryplay),AGI(agi://127.0.0.1:4577/playagentno)
exten => _X,n,SET(TRYPLAYAGENTNO=${TRYPLAYAGENTNO} + 1)
exten => _X,n,Noop(${TRYPLAYAGENTNO})
exten => _X,n,GotoIf($["${AGENTCHAN}" != ""]?bridge)
exten => _X,n,GotoIf($[${TRYPLAYAGENTNO} = 4]?nhangup:tryplay)
exten => _X,n(bridge),Bridge(\${AGENTCHAN})
exten => _X,n,Hangup
exten => _X,n(agent),MusicOnHold()
exten => _X,n,Hangup
exten => _X,n(nhangup),AGI(agi://127.0.0.1:4577/bridgefailed)
exten => _X,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,Hangup

[transfer-queue]
exten => _.,1,Set(__CALLTYPE=consult)
exten => _.,2,queue(${EXTEN})

[nwaycall-invite-inner]
exten => _X.,1,Set(DIALPART=nwaycall)
exten => _X.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=internal)
exten => _X.,n,NoOP(${CONSUTDST})
exten => _X.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _X.,n(meetme),Dial(Local/${CONSUTDST}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^${CONFNO}^1))
exten => _X.,n,Goto(failed)
exten => _X.,n(normal),Dial(Local/${CONSUTDST}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^C-${CONFNO}-${NCOUNT}^1))
exten => _X.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallfailed)

exten => cancel,1,AGI(agi://127.0.0.1:4577/nwaycallfailed)

exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallfailed)

[nwaycall-invite-queue]
exten => _.,1,Set(DIALPART=nwaycall)
exten => _.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=queue)
exten => _.,n,NoOP(${CONSUTDST})
exten => _.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _.,n(meetme),Dial(Local/${CONSUTDST}@transfer-queue/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^${CONFNO}^1))
exten => _.,n,Goto(failed)
exten => _.,n(normal),Dial(Local/${CONSUTDST}@transfer-queue/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^C-${CONFNO}-${NCOUNT}^1))
exten => _.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallfailed)

exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallfailed)

[nwaycall-invite-exter]
exten => _X.,1,Set(DIALPART=nwaycall)
exten => _X.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=external)
exten => _X.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _X.,n(meetme),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^${CONFNO}^1))
exten => _X.,n,Goto(failed)
exten => _X.,n(normal),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^C-${CONFNO}-${NCOUNT}^1))
exten => _X.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallfailed)

exten => _***XXX.,1,Set(DIALPART=nwaycall)
exten => _***XXX.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=external)
exten => _***XXX.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _***XXX.,n(meetme),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^${CONFNO}^1))
exten => _***XXX.,n,Goto(failed)
exten => _***XXX.,n(normal),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},tTG(nwaycall-consulted^C-${CONFNO}-${NCOUNT}^1))
exten => _***XXX.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallfailed)

exten => cancel,1,AGI(agi://127.0.0.1:4577/nwaycallfailed)

exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallfailed)
;exten => i,1,AGI(agi://127.0.0.1:4577/aaaaa?type=agnethangup)

[nwaycall-btrans-exter]
exten => _X.,1,Set(DIALPART=nwaycall)
exten => _X.,n,Set(__AGENTBLINDTRANSFER=yes)
exten => _X.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=external)
exten => _X.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _X.,n(meetme),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},G(nwaycall-trans-consulted^${CONFNO}^1))
exten => _X.,n,Goto(failed)
exten => _X.,n(normal),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},G(nwaycall-trans-consulted^${CONFNO}^1))
exten => _X.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallhangup)

exten => _***XXX.,1,Set(DIALPART=nwaycall)
exten => _***XXX.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=external)
exten => _***XXX.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _***XXX.,n(meetme),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},G(nwaycall-trans-consulted^${CONFNO}^1))
exten => _***XXX.,n,Goto(failed)
exten => _***XXX.,n(normal),Dial(Local/${EXTEN}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},G(nwaycall-trans-consulted^${CONFNO}^1))
exten => _***XXX.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallhangup)

exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)

[nwaycall-btrans-inner]
exten => _X.,1,Set(DIALPART=nwaycall)
exten => _X.,n,Set(__AGENTBLINDTRANSFER=yes)
exten => _X.,n,AGI(agi://127.0.0.1:4577/nwaycallinvite?dialtype=internal)
exten => _X.,n,NoOP(${CONSUTDST})
exten => _X.,n,GotoIf($["${NCOUNT}" = "1"]?meetme:normal)
exten => _X.,n(meetme),Dial(Local/${CONSUTDST}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},G(nwaycall-trans-consulted^${CONFNO}^1))
exten => _X.,n,Goto(failed)
exten => _X.,n(normal),Dial(Local/${CONSUTDST}@hosted-dialout/n,${DEFAULTRINGTIMEOUT},G(nwaycall-trans-consulted^${CONFNO}^1))
exten => _X.,n(failed),AGI(agi://127.0.0.1:4577/nwaycallhangup)

exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)

[nwaycall-trans-consulted]
exten => _X.,1,Goto(meetme)
exten => _X.,n,AGI(agi://127.0.0.1:4577/nwaycallconsulted)
exten => _X.,n(meetme),Set(CCONFNO=${EXTEN})
exten => _X.,n,Meetme(${EXTEN},'qdMF')

exten => _X.,n,hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n(mcount),MeetMeCount(${CCONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),MeetMeAdmin(${CCONFNO},K)
exten => h,n(hangup),Hangup

[nwaycall-trans]
exten => _X.,1,Bridge(\${SHARED(CALLERCHAN)})
;exten => _X.,1,MusicOnHold()
exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n,Hangup

[nwaycall-consulted]
exten => _X.,1,Goto(meetme)
exten => _X.,n,AGI(agi://127.0.0.1:4577/nwaycallconsulted)
exten => _X.,n,GotoIf($["${CALLERCHAN}" = ""]?meetmer:meetmeh)
exten => _X.,n(meetmer),Meetme(${EXTEN},'rqdM')
exten => _X.,n(meetmeh),ChannelRedirect(${CALLERCHAN},nwaycall-hold,s,1)
exten => _X.,n(meetme),Set(CCONFNO=${EXTEN})
exten => _X.,n,Meetme(${EXTEN},'qdMF')

exten => _X.,n,hangup

exten => _C.,1,Goto(meetme)
exten => _C.,n,AGI(agi://127.0.0.1:4577/nwaycallconsulted)
exten => _C.,n,GotoIf($["${CALLERCHAN}" = ""]?meetmer:meetmeh)
exten => _C.,n(meetmer),Meetme(${EXTEN},'rqdM')
exten => _C.,n(meetmeh),ChannelRedirect(${CALLERCHAN},nwaycall-hold,s,1)
exten => _C.,n(meetme),Set(CCONFNO=${EXTEN})
exten => _C.,n,Meetme(${EXTEN},'qdMF')

exten => _C.,n,hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n(mcount),MeetMeCount(${CCONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),MeetMeAdmin(${CCONFNO},K)
exten => h,n(hangup),Hangup


[nwaycall-hold]
;exten => s,1,Answer
exten => s,1,MusicOnHold()
;exten => s,n,Meetme(01,'qdMF')

exten => _X.,1,MusicOnHold()

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})

[nwaycall-start]
exten => _X.,1,AGI(agi://127.0.0.1:4577/nwaycallstart)
exten => _X.,2,Meetme(${CONFNO},'qdMF')
exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup

[consult-resume]
exten => _X.,1,AGI(agi://127.0.0.1:4577/consultresume)
exten => _X.,2,Meetme(${EXTEN},'qdMF')

exten => h,1,NoOp(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?outbound:inbound)
exten => h,n(outbound),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,GoTo(hangup)
;exten => h,n(inbound),AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n(inbound),Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n(hangup),hangup

[consult-hold]
exten => s,1,AGI(agi://127.0.0.1:4577/consulthold)
exten => s,2,MusicOnHold()
exten => s,3,NoOp('call is over here')
exten => s,4,Set(OVERHANGUP=yes)
exten => h,1,NoOp(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?outbound:inbound)
exten => h,n(outbound),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,GoTo(hangup)
;exten => h,n(inbound),AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n(inbound),Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n(hangup),hangup

[nwaycall-return]
exten => _X.,1,AGI(agi://127.0.0.1:4577/nwaycallreturn)
exten => _X.,2,Meetme(${CONFNO},'qdMF')
exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n,Hangup

exten => s,1,AGI(agi://127.0.0.1:4577/nwaycallreturn)
exten => s,2,Meetme(${CONFNO},'qdMF')
exten => s,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => s,n,Hangup

exten => _C.,1,AGI(agi://127.0.0.1:4577/nwaycallreturn)
exten => _C.,2,Meetme(${CONFNO},'qdMF')
exten => _C.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _C.,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup


[nwaycall-rate]
exten => s,1,AGI(agi://127.0.0.1:4577/queuerate)

[nwaycall-return-queue]
exten => _.,1,Queue(${EXTEN})

[nwaycall-transfer-inner]
exten => _X.,1,Set("__CALLTYPE=transfer")
exten => _X.,2,AGI(agi://127.0.0.1:4577/transferplayagentno)
exten => _X.,3,GotoIf($["${DIALPART}" = "caller"]?caller:agent)
exten => _X.,n(caller),Meetme(${CONFNO},'qrdMF')
exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n,Hangup
;
exten => _X.,n(agent),Set("__CALLTYPE=transfer")
exten => _X.,n,AGI(agi://127.0.0.1:4577/transfertoagent)
exten => _X.,n,Meetme(${CONFNO},'qdMF')
exten => _X.,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup


;;;;;;;;;;;;AGENT DIAL OUT;;;;;;;;;;;;;;;;

[agent-invite]
exten => _X.,1,AGI(agi://127.0.0.1:4577/agentinvite)
exten => h,1,Hangup

[agent-dialout]
exten => _X.,1,AGI(agi://127.0.0.1:4577/agentdialout)
exten => _***XXX.,1,AGI(agi://127.0.0.1:4577/agentdialout)
exten => h,1,AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,Hangup

[agent-dialout-gotomeetroom]
;exten => _X.,1,NoOP(${EXTEN})
exten => _X.,1,Meetme(${EXTEN},'qrdMF')
exten => _X.,n,Meetme(${EXTEN},'qdMF')

exten => _X,1,Meetme(${EXTEN},'qrdMF')
exten => _X,n,Meetme(${EXTEN},'qdMF')

exten => h,1,AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),NoOp(${MCOUNT});MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup

[agent-dialout-bridge]
;exten => _X.,1,MusicOnHold()
exten => _X.,1,AGI(agi://127.0.0.1:4577/agentwait)
;exten => _X.,n,MixMonitor(${MONITORFILE}.wav,ab)
exten => _X.,n(bridge),Bridge(\${AGENTCHAN})
;:exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n,Hangup

;exten => h,1,AGI(agi://127.0.0.1:4577/queuerate)
exten => h,1,AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
;exten => h,n,Hangup

[agent-dialout-bridge-new]
exten => _X.,1,MusicOnHold()
;exten => _X.,n,MixMonitor(${MONITORFILE}.wav,ab)
exten => _X.,n(bridge),Bridge(\${AGENTCHAN})
;exten => _X.,n,AGI(agi://127.0.0.1:4577/queuerate)
exten => _X.,n,Hangup

exten => h,1,AGI(agi://127.0.0.1:4577/queuerate)
exten => h,n,Set(TRYHANGUPC=1)
exten => h,n(tryhangup),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,SET(TRYHANGUPC=${TRYHANGUPC} + 1)
exten => h,n,Noop(${TRYHANGUPC})
exten => h,n,GotoIf($["${TRYHANGUP}" = "yes"]?end)
exten => h,n,GotoIf($[${TRYHANGUPC} = 4]?end:tryhangup)
exten => h,n(end),Noop(${TRYHANGUPC})
;exten => h,n,Hangup

[bridge-call-hold]
exten => s,1,NoOp('call hold')
exten => s,2,AGI(agi://127.0.0.1:4577/callhold)
exten => s,3,MusicOnHold(${HOLDMOH})
exten => s,4,NoOp('call is over here')
exten => s,5,Set(OVERHANGUP=yes)
exten => h,1,NoOp(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?outbound:inbound)
exten => h,n(outbound),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,GoTo(hangup)
;exten => h,n(inbound),AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n(inbound),Macro(execute-ccc,nwaycallhangup,${EXTEN})
;exten => h,n(hangup),hangup

[bridge-call-hold-silence]
exten => s,1,AGI(agi://127.0.0.1:4577/callhold)
exten => s,2,MusicOnHold(ccsilence)
exten => s,3,NoOp('call is over here')
exten => s,4,Set(OVERHANGUP=yes)
exten => h,1,NoOp(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?outbound:inbound)
exten => h,n(outbound),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,GoTo(hangup)
;exten => h,n(inbound),AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n(inbound),Macro(execute-ccc,nwaycallhangup,${EXTEN})
;exten => h,n(hangup),hangup

[bridge-call-resume]
exten => s,1,AGI(agi://127.0.0.1:4577/callresume)
exten => s,n,GotoIf($["${RAGENTCHAN}" = ""]?meetme)
exten => s,n,Bridge(\${RAGENTCHAN})
;exten => s,n(hangup),hangup
exten => s,n(hangup),goto(h,1)
exten => s,n(meetme),MeetMe(${CONFNO},qdMF)

exten => h,1,NoOp(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?outbound:inbound)
exten => h,n(outbound),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,GoTo(hangup)
;exten => h,n(inbound),AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n(inbound),Macro(execute-ccc,nwaycallhangup,${EXTEN})
;exten => h,n(hangup),hangup


[meemtme-raise]
exten => _X.,1,MeetMeAdmin(${EXTEN},V)
exten => _X.,2,hangup()

exten => _X,1,MeetMeAdmin(${EXTEN},V)
exten => _X,2,hangup()

[meemtme-lower]
exten => _X.,1,MeetMeAdmin(${EXTEN},v)
exten => _X.,n,hangup()

exten => _X,1,MeetMeAdmin(${EXTEN},v)
exten => _X,n,hangup()

[agent-callspyinit]
exten => _X.,1,AGI(agi://127.0.0.1:4577/agentspy)
exten => h,1,Hangup

[agent-callspy]
exten => _X.,1,MeetMe(${EXTEN},'qrl')
;exten => _.,1,MeetMe(${EXTEN},'qrl')

[agent-callbarge]
exten => _X.,1,MeetMe(${EXTEN},'qr')
;exten => _.,1,MeetMe(${EXTEN},'qr')

[agent-login]
exten => s,1,NoOp(${EXTEN})
exten => s,n,AGI(agi://127.0.0.1:4577/agentlogin)

[agent-logoff]
exten => s,1,NoOp(${EXTEN})
exten => s,n,AGI(agi://127.0.0.1:4577/agentlogoff)

[agent-switch-mode]
exten => normal,1,NoOp(${EXTEN})
exten => normal,n,AGI(agi://127.0.0.1:4577/agentswitchmode)

exten => outbound,1,NoOp(${EXTEN})
exten => outbound,n,AGI(agi://127.0.0.1:4577/agentswitchmode)

exten => inbound,1,NoOp(${EXTEN})
exten => inbound,n,AGI(agi://127.0.0.1:4577/agentswitchmode)


[hosted-conference]
exten => _X.,1,NoOp(${EXTEN})
exten => _X.,n,MeetMe(${EXTEN},${CONFERENCEPARM})
exten => _X.,n,AGI(agi://127.0.0.1:4577/leaveConference)

exten => h,1,AGI(agi://127.0.0.1:4577/leaveConference)
exten => h,n,hangup()

[hosted-conference-invite]
exten => _X.,1,Dial(Local/${EXTEN}@hosted-dialout/nj,${DEFAULTRINGTIMEOUT})
exten => h,1,hangup()

[hosted-conference-enter]
exten => _X.,1,AGI(agi://127.0.0.1:4577/inviteConference)
exten => h,1,hangup()

[conference-invite]
exten => _X.,1,AGI(agi://127.0.0.1:4577/conferenceInvite)
exten => h,1,hangup()

[bridge-gotomeetroom]
;exten => _X.,1,AGI(agi://127.0.0.1:4577/bridgetomeetme)
exten => _X.,1,Set(__CONFNO=${EXTEN})
exten => _X.,n,Set(MEETME_RECORDINGFILE=${MONITORFILE}-1)
exten => _X.,n,Set(MEETME_RECORDINGFORMAT=wav)
exten => _X.,n,Meetme(${EXTEN},'rqdMF')
exten => _X.,n,Macro(execute-ccc,nwaycallhangup,${EXTEN})

exten => _X,1,Set(__CONFNO=${EXTEN})
exten => _X,n,Set(MEETME_RECORDINGFILE=${MONITORFILE}-1)
exten => _X,n,Set(MEETME_RECORDINGFORMAT=wav)
exten => _X,n,Meetme(${EXTEN},'rqdMF')
exten => _X,n,Macro(execute-ccc,nwaycallhangup,${EXTEN})

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),NoOp(${MCOUNT});MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup



[macro-bridge-gotomeetroom]
;exten => _X.,1,AGI(agi://127.0.0.1:4577/bridgetomeetme)
exten => s,1,Set(__CONFNO=${EXTEN})
exten => s,n,Set(MEETME_RECORDINGFILE=${MONITORFILE}-1)
exten => s,n,Set(MEETME_RECORDINGFORMAT=wav)
exten => s,n,Meetme(${EXTEN},'rqdMF')

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n,MeetMeCount(${CONFNO},MCOUNT)
exten => h,n,Noop(${MCOUNT})
exten => h,n,GotoIf($["${MCOUNT}" = "1"]?kick:hangup)
exten => h,n(kick),NoOp(${MCOUNT});MeetMeAdmin(${CONFNO},K)
exten => h,n(hangup),Hangup


[hosted-device-trunk]
exten => _.,1,NoOp(${EXTEN})
exten => _.,n,DIAL(SIP/${EXTEN})

exten => h,1,hangup

[fax-bridge]
exten => _.,1,Noop(${EXTEN})
exten => _.,n(bridge),Bridge(\${EXTEN})
exten => _.,n,Hangup

exten => h,1,Hangup


[agent-senddtmf]
exten => _X.,1,AGI(agi://127.0.0.1:4577/agentsenddtmf)
exten => _X.,n,GotoIf($["${CHANTYPE}" = "AGENT"]?hold:senddtmf)
exten => _X.,n(hold),MusicOnHold()
exten => _X.,n(senddtmf),NoOp('call is over here')
;exten => _X.,n,Set(OVERHANGUP=yes)
exten => _X.,n,SendDTMF(${EXTEN}#)
exten => _X.,n,Bridge(\${AGENTCHAN})

exten => _X,1,AGI(agi://127.0.0.1:4577/agentsenddtmf)
exten => _X,n,GotoIf($["${CHANTYPE}" = "AGENT"]?hold:senddtmf)
exten => _X,n(hold),MusicOnHold()
exten => _X,n(senddtmf),NoOp('call is over here')
exten => _X,n,Set(OVERHANGUP=yes)
exten => _X,n,SendDTMF(${EXTEN}#)
exten => _X,n,Bridge(\${AGENTCHAN})

exten => h,1,NoOp(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?outbound:inbound)
exten => h,n(outbound),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n,GoTo(hangup)
;exten => h,n(inbound),AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n(inbound),Macro(execute-ccc,nwaycallhangup,${EXTEN})
exten => h,n(hangup),hangup

[agent-2-ivr]
exten => _X.,1,MusicOnHold()
exten => _X.,n,GoTo(hangup)
exten => _X.,n,Set(DIALPART=caller)
exten => _X.,n,AGI(agi://127.0.0.1:4577/agentToIvr)
exten => _X.,n,GotoIf($["${IVRCONFNO}" = ""]?b:m)
exten => _X.,n(b),Bridge(\${IVRAGENTCHAN},p)
exten => _X.,n,GoTo(hangup)
exten => _X.,n(m),Meetme(${IVRCONFNO},'qMF')
exten => _X.,n(hangup),hangup

exten => _X,1,MusicOnHold()
exten => _X.,n,GoTo(hangup)
exten => _X,n,Set(DIALPART=caller)
exten => _X,n,AGI(agi://127.0.0.1:4577/agentToIvr)
exten => _X,n,GotoIf($["${IVRCONFNO}" = ""]?b:m)
exten => _X,n(b),Bridge(\${IVRAGENTCHAN},p)
exten => _X,n,GoTo(hangup)
exten => _X,n(m),Meetme(${IVRCONFNO},'qMF')
exten => _X,n(hangup),hangup

exten => h,1,NoOP(${AGENTDIALOUT})
exten => h,n,GotoIf($["${AGENTDIALOUT}" = "yes"]?dialout)
exten => h,n,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,n,GoTo(hangup); 
exten => h,n(dialout),AGI(agi://127.0.0.1:4577/dialoutnwaycallhangup)
exten => h,n(hangup),hangup

[forced-release]
exten => _9.,1,AGI(agi://127.0.0.1:4577/forcedrelease)
exten => _9.,n,Bridge(\${FRCHAN})

exten => h,1,AGI(agi://127.0.0.1:4577/forcedreleasehangup)
exten => h,n,hangup

[from-pstn-pbx]
exten => _X.,1,NoOP(${EXTEN})
exten => _X.,n,Dial/dahdi/g0/${EXTEN}

[hosted-from-pstn-custom]
exten => XXX,1,Goto(hosted-from-pstn)
exten => XXX,n,Hangup

exten => _X.,1,Set(CDR(accountcode)=831825)
exten => _X.,n,Goto(hosted-dialout)

exten => h,1,Hangup


[macro-PauseMonitorApp1]
exten => s,1,PauseMonitor()
exten => s,n,Playback(beep)
exten => s,n,MacroExit

[macro-UnpauseMonitorApp1]
exten => s,1,UnPauseMonitor()
exten => s,n,Playback(beep)
exten => s,n,MacroExit

[macro-PauseMonitorApp2]
exten => s,1,PauseMonitor()
exten => s,n,Playback(beep)
exten => s,n,MacroExit

[macro-UnpauseMonitorApp2]
exten => s,1,UnPauseMonitor()
exten => s,n,Playback(beep)
exten => s,n,MacroExit

[macro-agentConsult]
exten => s,1,Playback(beep)
exten => s,n,AGI(agi://127.0.0.1:4577/getactagentchan)
exten => s,n,ChannelRedirect(${CALLERCHAN},bridge-gotomeetroom,${CONFNO},1)
exten => s,n,Set(SHARED(agentConsult,${SCHAN})=YES)
exten => s,n,AGI(agi://127.0.0.1:4577/getconsultnum)
exten => s,n,Set(SHARED(agentConsult,${SCHAN})=NO)
exten => s,n,ChannelRedirect(${CHANNEL},nwaycall-invite-exter,${CONSULTNUM},1)
exten => s,n,MacroExit

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})

[macro-agentConsultAgent]
exten => s,1,Playback(beep)
exten => s,n,AGI(agi://127.0.0.1:4577/getactagentchan)
exten => s,n,ChannelRedirect(${CALLERCHAN},bridge-gotomeetroom,${CONFNO},1)
exten => s,n,Set(SHARED(agentConsult,${SCHAN})=YES)
exten => s,n,AGI(agi://127.0.0.1:4577/getconsultnum)
exten => s,n,Set(SHARED(agentConsult,${SCHAN})=NO)
exten => s,n,ChannelRedirect(${CHANNEL},nwaycall-invite-inner,${CONSULTNUM},1)
exten => s,n,MacroExit

;exten => h,1,AGI(agi://127.0.0.1:4577/nwaycallhangup)
exten => h,1,Macro(execute-ccc,nwaycallhangup,${EXTEN})

[parking-call]
exten => _X.,1,NoOP(${EXTEN})
exten => _X.,n,MusicOnHold(default,${SHARED(PARKINGTIMEOUT)})
exten => _X.,n,AGI(agi://127.0.0.1:4577/parkingresume)
exten => _X.,n,hangup

exten => h,1,AGI(agi://127.0.0.1:4577/parkingresume)

[meetme-silence]
exten => _9.,1,AGI(agi://127.0.0.1:4577/meetmeslience)
exten => _X.,n,MeetMe(${EXTEN},${CONFPARM})
exten => _X.,n,AGI(agi://127.0.0.1:4577/leaveConference)

exten => h,1,AGI(agi://127.0.0.1:4577/leaveConference)
exten => h,n,hangup()

[meetme-nosilence]
exten => _9.,1,AGI(agi://127.0.0.1:4577/meetmenoslience)
exten => _X.,n,MeetMe(${EXTEN},${CONFPARM})
exten => _X.,n,AGI(agi://127.0.0.1:4577/leaveConference)

exten => h,1,AGI(agi://127.0.0.1:4577/leaveConference)
exten => h,n,hangup()

[myvoicemail]
exten => o,1,NoOp(user exit voicemail)
same => n,VoicemailMain(${VMUSER}@${VMREALM})

exten => a,1,NoOp(user exit voicemail)
same => n,VoicemailMain(${VMUSER}@${VMREALM})

[ws-waiting]
exten => _X.,1,AGI(agi://127.0.0.1:4577/wsWaiting?${WSPARMSTR})
exten => _X.,n,NoOp(${LASTWSRES})

[dial-agent-ari]
exten => _X.,1,AGI(agi://127.0.0.1:4577/dialAgentByAri)
exten => _X.,n,NoOp("Exit dial agent ari")

[macro-execute-ccc]
exten => s,1,NoOP(${CHANNEL:0:6})
exten => s,n,Gotoif($[${ARG2} = h]?h2n)
exten => s,n,Goto(${ARG2},1)
exten => s,n(h2n),Gotoif($["${CHANNEL:0:6}" = "Bridge"]?h,1)
exten => s,n,Goto(${ARG1},1)

exten => o,1,NoOp(user exit voicemail)
same => n,AGI(agi://127.0.0.1:4577/agentwait)

exten => a,1,NoOp(user exit voicemail)
same => n,VoicemailMain(${VMUSER}@${VMREALM})

exten => _.,1,Noop(${${ARG1}EXEC})
exten => _.,n,Set(${ARG1}SEXEC=${LEN(${${ARG1}EXEC})})
exten => _.,n,Noop(${${ARG1}SEXEC})
exten => _.,n,Set(CURTRYCOUNT=1)
exten => _.,n(execccc),GotoIf($[${CURTRYCOUNT} > 3]?hexit)
exten => _.,n,AGI(agi://${ASTERCCCSERVER}/${ARG1})
exten => _.,n,Set(CURTRYCOUNT=${MATH(${CURTRYCOUNT} + 1,i)})
exten => _.,n,Noop(${${ARG1}EXEC})
exten => _.,n,Noop(${LEN(${${ARG1}EXEC})})
exten => _.,n,GotoIf($[${LEN(${${ARG1}EXEC})} = ${${ARG1}SEXEC}]?execccc)
exten => _.,n(hexit),MacroExit

exten => h,1,MacroExit

[macro-cc-followme]
exten => s,1,NoOp(FollowMe Start)
same => n,AGI(agi://127.0.0.1:4577/ccfollowme)
same => n(end),NoOp(End of FollowMe macro)

[macro-btn-consult]
exten => s,1,AGI(agi://127.0.0.1:4577/nwaycallconsulted)

[macro-backcall-status]
exten => s,1,AGI(agi://127.0.0.1:4577/backcallstatus)

#include queues_context_hostedpbx.conf

