[Home]

Summary:ASTERISK-16987: [patch] (Call Completion / SIP) INVITE Fails (Receive a 404 From Asterisk Server) When Using The URI Provided From A NOTIFY(cc-r
Reporter:George Konopacki (georgekonopacki)Labels:
Date Opened:2010-11-19 08:40:38.000-0600Date Closed:2010-12-20 15:40:34.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 18338.diff
Description:The ‘To’ line in our INVITE contains:

To: <sip:10f2a43020db0a2c787fa67c6c4d279b@192.168.233.250:5060;transport=udp>

The function in ‘find_by_notify_uri_helper’ in file chan_sip.c does a straight strcmp of the ‘To’ with the URI it sent in the NOTIFY (cc-ready).

This match then fails because we have added ';transport=udp'

return !strcmp(agent_pvt->notify_uri, uri) ? CMP_MATCH | CMP_STOP : 0;

agent_pvt->notify_uri = sip:10f2a43020db0a2c787fa67c6c4d279b@192.168.233.250:5060

uri = sip:10f2a43020db0a2c787fa67c6c4d279b@192.168.233.250:5060;transport=udp

The Asterisk server is NOT extracting the URI correctly from the ‘To’ line in the INVITE. So strcmp will always fail.

****** ADDITIONAL INFORMATION ******

We have changed 'find_by_notify_uri_helper' until an official fix can be provided.

Example:

int notify_uri_len = strlen(agent_pvt->notify_uri);
int uri_len = strlen(uri);

if (uri_len  > notify_uri_len)
{
return !strncmp(agent_pvt->notify_uri, uri, notify_uri_len) ? CMP_MATCH | CMP_STOP : 0;
}

return !strcmp(agent_pvt->notify_uri, uri) ? CMP_MATCH | CMP_STOP : 0;
Comments:By: Mark Michelson (mmichelson) 2010-11-19 10:37:30.000-0600

Yep, that's problematic. A more robust solution to the issue would be to use the sip_uri_cmp() function from channels/sip/reqresp_parser.c. It does an RFC 3261-compliant URI comparison. The addition of a "transport" parameter to the URI should still result in the URIs being seen as the same.

I can provide a patch with this shortly.

By: Mark Michelson (mmichelson) 2010-11-19 11:00:31.000-0600

I've uploaded 18338.diff. Let me know if this works for you.

By: George Konopacki (georgekonopacki) 2010-11-24 06:58:06.000-0600

Couldn’t download that patch using wget because our linux box is not connected to a public network.

I made the code changes by hand (using info in 18338.diff)

sip_uri_cmp works a treat.

Thanks,

George

By: Digium Subversion (svnbot) 2010-12-20 15:38:32.000-0600

Repository: asterisk
Revision: 299248

U   branches/1.8/channels/chan_sip.c

------------------------------------------------------------------------
r299248 | mmichelson | 2010-12-20 15:38:31 -0600 (Mon, 20 Dec 2010) | 20 lines

Fix a couple of CCSS issues.

* Make sure to allocate a cc_params structure
 when creating autopeers.

* Use sip_uri_cmp when retrieving SIP CC agents
 and monitors in case parameters appear in the
 URI.

(closes issue ASTERISK-17135)
Reported by: kkm

(closes issue ASTERISK-16987)
Reported by: GeorgeKonopacki
Patches:
     18338.diff uploaded by mmichelson (license 60)
Tested by: GeorgeKonopacki



------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=299248

By: Digium Subversion (svnbot) 2010-12-20 15:40:33.000-0600

Repository: asterisk
Revision: 299249

_U  trunk/
U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r299249 | mmichelson | 2010-12-20 15:40:33 -0600 (Mon, 20 Dec 2010) | 25 lines

Merged revisions 299248 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r299248 | mmichelson | 2010-12-20 15:38:30 -0600 (Mon, 20 Dec 2010) | 20 lines
 
 Fix a couple of CCSS issues.
 
 * Make sure to allocate a cc_params structure
   when creating autopeers.
 
 * Use sip_uri_cmp when retrieving SIP CC agents
   and monitors in case parameters appear in the
   URI.
 
 (closes issue ASTERISK-17135)
 Reported by: kkm
 
 (closes issue ASTERISK-16987)
 Reported by: GeorgeKonopacki
 Patches:
       18338.diff uploaded by mmichelson (license 60)
 Tested by: GeorgeKonopacki
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=299249