


[MUMBAI_OFFICE]
exten => _22XXXXXXXXXX!,1,Set(releasedir=orig) ; set releasedir variable to orig before call is set up
;exten => _91XXXXXXXXXX!,n,Dial(${PRI}/${EXTEN:1},,g)
exten => _22XXXXXXXXXX!,n,Dial(SIP/${EXTEN},,ghi)

exten => _22XXXXXXXXXX!,n,Set(releasedir=term) ; far end hung up if we make it here
exten => _22XXXXXXXXXX!,n,Hangup()

; on hangup, record the cause code and release direction in CEL
exten => h,1,Set(CDR(call_disconnector)=)
exten => h,1,Set(CHANNEL(userfield)=CAUSE_CODE=${HANGUPCAUSE}, DIAL_STATUS=${DIALSTATUS}, RELEASE_DIRECTION=${releasedir})





[USA_long_distance]
exten => _1XXXXXXXXXX!,1,Set(releasedir=orig) ; set releasedir variable to orig before call is set up
;exten => _91XXXXXXXXXX!,n,Dial(${PRI}/${EXTEN:1},,g)
exten => _1XXXXXXXXXX!,n,Dial(SIP/${EXTEN},,g)

exten => _1XXXXXXXXXX!,n,Set(releasedir=term) ; far end hung up if we make it here
exten => _1XXXXXXXXXX!,n,Hangup()

; on hangup, record the cause code and release direction in CEL
exten => h,1,Set(CHANNEL(userfield)=CAUSE_CODE=${HANGUPCAUSE}, DIAL_STATUS=${DIALSTATUS}, RELEASE_DIRECTION=${releasedir})



exten => s,2,Dial(local/@internals,30,r)

;[MY_DEMO]
;exten => _91XXXXXXXXXX!,1,NOOP(------------HANGUP STARTED DEMO FROM HERE -------------)
;exten => _91XXXXXXXXXX!,2,Dial(local/${EXTEN}@INDIA_MOBILE,30,r)
;exten => _91XXXXXXXXXX!,3,Playback(sorrynoanswer)
;exten => _91XXXXXXXXXX!,4,Hangup

;[INDIA_MOBILE]

[MY_DEMO]
;exten => s,1,NOOP(------------HANGUP STARTED DEMO FROM HERE -------------)
;exten => s,2,Dial(local/200@internals,30,r)
;exten => s,3,Playback(sorrynoanswer)
;exten => s,4,Hangup

;exten =>123,1,answer
;exten =>123,n,bridge(sip/919825098250)
#include ivr_customer_satisfcation.conf

;exten => s,1,Answer()
;exten => s,n,Queue(${ARG1}|rn)
;exten => s,n,Set(MEMBERINTERFACE='NOANSWER')
;exten => s,n,VoiceMail(${ARG1},u)
;exten => s,n,Hangup()
;exten => h,1,Set(CDR(userfield)=${MEMBERINTERFACE})



exten => _91XXXXXXXXXX!,1,Set(releasedir=orig) ; set releasedir variable to orig before call is set up
exten => _91XXXXXXXXXX!,n,Set(CallerIDString=${CALLERID(all)})
exten => _91XXXXXXXXXX!,n,NoOp( CallerIDString : ${CallerIDString} )
exten => _91XXXXXXXXXX!,n,Set(releasenumber=${EXTEN})
exten => _91XXXXXXXXXX!,n,Set(releaseip=${MYIP})

exten => _91XXXXXXXXXX!,n,NOOP( name  ${CALLERID(name)} )
exten => _91XXXXXXXXXX!,n,NOOP( number  ${CALLERID(number)} )
 
exten => _91XXXXXXXXXX!,n,NOOP(ani ${CALLERID(ani)} ) 
exten => _91XXXXXXXXXX!,n,NOOP(dnid ${CALLERID(dnid)} )
exten => _91XXXXXXXXXX!,n,NOOP( rdnis ${CALLERID(rdnis)}  )
;exten => _91XXXXXXXXXX!,n,Dial(${PRI}/${EXTEN:1},,g)

;exten => _91XXXXXXXXXX!,n,Dial(SIP/${EXTEN},45,geF(ivr_in_cs,s,1))




;exten => _91XXXXXXXXXX!,n,Dial(SIP/${EXTEN},45,ge)

;exten => _91XXXXXXXXXX!,n,Dial(local/${EXTEN}@INDIA_MOBILE,30,r)
exten => _91XXXXXXXXXX!,n,Dial(SIP/${EXTEN},45,ge)
exten => _91XXXXXXXXXX!,n,Progress()

;exten => _91XXXXXXXXXX!,n,Dial(SIP/${EXTEN},45,gefG(INDIA_MOBILE_HANGUP,s,1)F(ivr_in_cs,s,1))
;exten => _91XXXXXXXXXX!,n,Dial(SIP/${EXTEN},45,geF(ivr_in_cs,s,1))

exten => _91XXXXXXXXXX!,n,Set(releasedir=term) ; far end hung up if we make it here
exten => _91XXXXXXXXXX!,n,Set(releasenumber=${CALLERID(dnid)} )
exten => _91XXXXXXXXXX!,n,Set(releaseip=${MYIP})
exten => _91XXXXXXXXXX!,n,AGI(hangupdone.php)


