SIP/2.0 481 Call/Transaction Does Not Exist

When I call an extension 908 from endpoint that is using PUBLIC IP +NAT +TLS the softphone doesnt know when hangup from dialplan

PJSIP History when called from 140 which is TLS NAT

  == Setting global variable 'SIPDOMAIN' to 'xx.xx.xx.xx'
    -- Executing [908@default:1] NoOp("PJSIP/140-0000000c", "Testing calls to speakers. Dialing 908 from ") in new stack
    -- Executing [908@default:2] Set("PJSIP/140-0000000c", "number=08") in new stack
    -- Executing [908@default:3] System("PJSIP/140-0000000c", "/usr/lib/sss/radio08.sh") in new stack
    -- Executing [908@default:4] NoOp("PJSIP/140-0000000c", "pre sip900 script  - SUCCESS") in new stack
    -- Executing [908@default:5] Playback("PJSIP/140-0000000c", "activated") in new stack
       > 0x1f78330 -- Strict RTP learning after remote address set to: 192.168.2.116:51476
       > 0x1f78330 -- Strict RTP qualifying stream type: audio
    -- <PJSIP/140-0000000c> Playing 'activated.gsm' (language 'en')
       > 0x1f78330 -- Strict RTP switching source address to xx.xx.xx.xx:51476
    -- Executing [908@default:6] NoOp("PJSIP/140-0000000c", "pre sip900 script  - SUCCESS") in new stack
    -- Executing [908@default:7] Hangup("PJSIP/140-0000000c", "") in new stack
  == Spawn extension (default, 908, 7) exited non-zero on 'PJSIP/140-0000000c'

Here is the sip history

  Timestamp  (Dir) Address                  SIP Message                        
===== ========== ============================== ===================================
00000 1552309347 * <== xx.xx.xx.xx:52755       INVITE sip:908@xx.xx.xx.xx:5061 SIP/2.0
00001 1552309347 * ==> xx.xx.xx.xx:52755       SIP/2.0 401 Unauthorized
00002 1552309347 * <== xx.xx.xx.xx:52755       ACK sip:908@xx.xx.xx.xx:5061 SIP/2.0
00003 1552309347 * <== xx.xx.xx.xx:52755       INVITE sip:908@xx.xx.xx.xx:5061 SIP/2.0
00004 1552309347 * ==> xx.xx.xx.xx:52755       SIP/2.0 100 Trying
00005 1552309347 * <== 192.168.2.127:5060       REGISTER sip:192.168.2.18 SIP/2.0
00006 1552309347 * ==> 192.168.2.127:5060       SIP/2.0 401 Unauthorized
00007 1552309348 * ==> xx.xx.xx.xx:52755       SIP/2.0 200 OK
00008 1552309348 * <== xx.xx.xx.xx:52755       ACK sip:xx.xx.xx.xx:5061;transport=TLS SIP/2.0
00009 1552309349 * ==> 192.168.2.116:52755      BYE sip:140@192.168.2.116:52755;transport=tls SIP/2.0
00010 1552309355 * <== xx.xx.xx.xx:52755       BYE sip:xx.xx.xx.xx:5061;transport=TLS SIP/2.0
00011 1552309355 * ==> xx.xx.xx.xx:52755       SIP/2.0 481 Call/Transaction Does Not Exist

PJSIP History when called from 105 which is UDP and Local ip

 Setting global variable 'SIPDOMAIN' to '192.168.2.18'
  == Using SIP RTP Audio TOS bits 184
  == Using SIP RTP Audio TOS bits 184 in TCLASS field.
    -- Executing [908@default:1] NoOp("PJSIP/105-0000000d", "Testing calls to speakers. Dialing 908 from ") in new stack
    -- Executing [908@default:2] Set("PJSIP/105-0000000d", "number=08") in new stack
    -- Executing [908@default:3] System("PJSIP/105-0000000d", "/usr/lib/sss/radio08.sh") in new stack
    -- Executing [908@default:4] NoOp("PJSIP/105-0000000d", "pre sip900 script  - SUCCESS") in new stack
    -- Executing [908@default:5] Playback("PJSIP/105-0000000d", "activated") in new stack
       > 0x1f78330 -- Strict RTP learning after remote address set to: 192.168.2.116:48436
       > 0x1f78330 -- Strict RTP switching to RTP target address 192.168.2.116:48436 as source
    -- <PJSIP/105-0000000d> Playing 'activated.gsm' (language 'en')
    -- Executing [908@default:6] NoOp("PJSIP/105-0000000d", "pre sip900 script  - SUCCESS") in new stack
    -- Executing [908@default:7] Hangup("PJSIP/105-0000000d", "") in new stack
  == Spawn extension (default, 908, 7) exited non-zero on 'PJSIP/105-0000000d'

Here is the sip history


  Timestamp  (Dir) Address                  SIP Message                        
===== ========== ============================== ===================================
00000 1552309347 * <== xx.xx.xx.xx:52755       INVITE sip:908@xx.xx.xx.xx:5061 SIP/2.0
00001 1552309347 * ==> xx.xx.xx.xx:52755       SIP/2.0 401 Unauthorized
00002 1552309347 * <== xx.xx.xx.xx:52755       ACK sip:908@xx.xx.xx.xx:5061 SIP/2.0
00003 1552309347 * <== xx.xx.xx.xx:52755       INVITE sip:908@xx.xx.xx.xx:5061 SIP/2.0
00004 1552309347 * ==> xx.xx.xx.xx:52755       SIP/2.0 100 Trying
00005 1552309347 * <== 192.168.2.127:5060       REGISTER sip:192.168.2.18 SIP/2.0
00006 1552309347 * ==> 192.168.2.127:5060       SIP/2.0 401 Unauthorized
00007 1552309348 * ==> xx.xx.xx.xx:52755       SIP/2.0 200 OK
00008 1552309348 * <== xx.xx.xx.xx:52755       ACK sip:xx.xx.xx.xx:5061;transport=TLS SIP/2.0
00009 1552309349 * ==> 192.168.2.116:52755      BYE sip:140@192.168.2.116:52755;transport=tls SIP/2.0
00010 1552309355 * <== xx.xx.xx.xx:52755       BYE sip:xx.xx.xx.xx:5061;transport=TLS SIP/2.0
00011 1552309355 * ==> xx.xx.xx.xx:52755       SIP/2.0 481 Call/Transaction Does Not Exist
00012 1552309539 * <== 192.168.2.116:17185      INVITE sip:908@192.168.2.18 SIP/2.0
00013 1552309539 * ==> 192.168.2.116:17185      SIP/2.0 401 Unauthorized
00014 1552309539 * <== 192.168.2.116:17185      ACK sip:908@192.168.2.18 SIP/2.0
00015 1552309539 * <== 192.168.2.116:17185      INVITE sip:908@192.168.2.18 SIP/2.0
00016 1552309539 * ==> 192.168.2.116:17185      SIP/2.0 100 Trying
00017 1552309540 * ==> 192.168.2.116:17185      SIP/2.0 200 OK
00018 1552309540 * <== 192.168.2.116:17185      ACK sip:192.168.2.18:5060 SIP/2.0
00019 1552309542 * ==> 192.168.2.116:17185      BYE sip:105@192.168.2.116:17185 SIP/2.0
00020 1552309542 * <== 192.168.2.116:17185      SIP/2.0 200 OK

Unless xx.xx.xx.xx is 192.168.2.116, I think you have your NAT configuration messed up. However, I would really want the actual protocol log and an explanation of which device was represented by each IP address or distinct redaction of one.

xx.xx.xx.xx is not 192.168.2.116

How can I get that?

xx.xx.xx.xx is the public ip
192.168.2.116 is the softphone when in the same LAN the softphone still is using public ip of the asterisk as domain for asterisk server

extension 908 is only defined in the dial plan and will run some scripts and end up the call

below is the tls transport settings

[transport-tls]    
type=transport
protocol=tls
bind=0.0.0.0:5061
cert_file=/etc/asterisk/keys/asterisk.crt
priv_key_file=/etc/asterisk/keys/asterisk.key
method=tlsv1
local_net=192.168.1.0/24
local_net=127.0.0.1/24
external_media_address=xx.xx.xx.xx
external_signaling_address=xx.xx.xx.xx
external_signaling_port=5061
;tos = cs3

below is the endpoint


[140]
type = aor
max_contacts = 20 
qualify_frequency = 60
maximum_expiration = 3600
minimum_expiration = 60
default_expiration = 120
remove_existing = yes
rewrite_contact=yes

[140]
type = auth
username = 140
password = xxxxxx

[140]
type = endpoint
dtmf_mode = rfc4733
allow = all
rtp_timeout = 30
timers = yes
direct_media = no
callerid = 140 <Mobile Exten 140>
send_pai = yes
auth = 140
outbound_auth = 140
aors = 140
dtmf_mode=rfc4733
media_encryption=sdes
transport = transport-tls
rtp_symmetric=yes
force_rport=yes

https://wiki.asterisk.org/wiki/display/AST/Collecting+Debug+Information#CollectingDebugInformation-Enablechanneltechorfeaturespecificdebug

Here is the log when 140 dial 908 … 140 doesn’t know that the call has ended at the end

<--- Received SIP response (487 bytes) from UDP:192.168.2.116:17185 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.2.18:5060;rport=5060;branch=z9hG4bKPj2a016184-b0c3-4612-ae9c-add4b076376a
From: <sip:105@192.168.2.18>;tag=802c8651-6cd8-4c04-93f8-079b57850c9a
To: <sip:105@192.168.2.116>;tag=245757945
Call-ID: b162bc48-4907-4916-ae1a-5bb573938909
CSeq: 32498 OPTIONS
Supported: replaces, path, eventlist
User-Agent: Grandstream Wave 1.0.3.26
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0


<--- Received SIP request (1402 bytes) from TLS:xx.xx.xx.xx:52755 --->
INVITE sip:908@xx.xx.xx.xx:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.2.116:52755;branch=z9hG4bK1912908751;rport;alias
From: <sip:140@xx.xx.xx.xx:5061>;tag=1218393820
To: <sip:908@xx.xx.xx.xx:5061>
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
CSeq: 50 INVITE
Contact: <sip:140@192.168.2.116:52755;transport=tls>
Max-Forwards: 70
User-Agent: Grandstream Wave 1.0.3.26
Privacy: none
P-Preferred-Identity: <sip:140@xx.xx.xx.xx:5061>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length:   724

v=0
o=140 8000 8000 IN IP4 192.168.2.116
s=SIP Call
c=IN IP4 192.168.2.116
t=0 0
m=audio 24464 RTP/SAVP 0 8 18 101
a=sendrecv
a=rtcp:24465 IN IP4 192.168.2.116
a=rtpmap:0 PCMU/8000
a=ptime:20
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/80<--- Transmitting SIP response (481 bytes) to TLS:xx.xx.xx.xx:52755 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TLS 192.168.2.116:52755;rport=52755;received=xx.xx.xx.xx;branch=z9hG4bK1912908751;alias
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>;tag=z9hG4bK1912908751
CSeq: 50 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1552313769/a53df83f3dc26585895c3e002335b05b",opaque="2c75a33e0c3983a0",algorithm=md5,qop="auth"
Server: Asterisk PBX 15.7.0
Content-Length:  0


<--- Received SIP request (287 bytes) from TLS:xx.xx.xx.xx:52755 --->
ACK sip:908@xx.xx.xx.xx:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.2.116:52755;branch=z9hG4bK1912908751;rport;alias
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>;tag=z9hG4bK1912908751
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
CSeq: 50 ACK
Content-Length: 0


<--- Received SIP request (1673 bytes) from TLS:xx.xx.xx.xx:52755 --->
INVITE sip:908@xx.xx.xx.xx:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.2.116:52755;branch=z9hG4bK1147457592;rport;alias
From: <sip:140@xx.xx.xx.xx:5061>;tag=1218393820
To: <sip:908@xx.xx.xx.xx:5061>
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
CSeq: 51 INVITE
Contact: <sip:140@192.168.2.116:52755;transport=tls>
Authorization: Digest username="140", realm="asterisk", nonce="1552313769/a53df83f3dc26585895c3e002335b05b", uri="sip:908@xx.xx.xx.xx:5061", response="aad897e26fd99760cdcd17cd50943b8f", algorithm=md5, cnonce="08197074", opaque="2c75a33e0c3983a0", qop=auth, nc=00000002
Max-Forwards: 70
User-Agent: Grandstream Wave 1.0.3.26
Privacy: none
P-Preferred-Identity: <sip:140@xx.xx.xx.xx:5061>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-L  == Setting global variable 'SIPDOMAIN' to 'xx.xx.xx.xx'
<--- Transmitting SIP response (307 bytes) to TLS:xx.xx.xx.xx:52755 --->
SIP/2.0 100 Trying
Via: SIP/2.0/TLS 192.168.2.116:52755;rport=52755;received=xx.xx.xx.xx;branch=z9hG4bK1147457592;alias
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>
CSeq: 51 INVITE
Server: Asterisk PBX 15.7.0
Content-Length:  0


    -- Executing [908@default:1] NoOp("PJSIP/140-0000000e", "Testing calls to speakers. Dialing 908 from ") in new stack
    -- Executing [908@default:2] Set("PJSIP/140-0000000e", "number=08") in new stack
    -- Executing [908@default:3] System("PJSIP/140-0000000e", "/usr/lib/shaula720/radio08.sh") in new stack
    -- Executing [908@default:4] NoOp("PJSIP/140-0000000e", "pre sip900 script  - SUCCESS") in new stack
    -- Executing [908@default:5] Playback("PJSIP/140-0000000e", "activated") in new stack
       > 0x1f78330 -- Strict RTP learning after remote address set to: 192.168.2.116:24464
<--- Transmitting SIP response (990 bytes) to TLS:xx.xx.xx.xx:52755 --->
SIP/2.0 200 OK
Via: SIP/2.0/TLS 192.168.2.116:52755;rport=52755;received=xx.xx.xx.xx;branch=z9hG4bK1147457592;alias
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>;tag=7871b75d-b026-4505-b587-345d291ed866
CSeq: 51 INVITE
Server: Asterisk PBX 15.7.0
Contact: <sip:xx.xx.xx.xx:5061;transport=TLS>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub
Content-Type: application/sdp
Content-Length:   405

v=0
o=- 8000 8002 IN IP4 xx.xx.xx.xx
s=Asterisk
c=IN IP4 xx.xx.xx.xx
t=0 0
m=audio 38748 RTP/SAVP 0 8 18 101
a=crypto:1 AES_CM_256_HMAC_SHA1_80 inline:8DB+ZpLESqn+2NBOFe0hG08/Q9NTUZYGgsmT17Rx/xOj1ohyy0uurrwckiF9fg==
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-ev<--- Received SIP request (557 bytes) from TLS:xx.xx.xx.xx:52755 --->
ACK sip:xx.xx.xx.xx:5061;transport=TLS SIP/2.0
Via: SIP/2.0/TLS 192.168.2.116:52755;branch=z9hG4bK2073761025;rport
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>;tag=7871b75d-b026-4505-b587-345d291ed866
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
CSeq: 51 ACK
Contact: <sip:140@192.168.2.116:52755;transport=tls>
Max-Forwards: 70
Supported: replaces, path, timer, eventlist
User-Agent: Grandstream Wave 1.0.3.26
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0


       > 0x1f78330 -- Strict RTP qualifying stream type: audio
       > 0x1f78330 -- Strict RTP switching source address to xx.xx.xx.xx:24464
    -- <PJSIP/140-0000000e> Playing 'activated.gsm' (language 'en')
    -- Executing [908@default:6] NoOp("PJSIP/140-0000000e", "pre sip900 script  - SUCCESS") in new stack
    -- Executing [908@default:7] Hangup("PJSIP/140-0000000e", "") in new stack
  == Spawn extension (default, 908, 7) exited non-zero on 'PJSIP/140-0000000e'
