[Home]

Summary:ASTERISK-24376: res_pjsip_refer: REFER request for remote session attempts to direct channel to external_replaces extension instead of context, without providing for the Referred-To SIP URI
Reporter:Matt Jordan (mjordan)Labels:
Date Opened:2014-09-30 10:45:12Date Closed:2015-01-07 11:38:15.000-0600
Priority:MajorRegression?
Status:Closed/CompleteComponents:Resources/res_pjsip_refer
Versions:12.6.0 13.0.0-beta2 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:Given the following REFER request:

{noformat}
<--- Received SIP request (757 bytes) from UDP:132.177.253.60:5060 --->
REFER sip:6df4b26a-d9ab-4080-8329-db7ac6cf5eb0@132.177.253.27:5063 SIP/2.0
From: <sip:005@h4.aspect.sipit.net>;tag=3e52d60-0-13c4-6009-40e-1086de4d-40e
To: "Asterisk 2002"<sip:2002@132.177.253.27>;tag=596d5116-93c0-4b71-8d09-cf4f48e1362f
Call-ID: 52155115-5701-47ee-a9a8-515d3387508f
CSeq: 2 REFER
Via: SIP/2.0/UDP 132.177.253.60:5060;rport;branch=z9hG4bK-40f-fdaee-77f9b840-e8ba9f0
Refer-To: <sip:callxml@132.177.253.60:5060?Replaces=3320172437-0e2c5300-0e3aabf0-0000000e%40132.177.253.60%3bto-tag%3d3e531d0-0-13c4-6009-40e-44cdcdd1-40e%3bfrom-tag%3d3e52f98-0-13c4-6009-40e-4e8c3410-40e&Require=replaces>
Max-Forwards: 70
Supported: 100rel
Referred-By: sip:callxml@h4.aspect.sipit.net
Contact: <sip:005@132.177.253.60:5060>
Content-Length: 0
{noformat}

In this particular case, the REFER request is attempt to replace a remote dialog with a new URI. Our handling of this is a bit interesting:

# If the {{TRANSFER_CONTEXT}} is present, use that
# Otherwise, use the endpoint's context
# Then attempt to send the channel to the {{external_replaces}} extension in that context

There are a few problems with this:
# The {{external_replaces}} extension is unlikely to exist (it's not exactly well known)
# Even if you create that extension in the appropriate context, it's generally useless. We don't set the destination of the REFER, which should be the URI in the {{Referred-To}} header (in this case, {{sip:callxml@132.177.253.60:5060}}). This means that {{external_replaces}} can't know where it was supposed to send the channel.

Plus, the ERROR message is wrong:

{noformat}
[Sep 30 04:30:46] ERROR[18918]: res_pjsip_refer.c:663 refer_incoming_attended_request: Received REFER for remote session on channel 'PJSIP/unknown-0000000a' from endpoint 'unknown' but 'external_replaces' context does not exist for handling
{noformat}

(It's the extension that's missing, not the context)

Generally, I think it should be:

# Use the {{TRANSFER_CONTEXT}} if available
# Use the endpoint context next
# See if we have an extension matching the user portion of the {{Referred-To}} header.
# If so, go there.

Ideally, we would also have the ability to bypass the dialplan and simply create a new outbound dialog to the SIP URI provided.
Comments: