How Does Chan_sip Match An ACK?

Home » Asterisk Users » How Does Chan_sip Match An ACK?
Asterisk Users 1 Comment

I am trying to debug a SIP issue, between an Asterisk 1.2.32 system that is behind a network device to which I don’t have ready access, which is performing NAT with possibly some kind of SIP ALG, and an Asterisk 11
system on a public IP.

My question is very specific, and I don’t need right now to discuss the ins and outs of the above setup.

What I am seeing is that when I have set up a call from the Asterisk 11
system, the 1.2.32 system is sending 200 OK, and sip debug shows the ACK response coming back from the Asterisk 11 box. However, the ACK
appears not to be understood, because the 200 OK gets re-sent, multiple times, and eventually gives up.

My specific question is, what values in the ACK does chan_sip (1.2.32)
use to match the ACK with the pending 200 OK? My understanding of the chan_sip.c code is not good enough to work it out for certain.

Here is the 200 OK (I’ve changed the address of the public endpoint):

Mar 30 10:20:20 VERBOSE[5811] logger.c: Retransmitting #5 (no NAT) to
SIP/2.0 200 OK
Via: SIP/2.0/UDP;branch=z9hG4bK6bee4b53;received.111.11.111
From: “Tony Mountifield” ;tag=as4ab948f7
To: ;tag=as76e64309
Call-ID: 21bf5fa61b5e98880b96448118310bf7@
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Content-Type: application/sdp Content-Length: 218

o=root 5732 5732 IN IP4
s=session c=IN IP4
t=0 0
m=audio 16282 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off – – – –

And here is the ACK in reply that is not getting understood:

<-- SIP read from ACK sip:12345@ SIP/2.0 Via: SIP/2.0/UDP;branch=z9hG4bK36651b68 Max-Forwards: 70 From: "Tony Mountifield" ;tag=as4ab948f7
To: ;tag=as76e64309
Call-ID: 21bf5fa61b5e98880b96448118310bf7@
CSeq: 102 ACK
User-Agent: Asterisk PBX 11.5.0
Content-Length: 0

So what is it about the ACK that is wrong?

Thanks for any help!

Cheers Tony

One thought on - How Does Chan_sip Match An ACK?

  • In article , Tony Mountifield wrote:

    OK, for the future reference of anyone else having a similar problem, this is what was happening:

    The dialplan was doing an immediate Answer:

    exten => _X.,1,Answer exten => _X.,n,Goto(wherever)

    This means that the answering system, upon receiving the SIP INVITE, would reply with a 100 Trying, followed immediately by a 200 OK.

    Now, the two systems are actually on opposite sides of the Atlantic, and the sending system sent the INVITE with a very short retransmission timeout (T1 appeared to be 228ms due to a qualify time of 114ms). And by the time it received the replies from the receiving system, it had already retransmitted the INVITE.

    However, the receiving system, having sent the 200 OK, then received the repeat INVITE. It looks like it repeated the 200 OK, but then the ACK from the sending system didn’t get recognised properly.

    I appear to have overcome it by putting in a delay before the Answer, so that any repeated INVITE would arrive before the receiving system tried sending the 200 OK to Answer:

    exten => _X.,1,Ringing exten => _X.,n,Wait(1)
    exten => _X.,n,Answer exten => _X.,n,Goto(wherever)

    On further reading, I would think I could also solve it by setting the T1 values in sip.conf, instead of doing the above:

    Should I set “timert1P0”, or “t1minP0” or both, or what?

    Cheers Tony