[asterisk-bugs] [Asterisk 0013849]: problem handling race condition - reINVITE before ACK

Asterisk Bug Tracker noreply at bugs.digium.com
Tue Dec 2 16:20:33 CST 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13849 
====================================================================== 
Reported By:                klaus3000
Assigned To:                putnopvut
====================================================================== 
Project:                    Asterisk
Issue ID:                   13849
Category:                   Channels/chan_sip/General
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 154926 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-11-06 11:35 CST
Last Modified:              2008-12-02 16:20 CST
====================================================================== 
Summary:                    problem handling race condition - reINVITE before
ACK
Description: 
Hi! 

Asterisk has problems handling incoming reINVITE if the ACK of the
incoming INVITE is still missing. Although this a pssobile scenario, e.g:

client   proxy     Asterisk
  --INV--->
           ----INV----->
           <---200 ok---
  <-200 ok-
  --ACK--->
  -reINV-->
            --reINV----->
            --ACK------->

This is a scearion which can really happen, e.g. as the processing of the
ACK in the proxy may takes more time. It can also happen without proxy (an
packet can overtake another packet).

The problem is:
1. Asterisk does not accept the reINVITE but sends 491 request pending
Sending 491 is only allowed if the request is in a pending state. But as
the request is finished (200 is already sent) there can not be 491. The
proper solution would be to accept the reINVITE - as this reINVITE is an
implicit ACK to the previous INVITE. Receiving the reINVITE means, that the
caller has received the 200 ok.

2. Asterisk does not accept the ACK to the 491, it goes on resending the
491.

3. My client then tries to reINVITE again, which is accepted by Asterisk.
But then, if the call is hang up from the other side (in this case DHADI),
Asterisk does not send BYE

It happends with pedantic= yes and no.
====================================================================== 

---------------------------------------------------------------------- 
 (0095688) putnopvut (administrator) - 2008-12-02 16:20
 http://bugs.digium.com/view.php?id=13849#c95688 
---------------------------------------------------------------------- 
I took a look at
ftp://ftp.rfc-editor.org/in-notes/internet-drafts/draft-ietf-sipping-race-examples-06.txt

The scenario here seems to correspond to the scenario outlined in section
3.1.5 of that document. Sending a 491 in response to the reINVITE is the
proper action to take. However, Asterisk's behavior of ignoring the ACK for
the 491'd request is incorrect.

I suspect that this is due to the 'pendinginvite' field of the sip_pvt
structure. More specifically, the problem is that we only keep track of one
"pending" INVITE's CSeq number at any given time. By "pending," I mean that
the three-way handshake associated with INVITEs has not completed. Based on
looking at the code, I would be willing to bet that Asterisk misbehaves in
this way any time it responds to an INVITE with a 491, because the CSeq
number of the corresponding ACK will not match the 'pendinginvite' field of
the sip_pvt structure. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-12-02 16:20 putnopvut      Note Added: 0095688                          
======================================================================




More information about the asterisk-bugs mailing list