Cannot get SIP_CAUSE from extensions


I’m running Asterisk 15.5.0 , I’m trying to get the SIP_CAUSE info in order to inspect failure reason.
I added the storesipcause=yes and verified that sip configuration has now value Store SIP_CAUSE: Yes (using sip show settings).
Then I hadded the some logs in my context, with this results:

  • ${CDR(channel)} -> ok, I got the correct value
  • ${CDR(dstchannel)} -> no value
  • ${HASH(SIP_CAUSE,${CDR(dstchannel)})} -> empty
  • ${HASHKEYS(SIP_CAUSE)} -> empty

I’m not understanding what’s wrong…why the dstchannel is empty? I’m calling from my context, it’s correct or is to into the context from-internal (and how)?

If you need more info, please tell me…
Thanks in advance


I’d expect the cause to be stored against the current channel, not the destination.

Also, I wouldn’t expec the destination channel to be set in the CDR until just before that channel was destroyed, as it can change duriing a call.

Ok, thank you.
I resolved adding an handler to the channel hangup in the context from-internal, in this case I have both the dstchannel and the SIP_CAUSE like suggested in a guide , like this :

exten => _X.,n,Set(CHANNEL(hangup_handler_push)=hangup_handler,s,1)

exten => s,1,Verbose(0, Executing Hangup Handler)
same => n,Verbose(0, CHANNEL_ID : ${CHANNEL_ID})
same => n,Set(ReasonTech=${HANGUPCAUSE(${CHANNEL_ID},tech)})
same => n,Set(ReasonAst=${HANGUPCAUSE(${CHANNEL_ID},ast)})
same => n,Verbose(0, ReasonTech : ${ReasonTech})
same => n,Verbose(0, ReasonAst : ${ReasonAst})

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.