[Home]

Summary:ASTERISK-22932: [patch] - SIP Channel fails to parse refer_to_domain
Reporter:Jan Gaida (jan_amper)Labels:patch
Date Opened:2013-12-02 05:07:35.000-0600Date Closed:2018-01-02 08:30:30.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Transfers
Versions:11.6.0 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-27045 Issue with Parsing Contact Header without Brackets and with additional HeaderParameters seperated with semicolon
Environment:Attachments:( 0) chan_sip_refer_to_domain.diff
Description:The scenario is an attended transfer to a remote domain.

The short description:
When Asterisk receives a REFER message with a refer-to header that contains "?replaces=" query, in chan_sip's function "get_refer_info" the domain is extracted with the query-part. That leads to an error (no such host) when trying to send the INVITE to this domain.

The solution is to remove the query part ('?') in the get_refer_info function (see attached diff file).

---

The following is a description of the events like a SIP trace; with A being transferor, B transferee (Asterisk) and C the transfer-target.

Two calls are established: call1 between B and A, and call2 between A and C.
When starting the transfer, the transferor A sends a REFER to Asterisk (B):
* A -> REFER ({{Refer-to: <sip:C@domain?replaces=call2>}}) -> B
* B -> 202 Accepted -> A
* B -> Notify sipfrag 200 ok -> A
* A -> 200 ok -> B

Now, there should be an outgoing INIVTE with Replaces header:
* B -> INVITE (Replaces: call2) > C
But this INVITE never is send.

In Asterisk's traces you see the following:
* chan_sip.c: Attended transfer: Will use Replace-Call-ID : call2 (No check of from/to tags)
* chan_sip.c: SIP transfer to extension C@internal by A@domain
*  chan_sip.c: This SIP transfer is to a remote SIP extension (remote domain domain?Replaces=call2)

Here you can see the error ^^^^. The remote domain still contains the query part (?Replaces) of the uri.

The traces then continue:
chan_sip.c: SIP attended transfer: Still not our call - generating INVITE with replaces

Then it enters the dialplan where it is redirected with a Dial command:
logger.c:     -- Executing [s@callreferred:4] Dial("SIP/domain-09a40b60", "SIP/C@domain?Replaces=call2|60|") in new stack

And finally the error:
{noformat}
WARNING[32395] chan_sip.c: No such host: domain?Replaces=call2
DEBUG[32395] chan_sip.c: Cant create SIP call - target device not registered
{noformat}
---

With the attached patch, Asterisk behaves as expected.
Comments:By: Jan Gaida (jan_amper) 2013-12-02 05:20:23.690-0600

Possible patch for this issue.

By: Matt Jordan (mjordan) 2013-12-07 20:36:49.548-0600

Just so we can help to verify the patch, can you attach a DEBUG log (with all higher log message types enabled as well) with 'sip set debug on' enabled? That should help confirm the behavior and the correctness of the patch. Thanks!

By: Rusty Newton (rnewton) 2014-01-03 18:23:52.353-0600

Jan, I am just requesting again that you attach the debug Matt requested when you are able.

By: Jan Gaida (jan_amper) 2014-01-20 09:26:31.186-0600

Sorry, but at the moment I have no resources available to reproduce this situation. Hopefully next month I will be able to provide the traces you ask for.

By: Rusty Newton (rnewton) 2014-02-07 10:28:00.684-0600

No worries, I'll put the status back to Waiting On Feedback. Thanks!

By: Rusty Newton (rnewton) 2014-03-10 17:11:27.017-0500

Setting this back to open. Jan, if you get the chance to provide those traces, that would be super helpful. Thanks!

By: Joshua C. Colp (jcolp) 2017-12-18 11:18:00.081-0600

Were you ever able to get the information that was requested and do you still see this problem?

By: Asterisk Team (asteriskteam) 2018-01-02 08:30:30.354-0600

Suspended due to lack of activity. This issue will be automatically re-opened if the reporter posts a comment. If you are not the reporter and would like this re-opened please create a new issue instead. If the new issue is related to this one a link will be created during the triage process. Further information on issue tracker usage can be found in the Asterisk Issue Guidlines [1].
[1] https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines