[jitsi-dev] Issue Report: SIP outgoing call cancelling fails when using UDP with NAT


#1

Hi,

I encountered a problem that i can't cancel outgoing call. As a workaroung, i switched from udp to tcp, but may be there is some other solution which i do not see. There is, right? Or is it a bug?

Steps to reproduce:
1. Make a sip call using UDP with NAT
2. When second party' phone is ringing, press a red Hang Up button
3. Call window is closed, but second party' phone is still ringing

Following lines appear in jitsi0.log.0:
06:38:15.959 INFO: [501] impl.protocol.sip.OperationSetBasicTelephonySipImpl.createOutgoingCall().184 Creating outgoing call to sip:1234@sip.domainname.com
06:38:19.176 SEVERE: [517] impl.protocol.sip.OperationSetBasicTelephonySipImpl.processResponse().620 Received error: 481 Call leg/transaction does not exist

What i tried to do:
1. Switching jitsi stable to nightly, 2.7.5423 (both Windows x86) - does not help
2. UDP->TCP - helps
3. changing sip server/provider - does not help
4. changing sip client at another party - does not help

Lines from asterisk sip debug log which i think may be relevant (full log below):

<--- SIP read from UDP:176.99.135.24:9807 ---> # 176.99.135.24 = external ip of NAT
CANCEL sip:1234@sip.domainname.com SIP/2.0
Via: SIP/2.0/UDP 176.99.135.24:9807;branch=z9hG4bK-353939-99c5b340b6aaf17a9d7e7413dec44e14

<--- Transmitting (no NAT) to 176.99.135.24:9807 ---> # no NAT, wow, but in previous dialogs NAT was on
SIP/2.0 481 Call leg/transaction does not exist

That "Via" line shoud be somthing like
CANCEL sip:1234@sip.domainname.com SIP/2.0
Via: SIP/2.0/UDP 10.0.0.2:9807;branch=z9h... # that's internal IP of computer with jitsi
or maybe
CANCEL sip:1234@sip.domainname.com SIP/2.0
Via: SIP/2.0/UDP xxx.xxx.252.218:5060;branch=z9h... # that's external ip of server

I searched pull requests @ github, issues @ trac and tried to use google, but nothing found except http://lists.jitsi.org/pipermail/users/2014-September/008004.html which is, i believe, not really relevant.

Asterisk sip debug log in full:

INVITE sip:1234@10.185.211.231:45867;transport=udp SIP/2.0
Via: SIP/2.0/UDP xxx.xxx.252.218:5060;branch=z9hG4bK0a781145;rport
Max-Forwards: 70
Contact: <sip:1235@xxx.xxx.252.218:5060>
Call-ID: 6e3d6a60002531647ada81106c1d6079@sip.domainname.com
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.7.0~dfsg-1ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 440

v=0
o=root 126209699 126209699 IN IP4 xxx.xxx.252.218
s=Asterisk PBX 11.7.0~dfsg-1ubuntu1
c=IN IP4 xxx.xxx.252.218
t=0 0
m=audio 17772 RTP/AVP 4 18 0 8 110 97 101
a=rtpmap:4 G723/8000
a=fmtp:4 annexa=no
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:110 speex/8000
a=rtpmap:97 iLBC/8000
a=fmtp:97 mode=30
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

···

From: "1235" <sip:1235@sip.domainname.com>;tag=as2845dd3b
To: <sip:1234@10.185.211.231:45867;transport=udp>
Date: Sun, 15 Mar 2015 03:38:15 GMT

---
    -- Called SIP/1234

<--- SIP read from UDP:83.149.9.92:20574 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP xxx.xxx.252.218:5060;branch=z9hG4bK0a781145;rport=5060;received=xxx.xxx.252.218
From: "1235" <sip:1235@sip.domainname.com>;tag=as2845dd3b
To: <sip:1234@10.185.211.231:45867;transport=udp>;tag=4161596351
Call-ID: 6e3d6a60002531647ada81106c1d6079@sip.domainname.com
CSeq: 102 INVITE
Content-Length: 0

<------------->
--- (7 headers 0 lines) ---
list_route: no route
    -- SIP/1234-00003c8f is ringing

<--- Transmitting (NAT) to 176.99.135.24:9807 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 10.0.0.2:9807;branch=z9hG4bK-353939-99c5b340b6aaf17a9d7e7413dec44e14;received=176.99.135.24;rport=9807
From: "1235" <sip:1235@sip.domainname.com>;tag=7401e7c0
To: <sip:1234@sip.domainname.com>;tag=as1158c7b9
Call-ID: 61dba86b04e639c668be6d51ff9d9bff@0:0:0:0:0:0:0:0
CSeq: 1 INVITE
Server: Asterisk PBX 11.7.0~dfsg-1ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:1234@xxx.xxx.252.218:5060>
Content-Length: 0

<--- SIP read from UDP:176.99.135.24:9807 --->
CANCEL sip:1234@sip.domainname.com SIP/2.0
Call-ID: 61dba86b04e639c668be6d51ff9d9bff@0:0:0:0:0:0:0:0
To: <sip:1234@sip.domainname.com>
CSeq: 1 CANCEL
From: "1235" <sip:1235@sip.domainname.com>;tag=7401e7c0
Via: SIP/2.0/UDP 176.99.135.24:9807;branch=z9hG4bK-353939-99c5b340b6aaf17a9d7e7413dec44e14
Max-Forwards: 70
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---
Sending to 176.99.135.24:9807 (no NAT)

<--- Transmitting (no NAT) to 176.99.135.24:9807 --->
SIP/2.0 481 Call leg/transaction does not exist
Via: SIP/2.0/UDP 176.99.135.24:9807;branch=z9hG4bK-353939-99c5b340b6aaf17a9d7e7413dec44e14;received=176.99.135.24
From: "1235" <sip:1235@sip.domainname.com>;tag=7401e7c0
To: <sip:1234@sip.domainname.com>;tag=as13891541
Call-ID: 61dba86b04e639c668be6d51ff9d9bff@0:0:0:0:0:0:0:0
CSeq: 1 CANCEL
Server: Asterisk PBX 11.7.0~dfsg-1ubuntu1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0

<------------>
Really destroying SIP dialog '75068d2bbf6820db61b4fdedee45ee2d@10.185.211.231' Method: OPTIONS
z03*CLI> sip set debug off
SIP Debugging Disabled
    -- Got SIP response 486 "Busy here" back from 83.149.9.92:20574
    -- SIP/1234-00003c8f is busy

And in the end, I'd like to thank jitsi developers for an awesome product. Thank you, guys.