Summary:ASTERISK-07999: SER adds port to call ID - still the same SIP dialog?
Reporter:Brett Joseph (bjoseph)Labels:
Date Opened:2006-10-24 17:14:26Date Closed:2006-10-26 10:40:30
Versions:Frequency of
Environment:Attachments:( 0) session.log
Description:A sip 200 RESPONSE from SER can contain a Call-ID header WITH a port number when the orignal INVITE from Asterisk did not.  The result is that 200 RESPONSES get ignored and therefore the call won't complete.  The call orignated by dropping a call file in the /var/spool/asterisk/outgoing directory


Seen on 1.4 B3.  This problem does not happen on  No other versions were tested.  See the attached file for traces and debug info.  

A quick, but not perfect fix,  is to change the strcmps in chan_sip.c::find_call() to strncmps().   See the code snippet below.

if (req->method == SIP_REGISTER)
    found = (!strncmp(p->callid, callid, strlen(p->callid)));
    found = (!strncmp(p->callid, callid, strlen(p->callid) ) &&
            (!pedanticsipchecking || !tag || ast_strlen_zero(p->theirtag) || !strcmp(p->theirtag, tag))) ;

The attached session log shows a trace on a system with the *fix* above.  The debug msg show that the callid don't match.  Look for 'XXXX' in the session.log file.
Comments:By: Olle Johansson (oej) 2006-10-25 06:55:50

Are they allowed to change the call id? I don't think so. Will check.

By: Olle Johansson (oej) 2006-10-25 07:00:06

From reading the RFC, changing the call-id produces a new transaction. You need to compare byte by byte and can't remove anything. They're not allowed to add port number in the middle of a transaction.

What do you think, from reading the RFC?

By: Olle Johansson (oej) 2006-10-25 10:22:56

Mailed the OpenSER user's list

By: Olle Johansson (oej) 2006-10-26 10:40:10

SER does not change any CallIDs. Developer's confirmed to me that this is in fact invalid and should not happen, unless you have some misconfiguration.

By: Olle Johansson (oej) 2006-10-26 10:40:30

Not a bug in Asterisk.