Summary: | ASTERISK-28053: chan_pjsip: Wrong or missing Q.850 reason in CANCEL | ||
Reporter: | Simone Lazzaris (simone.lazzaris) | Labels: | patch pjsip |
Date Opened: | 2018-09-13 08:43:43 | Date Closed: | 2021-12-06 09:17:18.000-0600 |
Priority: | Minor | Regression? | |
Status: | Closed/Complete | Components: | Channels/chan_pjsip |
Versions: | 13.23.0 | Frequency of Occurrence | Constant |
Related Issues: | |||
Environment: | Debian 9 X86_64 | Attachments: | ( 0) debug_q850.txt ( 1) qcom_reason850.patch |
Description: | Hi all;
I have an issue regarding the Q850 reason code in CANCEL messages. The scenario is this: number A calls number B; while the second leg is still not established (e.g. while number B is RINGING), A aborts the call. Asterisk will receive a CANCEL message with a Reason field like this: Reason: SIP;cause=487;text="Request terminated by user" Immediatly, a CANCEL is sent to B, with this Reason Reason: Q.850;cause=0 The correct message that my carrier expect is "cause=16". I've not found a way to set the cause via dialplan. Even setting the "Q(16)" flag within the Dial app doesn't work. I've tried to debug the issue and I've found the following line in the debug log: chan_pjsip.c: AST hangup cause 0 (no match found in PJSIP) I think that the issue is due to the fact that the 487 Reason is not forwarded from leg a to leg b. Any hints? | ||
Comments: | By: Asterisk Team (asteriskteam) 2018-09-13 08:43:45.601-0500 Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution. A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report. Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process]. By: Joshua C. Colp (jcolp) 2018-09-14 09:40:14.091-0500 Thank you for taking the time to report this bug and helping to make Asterisk better. Unfortunately, we cannot work on this bug because your description did not include enough information. Please read over the Asterisk Issue Guidelines [1] which discusses the information necessary for your issue to be resolved and the format that information needs to be in. We would be grateful if you would then provide a more complete description of the problem. At a minimum, we need: 1. The specific steps or actions you took that caused you to encounter the problem. 2. The behavior you expected and the location of documentation that led you to that expectation. 3. The behavior you actually encountered. To demonstrate the issue in detail, please include Asterisk log files generated per the instructions on the wiki [2]. If applicable, please ensure that protocol-level trace debugging is enabled, e.g., 'sip set debug on' if the issue involves chan_sip, and configuration information such as dialplan and channel configuration. Thanks! [1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines [2] https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information By: Simone Lazzaris (simone.lazzaris) 2018-09-17 07:32:52.779-0500 Hi Joshua; I've summed up all the relevant information in the ticket description, but I understand your needs for reliable informations. So I've done the test again and I'm attaching the relevant log. In this attempt, the caller is the number 03421950085 (proxed by a kamilio box at IP 212.183.160.238) and the callee is 03631979004 (IP 83.137.237.140). In the line 968 of the log the kamailio send a CANCEL request: {noformat} CANCEL sip:03631979004@212.183.160.238;user=phone SIP/2.0 Via: SIP/2.0/UDP 212.183.160.238;branch=z9hG4bK361a.09665bc5d6cb0a2379cb292ae0d550e3.0 From: "03421950085" <sip:03421950085@212.183.160.238>;tag=mtwl0ivrok To: <sip:03631979004@212.183.160.238;user=phone> Call-ID: 3c64394a57a8-8u0e813m9w70 CSeq: 2 CANCEL Max-Forwards: 70 Content-Length: 0 Reason: SIP;cause=487;text="Request terminated by user" {noformat} As you can see in the logfile, at line 1083 asterisk forwards that CANCEL to the other end (IP 83.137.237.140) with a wrong reason: {noformat} CANCEL sip:03631979004@83.137.237.140:5060 SIP/2.0 Via: SIP/2.0/UDP 83.137.237.154:5060;rport;branch=z9hG4bKPj333a2cae-1f87-4d7f-a7d2-f82269dcd537 From: "03421950085" <sip:03421950085@83.137.237.154>;tag=261f2e78-dac0-41de-988c-721f335baee1 To: <sip:03631979004@83.137.237.140> Call-ID: b99d0ce5-6347-4925-bc6d-1d1cc5ee2af3 CSeq: 27019 CANCEL Reason: Q.850;cause=0 Max-Forwards: 70 User-Agent: Asterisk PBX 13.21.1~qcom-1.1 Content-Length: 0 {noformat} The reason should be "cause=16", not cause=0 By: Simone Lazzaris (simone.lazzaris) 2018-09-17 07:33:36.179-0500 Logfile for the issue By: Joshua C. Colp (jcolp) 2018-09-18 05:21:16.582-0500 We do not currently read or react to the SIP reason in a received message, so that would end up getting ignored. The 0 is being used because that is the default value I believe. By: Joshua C. Colp (jcolp) 2018-09-18 05:22:33.241-0500 I'd also like to add that it's important when filing issues to make sure that things are correct - your log message shows 13.21.1, while you filed against 13.23.0. Everything should match or it causes confusion. By: Simone Lazzaris (simone.lazzaris) 2018-09-18 07:38:01.366-0500 Quick, dirty and ugly "fix" By: Simone Lazzaris (simone.lazzaris) 2018-09-18 07:38:10.760-0500 My apologies for the version; I've done a simple "quick, ugly and dirty" hack in order to pass a compliance test with our carrier partner. It doesn't extract the reason from the SIP message received, simply changes to 16 the default response. I'm attaching the patch. By: Mark Petersen (roadkill) 2021-08-24 10:00:00.963-0500 I have submittet a patch for asterisk 18 been running with this fix in production for 3m and is currently using it with 18.5.1 on our production platform https://gerrit.asterisk.org/c/asterisk/+/16344 https://gerrit.asterisk.org/c/asterisk/+/16345 By: Friendly Automation (friendly-automation) 2021-12-06 09:17:19.837-0600 Change 16345 merged by Friendly Automation: apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING [https://gerrit.asterisk.org/c/asterisk/+/16345|https://gerrit.asterisk.org/c/asterisk/+/16345] By: Friendly Automation (friendly-automation) 2021-12-06 09:22:21.229-0600 Change 16346 merged by Friendly Automation: apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING [https://gerrit.asterisk.org/c/asterisk/+/16346|https://gerrit.asterisk.org/c/asterisk/+/16346] By: Friendly Automation (friendly-automation) 2021-12-06 09:22:24.301-0600 Change 16347 merged by Friendly Automation: apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING [https://gerrit.asterisk.org/c/asterisk/+/16347|https://gerrit.asterisk.org/c/asterisk/+/16347] By: Friendly Automation (friendly-automation) 2021-12-06 09:23:54.044-0600 Change 16344 merged by Joshua Colp: apps/app_dial.c: HANGUPCAUSE reason code for CANCEL is set to AST_CAUSE_NORMAL_CLEARING [https://gerrit.asterisk.org/c/asterisk/+/16344|https://gerrit.asterisk.org/c/asterisk/+/16344] |