Explain HangupCauseClear() And HANGUPCAUSE_KEYS Behaviour

Home » Asterisk Users » Explain HangupCauseClear() And HANGUPCAUSE_KEYS Behaviour
Asterisk Users No Comments

Hello,

I’m giving HangupCauseClear() a try on a Debian Stretch / Asterisk 13.18.3
stack.

My dialplan is:

exten = 1234,1,Set(CHANNEL(hangup-handler-push)=myhandler,s,1)
same = n,Dial(SIP/foo/1234)
same = n,Gosub(myhandler,s,1)
same = n,HangupCauseClear()
same = n,Dial(SIP/bar/1234)

[myhandler]
exten = s,1,Set(HKEYS=${HANGUPCAUSE_KEYS()})

foo trunk is configured to reject calls. bar trunk is configured toaccept calls.

I would expect ${HANGUPCAUSE_KEYS()} to return values that directly relate to lastest call and forget whatever concerns previous calls. It seems:
– on first call, HANGUPCAUSE_KEYS() returns an empty value,
– on second call, HANGUPCAUSE_KEYS() returns two values,

Is my expectation correct ?

Best regards