[kcs-newcall]
# Extension picks up the line
exten => 2000,1,Answer
exten => 2000,n,Playback(custom/please_wait_for_assistant)
# Do some pre-processing
exten => 2000,n,AGI(KCS-callin1|param1|param2)
# Turn on call recording
exten => 2000,n,MixMonitor(/record/calls/call${NEWPBXCALLID}.wav|b)
# Transfer call to ext 7300
exten => 2000,n,Set(CALLERID(num)=${CALLERID(num)})
exten => 2000,n,Set(CALLERID(name)=${CALLERID(name)}-${NEWPBXCALLID})
exten => 2000,n,Dial(SIP/7300,30,rig)
# Behavior depending on if transfer was successful or not
exten => 2000,n,GotoIf($["${DIALSTATUS}" = "ANSWER"]?finished:failed)
exten => 2000,n(failed),Goto(kcs-callback-ask,6001,1)
exten => 2000,n(finished),AGI(KCS-callout|${NEWPBXCALLID}|param2)
exten => 2000,n,Playback(custom/thank_you_for_using_us)
exten => 2000,n,Playback(custom/you_can_callback_anytime)
exten => 2000,n,Playback(custom/goodbye)
exten => 2000,n,Hangup
|