[Home]

Summary:ASTERISK-03795: find_call fails (pedantic=yes): improper tag checking on outgoing call
Reporter:scgroup (scgroup)Labels:
Date Opened:2005-03-28 11:46:16.000-0600Date Closed:2008-01-15 15:30:45.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Interoperability
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I'm testing Asterisk with a new SIP provider.
Pedantic=yes is required, because on some calls they
send SDP like:

v=0
o=- 3459442714 3459442714 IN IP4 192.168.201.25
s=SIP Call
c=IN IP4 192.168.201.11
t=0 0
m=audio 52322 RTP/AVP 0
c=IN IP4 [provider public IP]
a=rtpmap:0 PCMU/8000

and the 'pedantic' code in process_sdp is needed to get the
proper IP address for audio.

Unfortunately, when pedantic=yes, all outgoing calls fail.

In response to the initial INVITE, provider sends a
challenge with a tag:

SIP/2.0 401 UnAuthorized
[other headers]
f:"Test User" <sip:[my phone number]@[provider].com>;tag=as5822c02a
t:<sip:[dest number]@[provider].com>;tag=1628255942721615
WWW-Authenticate: Digest ...
[other headers]

Asterisk saves the tag in the theirtag member of the
sip_pvt structure and issues a new INVITE with suitable
credentials.

The provider initiates the call and returns progress:

SIP/2.0 183 Session Progress
[other headers]
f:"Test User" <sip:[my phone number]@[provider].com>;tag=as5822c02a
t:<sip:[destnumber]@[provider].com>
;tag=e5559e9a-1dd1-11b2-b48e-b03162323164+e5559e9a

Well, provider is now sending a different tag, so Asterisk
does not find a match, assumes that this response is for a
call it does not know about, and discards it.

Although this is ugly SIP, one can understand why it would
happen, and IMHO it is legal.  RFC 3261 says:

When the originating UAC receives the 401 (Unauthorized),
it SHOULD, if it is able, re-originate the request with
the proper credentials.

I believe that "re-originate" means that we are starting
a new "dialog" and the old tag should be discarded.




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

If I modify the code to do pedantic checking in
process_sdp, but not in find_call, Asterisk works fine
with this provider.

Possible fixes:

1. In find_call, don't check tags on outgoing calls
  (Asterisk always generates unique CallIDs).  Or,

2. Clear the saved tag on 401 or 407 responses, or when
  reissuing an INVITE with credentials.  Or,

3. Allow selective control of 'pedantic' processing.
  E.g. pedantic=keyword,keyword,...  Pedantic=yes
  would enable all checking, for compatibility with
  existing config files.


Comments:By: Mark Spencer (markster) 2005-03-28 13:10:40.000-0600

I trust registration works fine?

By: Mark Spencer (markster) 2005-03-28 13:46:05.000-0600

Should be fixed in CVS head.  Let me know if you still have trouble.

By: Russell Bryant (russell) 2005-04-05 05:16:05

fixed in 1.0

By: Digium Subversion (svnbot) 2008-01-15 15:29:09.000-0600

Repository: asterisk
Revision: 5292

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r5292 | markster | 2008-01-15 15:29:08 -0600 (Tue, 15 Jan 2008) | 2 lines

Clear out received tag in 407/401's (bug ASTERISK-3795)

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

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

By: Digium Subversion (svnbot) 2008-01-15 15:30:45.000-0600

Repository: asterisk
Revision: 5404

U   branches/v1-0/CHANGES
U   branches/v1-0/channels/chan_sip.c

------------------------------------------------------------------------
r5404 | russell | 2008-01-15 15:30:45 -0600 (Tue, 15 Jan 2008) | 2 lines

Clear out received tag in 407/401's (bug ASTERISK-3795)

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

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