<--- Transmitting SIP request (427 bytes) to TLS:192.168.2.116:52755 --->
BYE sip:140@192.168.2.116:52755;transport=tls SIP/2.0
Via: SIP/2.0/TLS 192.168.2.18:5061;rport;branch=z9hG4bKPj68269b0d-1143-435b-b4d9-8a9b6ab070ca;alias
From: <sip:908@xx.xx.xx.xx>;tag=7871b75d-b026-4505-b587-345d291ed866
To: <sip:140@xx.xx.xx.xx>;tag=1218393820
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
CSeq: 10195 BYE
Reason: Q.850;cause=16
Max-Forwards: 70
User-Agent: Asterisk PBX 15.7.0
Content-Length:  0


<--- Transmitting SIP request (453 bytes) to TLS:192.168.2.116:52755 --->
OPTIONS sip:140@192.168.2.116:52755;transport=tls SIP/2.0
Via: SIP/2.0/TLS 192.168.2.18:5061;rport;branch=z9hG4bKPj6b1692b0-7544-43fe-974b-ccaaefeea83d;alias
From: <sip:140@192.168.2.18>;tag=01255bec-913a-449e-8f07-93b4a0aa094d
To: <sip:140@192.168.2.116>
Contact: <sip:140@192.168.2.18:5061;transport=TLS>
Call-ID: ce6c6c66-d066-4028-957d-48026e89587c
CSeq: 14542 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 15.7.0
Content-Length:  0


<--- Transmitting SIP request (453 bytes) to TLS:192.168.2.124:39066 --->
OPTIONS sip:140@192.168.2.124:39066;transport=tls SIP/2.0
Via: SIP/2.0/TLS 192.168.2.18:5061;rport;branch=z9hG4bKPjdbedc8e5-beba-4f00-b7d3-13eadf7788d9;alias
From: <sip:140@192.168.2.18>;tag=d599a61d-f4e6-4424-b639-e72a88d71c6e
To: <sip:140@192.168.2.124>
Contact: <sip:140@192.168.2.18:5061;transport=TLS>
Call-ID: def37bbc-6d14-4e71-8743-ca4dc750e479
CSeq: 27674 OPTIONS
Max-Forwards: 70
User-Agent: Asterisk PBX 15.7.0
Content-Length:  0


<--- Received SIP request (557 bytes) from TLS:xx.xx.xx.xx:52755 --->
BYE sip:xx.xx.xx.xx:5061;transport=TLS SIP/2.0
Via: SIP/2.0/TLS 192.168.2.116:52755;branch=z9hG4bK1070452593;rport
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>;tag=7871b75d-b026-4505-b587-345d291ed866
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
CSeq: 52 BYE
Contact: <sip:140@192.168.2.116:52755;transport=tls>
Max-Forwards: 70
Supported: replaces, path, timer, eventlist
User-Agent: Grandstream Wave 1.0.3.26
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Length: 0


<--- Transmitting SIP response (364 bytes) to TLS:xx.xx.xx.xx:52755 --->
SIP/2.0 481 Call/Transaction Does Not Exist
Via: SIP/2.0/TLS 192.168.2.116:52755;rport=52755;received=xx.xx.xx.xx;branch=z9hG4bK1070452593
Call-ID: 1587509263-34595-6@BJC.BGI.C.BBG
From: <sip:140@xx.xx.xx.xx>;tag=1218393820
To: <sip:908@xx.xx.xx.xx>;tag=7871b75d-b026-4505-b587-345d291ed866
CSeq: 52 BYE
Server: Asterisk PBX 15.7.0
Content-Length:  0


This is wrong in the request.

The BYE is, reasonably correctly, being sent to that address, when the original connection was on a public address.

Does that address actually access the phone, as seen from Asterisk, as it feels like you are accessing some other device, which just happens to share the same, private, address.

1 Like

192.168.2.116 is the IP address of the smartphone. This is the local_net of the asterisk, as well as aterisk, is on 192.168.2.18.

Scenario is that in the softphone sip server field I have used the public IP address. But my smartphone is on the same 192.168.2.0/24 on which the asterisk is, via wifi.

That is a bad configuration, but the phone shouldn’t care about the request URI once the BYE reaches it, so some blame lies with the phone.

I would advise configuring as pure private network, or pure NATted network, to avoid confusion.

Can you suggest me changes to the configuration please!

It is the configuration of the phone that needs to change.

1 Like