Summary:ASTERISK-24508: pjsip - REFER request from SNOM is rejected with "400 bad request" - DEBUG shows "Received a REFER without a parseable Refer-To"
Reporter:Beppo Mazzucato (beppo.it)Labels:
Date Opened:2014-11-07 09:12:49.000-0600Date Closed:2014-11-19 05:51:52.000-0600
Status:Closed/CompleteComponents:Resources/res_pjsip Resources/res_pjsip_refer
Versions:13.0.0 Frequency of
is the original version of this clone:ASTERISK-24498 Segmentation fault in res_hep_rtcp on attended transfer
is related toASTERISK-27263 Attended transfer by SNOM not working : REFER rejected by Asterisk
Environment:Asterisk 13.0.0 on CentOS 6.5 extension 601 - SNOM 710 extension 602 - yealink T46 extension 603 - Jitsi Attachments:( 0) ASTERISK-24498-13.diff
( 1) backtrace.txt
( 2) issue_24508_capture.pcap
( 3) issue_24508_full_log
( 4) issue_24508_full_log
( 5) log.txt
( 6) log2.txt
( 7) moduleshow_output.txt
( 8) refer-fix-uri.diff
( 9) snom.pcap

The original issue was ASTERISK-24498. In that issue, Asterisk crashed when attempting to convert a received RTCP packet into JSON format. That crash is being fixed under ASTERISK-24498.

After fixing the crash, the attended transfer being initiated by the SNOM was rejected with a 400 bad request. That problem is being handled under this issue.

h3. Original Problem Description

Asterisk crash trying to perform an attended transfer
ext 602 call ext 601
ext 601 put the call on hold
ext 601 call extension 603
when ext 603 answers asterisk crashes

Unattended transfer works properly

If the attended transfer is made by the yealink phone (in other words echanging the roles of ext 601 and ext 602 above) it works properly

Same scenario doesn't crash with asterisk 11.13.1

I'm attaching log and backtrace

h3. New Problem (REFER failure)

I'm attaching the pcap capture for your further investigation.

I tested the patch ... it doesn't crash anymore but the transfer doesn't complete in fact asterisk reply with a "400 Bad Request" to the REFER message from the snom phone. I'm attaching the log showing this, please let me know if you need the pcap.
Comments:By: Matt Jordan (mjordan) 2014-11-07 09:15:45.413-0600

We require a complete debug log to help triage the issue. This document will provide instructions on how to collect debugging logs from an Asterisk machine for the purpose of helping bug marshals troubleshoot an issue: https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information

Please make sure you have 'pjsip set logger on'. We will need the full debug output for the issue - see the instructions on the wiki for generating the log file appropriately.

By: Beppo Mazzucato (beppo.it) 2014-11-07 09:40:19.446-0600

Requested full debug log

By: Beppo Mazzucato (beppo.it) 2014-11-07 09:40:50.474-0600

Full debug log attached

By: Matt Jordan (mjordan) 2014-11-07 14:05:38.201-0600

Just to double check - you do have {{res_pjsip_refer}} loaded, right?

By: Beppo Mazzucato (beppo.it) 2014-11-08 01:03:06.977-0600

yes the pjsip refer module up and running (see below for the complete list)

As I stated in the original ticket, if the attended transfer is made by the yealink phone (in other words exchanging the roles of ext 601 and ext 602 in the example) it works properly and the refer is accepted.

[Edit by Rusty - removed excessive console output and attached as moduleshow_output.txt - per the guidelines]

By: Rusty Newton (rnewton) 2014-11-10 15:14:12.390-0600

Beppo, looks like Asterisk doesn't like the Refer-to from the SNOM.

[2014-11-07 16:34:46] DEBUG[1748] res_pjsip_refer.c: Received a REFER without a parseable Refer-To ('sip:603@;user=phone?Replaces=545ce68db624-gdhc4gp41882%3Bto-tag%3Da0b21fa1-e26d-4a56-b553-a79f329e58f2%3Bfrom-tag%3D2mlnkcxazi') on channel 'PJSIP/601-00000006' from endpoint '601'

We are unsure why at the moment, but some are looking into it.

In the meantime, can you provide a log again, but this time with a correlating PCAP? I'd like to verify what the SNOM is sending to Asterisk.

By: Beppo Mazzucato (beppo.it) 2014-11-11 11:39:29.311-0600

requested log and capture

By: Beppo Mazzucato (beppo.it) 2014-11-11 11:40:09.759-0600

I attached the new log and the related capture

By: Beppo Mazzucato (beppo.it) 2014-11-11 11:41:09.637-0600


By: Rusty Newton (rnewton) 2014-11-13 15:46:58.125-0600


By: Joshua C. Colp (jcolp) 2014-11-15 11:31:50.911-0600

I'm attaching a change which I believe will resolve this issue. Can you please apply it to your Asterisk, rebuild, test, and provide feedback? If it proves successful I will get it through code review.

By: Beppo Mazzucato (beppo.it) 2014-11-16 10:45:57.241-0600

I tested the patch and it works.

The attended transfer complete successfully and I didn't note any side effect or error message in the console.


By: Joshua C. Colp (jcolp) 2014-11-16 17:37:17.648-0600

Thanks! It's now up for code review.

By: herman joossen (woodpecker505) 2017-09-08 08:09:06.248-0500


When making an attended transfer from a SNOM 710 IPphone I have this issue now with Asterisk version 13.13.1.

See below for SIP REFER message and 400 reply from Asterisk:

pbx*CLI> pjsip set logger on
PJSIP Logging enabled
<--- Received SIP request (589 bytes) from UDP: --->
REFER sip: SIP/2.0
v: SIP/2.0/UDP;branch=z9hG4bK-icqox8uxx0j3;rport
f: <sip:41@>;tag=o6z5dyqidr
t: "Vanbroekhoven Danny" <sip:42@;user=phone>;tag=4bcca52e-6253-4996-b250-90c6619e4c73
i: 313530343837353337363537313335-aayjxqpexeo8
Max-Forwards: 5
User-Agent: snom710/
m: <sip:41@;line=mandi9ey>;reg-id=1
r: sip:49@
Referred-By: sip:41@
l: 0

<--- Transmitting SIP response (391 bytes) to UDP: --->
SIP/2.0 400 Bad Request
Via: SIP/2.0/UDP;rport=5060;received=;branch=z9hG4bK-icqox8uxx0j3
Call-ID: 313530343837353337363537313335-aayjxqpexeo8
From: <sip:41@>;tag=o6z5dyqidr
To: "Vanbroekhoven Danny" <sip:42@;user=phone>;tag=4bcca52e-6253-4996-b250-90c6619e4c73
Server: FPBX-
Content-Length:  0

By: Joshua C. Colp (jcolp) 2017-09-08 08:29:33.259-0500

[~woodpecker505] Please open a new issue as this specific one was already resolved.

By: herman joossen (woodpecker505) 2017-09-08 08:42:37.123-0500

ok - I have created a new one : ASTERISK-27263