;exten => _91XXXXXXXXXX!,n,Hangup()
exten => _91XXXXXXXXXX!,n,Hangup()

exten => h,1,NoOp( ------ ${releasedir} ---------)
exten => h,n,AGI(hangupdone.php)
exten => h,n(test),GotoIf($["${releasedir}"="term"]?terminator:originator)
exten => h,n(terminator),Set(releasenumber=${CALLERID(dnid)})


exten => h,n(terminatorcdrdnid),Set(CDR(releasenumber)=${CALLERID(dnid)})
exten => h,n(terminatorcdr),Set(CDR(releasenumber)=${CALLERID(dnid)} )

exten => h,n,Set(CDR(userfield)=testTernminator)
exten => h,n,Set(CDR(userfield)={'RELEASE_NUMBER':'${releasenumber}'})
exten => h,n(setcdrvar1),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber},RELEASE_DIRECTION=${releasedir})
exten => h,n(setcdrvar11),Set(CDR(userfield)=RELEASE_DIRECTION=${releasedir})
exten => h,n(setcdrvar2),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber})

exten => h,n,Set(CDR(userfield)=test1)

exten => h,n,Set(CDR(userfield)={'RELEASE_NUMBER':'${releasenumber}'})
exten => h,n,Set(CHANNEL(userfield)=CAUSE_CODE=${HANGUPCAUSE},RELEASE_NUMBER=${releasenumber},DIAL_STATUS=${DIALSTATUS}, RELEASE_DIRECTION=${releasedir})

exten => h,n,goto(hangupbyterm)

exten => h,n,Set(CDR(userfield)=testOriginator)
exten => h,n(originator),Set(releasenumber=${CALLERID(ani)})
;exten => h,1,execifapp(Set(releasenumber=${CALLERID(dnid)}):Set(releasenumber=${CALLERID(dnid)}))
exten => h,n(setcdrvar5),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber},RELEASE_DIRECTION=${releasedir})
exten => h,n,Set(CDR(userfield)={'RELEASE_NUMBER':'${releasenumber}'})
exten => h,n(setcdrvar111),Set(CDR(userfield)=RELEASE_DIRECTION=${releasedir})
exten => h,n(setcdrvar6),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber})
exten => h,n,Set(CDR(userfield)={'RELEASE_NUMBER':'${releasenumber}'})
exten => h,n,Set(CHANNEL(userfield)=CAUSE_CODE=${HANGUPCAUSE},RELEASE_NUMBER=${releasenumber},DIAL_STATUS=${DIALSTATUS}, RELEASE_DIRECTION=${releasedir})

exten => h,n(hangupbyterm),Noop(${CDR(userfield)})
exten => h,n(showvar8),NoOp(${CDR(RELEASE_DIRECTION)})
exten => h,n(showvar9),NoOp(${CDR(RELEASE_NUMBER)})



;[INDIA_MOBILE_HANGUP]
;exten => s,1,Set(releasedir=orig) ; set releasedir variable to orig before call is set up
;exten => s,n,Set(CallerIDString=${CALLERID(all)})
;exten => s,n,NoOp( CallerIDString : ${CallerIDString} )
;exten => s,n,Set(releasenumber=${EXTEN})
;exten => s,n,Set(releaseip=${MYIP})

;exten => s,n,Set(releasedir=term) ; far end hung up if we make it here
;exten => s,n,Set(releasenumber=${CALLERID(dnid)} )
;exten => s,n,Set(releaseip=${MYIP})
;exten => s,n,Hangup()

;exten => h,1,NoOp( ------ ${releasedir1} ---------)
;exten => h,n(test1),GotoIf($["${releasedir}"="term"]?terminatorh:originatorh)
;exten => h,n(terminatorh),Set(releasenumber=${CALLERID(dnid)})
;
;exten => h,n(terminatorcdrdnid),Set(CDR(releasenumber)=${CALLERID(dnid)})
;exten => h,n(terminatorcdr),Set(CDR(releasenumber)=${CALLERID(dnid)} )

;exten => h,n,Set(CDR(userfield)={'RELEASE_NUMBER':'${releasenumber}'})
;exten => h,n(setcdrvar1),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber},RELEASE_DIRECTION=${releasedir})
;exten => h,n(setcdrvar11),Set(CDR(userfield)=RELEASE_DIRECTION=${releasedir})
;exten => h,n(setcdrvar2),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber})

;exten => h,n,goto(hangupbyterm1)

;exten => h,n(originatorh),Set(releasenumber=${CALLERID(ani)})
;;exten => h,1,execifapp(Set(releasenumber=${CALLERID(dnid)}):Set(releasenumber=${CALLERID(dnid)}))
;exten => h,n(setcdrvar5),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber},RELEASE_DIRECTION=${releasedir})
;exten => h,n,Set(CDR(userfield)={'RELEASE_NUMBER':'${releasenumber}'})
;exten => h,n(setcdrvar111),Set(CDR(userfield)=RELEASE_DIRECTION=${releasedir})
;exten => h,n(setcdrvar6),Set(CDR(userfield)=RELEASE_NUMBER=${releasenumber})

;exten => h,n(hangupbyterm1),Noop(${CDR(userfield)})
;exten => h,n(showvar8),NoOp(${CDR(RELEASE_DIRECTION)})
;exten => h,n(showvar9),NoOp(${CDR(RELEASE_NUMBER)})

