Relaying SIP Reason, cause and text between calls

We all know how cute is asterisk when you dial two extensions like Dial(SIP/100&SIP/200) and one of the extensions answers the call: the other extension gets a SIP CANCEL with Reason: SIP;cause=200;text=“Call completed elsewhere” and the “missed call” message doesn’t appear on the other phone.

Unfortunately, the SIP cause is not being relayed when there are multiple calls in a chain. Let’s make an example. If you have three asterisk servers, name A, B and C. A is processing the call, while B and C have one extension connected. A is calling B and C using a command like Dial(SIP/A&SIP/B) and B calls extension 100 with Dial(SIP/100) and C calls extension 200 with Dial(SIP/200).

      ----- B ---- 100
      ----- C ---- 200

If extension 200 answers the call, A sends a CANCEL to B with the reason “Call completed elsewhere”, but B will not send the same reason to Extension 100, so extension 100 will see a missed call.

Is there any way to have Extension 100 to receive the “Call completed elsewhere” when applicable?

I’ve got exactly the same problem: I need a SIP CANCEL with Reason to pass through Asterisk “C” (as described by Idardini). Unfortunately, CANCEL is relayed but reason is lost.

Is there any way to acheive this?


Did you manage to resolve your issue? I have exactly the same problem

You shouldn’t have the same problem as you should be using chan_pjsip, but the OP was using chan_sip.

However the earlier posting is wrong in suggesting the CANCEL is relayed. Asterisk is a back to back user agent, not a SIP proxy. What actually happens is that the cancel results in an AST_CONTROL_HANGUP message, internally, with the nearest ISDN cause code to the original SIP one, and that causes app_dial, to issue ast_hangup() to the outgoing channel, with a copy of the ISDN type hangup cause.

Right I’m using chan_pjsip but after receiving CANCEL with header
SIP ;cause=200 ;text=“Call completed elsewhere”

there are logs:
chan_pjsip.c:2523 hangup_cause2sip: AST hangup cause 0 (no match found in PJSIP)
chan_pjsip.c:2621 chan_pjsip_hangup: Cause: 0
app_dial.c:3316 dial_exec_full: Exiting with DIALSTATUS=CANCEL.
chan_pjsip.c:2621 chan_pjsip_hangup: Cause: 500

in my dialplan (hangup_handler_push) I’m printing ${HANGUPCAUSE} and it’s 127. Is there any way to get info it was CANCEL with “Call completed elsewhere” ?

The text portion is not inspected by either chan_sip or chan_pjsip, so that’s not supported.