[asterisk-dev] SIP bug in handling invitestate ?

Luigi Rizzo rizzo at icir.org
Tue Dec 12 15:06:26 MST 2006


i am pretty sure the following is a bug, but can someone confirm it ?

When making an outgoing call, i noticed that even if the caller
hangs up before the callee answers, asterisk does not sent a CANCEL.
It took a bit to reproduce it, but now i know that it happens when
the callee sends back a 401 requesting from credentials.

Here is a sip history that shows the problem:
Example: two asterisk A and B, this is the history as seen from A:

    1. NewChan         Channel SIP/prova-0842e014 - from .....

A makes a call to B by sending an INVITE
    2. TxReqRel        INVITE / 102 INVITE - -UNKNOWN-

B requests credentials to A
    3. Rx              SIP/2.0 / 102 INVITE / 401 Unauthorized

A acks the 401
    4. TxReq           ACK / 102 ACK - -UNKNOWN-
	---> here is the bug: the ack is send by transmit_request()
	which has
        	if (sipmethod == SIP_ACK)
                	p->invitestate = INV_CONFIRMED;
	and this prevents sip_hangup(), later, from sending
	
from now on the attempt to call evolves
    5. AuthResp        Auth response sent for 558 in realm asterisk - nc 1
    6. TxReqRel        INVITE / 103 INVITE - -UNKNOWN-
    7. Rx              SIP/2.0 / 103 INVITE / 100 Trying
    8. Rx              SIP/2.0 / 103 INVITE / 180 Ringing
    9. SchedDestroy    32000 ms

here A hangs up, but because p->invitestate is wrong, the
CANCEL is not sent.

Am i correct in thinking that the change of invitestate to
INV_CONFIRMED should go somewhere else, e.g. on the reception
of the '200 OK' reply to the INVITE ?

	cheers
	luigi


More information about the asterisk-dev mailing list