[asterisk-dev] Losing SIP TLS connection on spurious INVITE

Bruce Atherton bruce at callenish.com
Fri Aug 22 14:19:52 CDT 2008


I have an application that speaks SIP, and I am trying to certify that 
it works correctly with Asterisk 1.6 beta 9.

In setting up a TLS connection, I send an invite and get an OK back. If 
the dialplan only has an Answer(), then all is good. But if I try to 
Dial() an extension, with or without Answer()ing first, I get an INVITE 
back to the application from * for some reason. This INVITE is not on 
port 5061, but on port 5060. This happens whether the extension being 
dialed is set up for TLS or not.

As a result, a new dialog is created in my application. When the 
application attempts to say BYE using TLS on port 5060, it of course 
never gets anything back from *, and the original dialog is left hanging 
about.

What is going on here? Why is there a new INVITE being sent to my 
application? If it is supposed to be there, why is it not on port 5061?

Here is the SIP debug log from Asterisk. 192.168.168.83 is the * box, 
and 192.168.168.228 is where my application is running. The * box is the 
SIP proxy for both my application and the extension being called, and 
both are registered with it. Note the last SIP message, where the INVITE 
is "Via: SIP/2.0/TLS 192.168.168.83:5060".

SIP Debugging Enabled for IP: 192.168.168.228:17000
qa-ast-002*CLI>
<--- Transmitting (no NAT) to 192.168.168.228:17000 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TLS
192.168.168.228:17000;branch=z9hG4bK58efbfc7e53a487d9f9ca95ef8f127c3;received=192.168.168.228;rport=28338
From: "Yan Wang" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=b1ea59e5
To: "Yan Wang" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=as468c4644
Call-ID: 38a97b4f87c4efbccb99b9b5f51287c0 at 192.168.168.228
CSeq: 348962 REGISTER
User-Agent: Asterisk PBX 1.6.0-beta9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="219682e7"
Content-Length: 0


<------------>
 Scheduling destruction of SIP dialog
'38a97b4f87c4efbccb99b9b5f51287c0 at 192.168.168.228' in 32000 ms
(Method: REGISTER)
 Sending to 192.168.168.228 : 17000 (no NAT)
qa-ast-002*CLI>
<--- Transmitting (no NAT) to 192.168.168.228:17000 --->
SIP/2.0 200 OK
Via: SIP/2.0/TLS
192.168.168.228:17000;branch=z9hG4bKdbada6caba292dd8ee4c86a18a747e03;received=192.168.168.228
From: "Yan Wang" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=b1ea59e5
To: "Yan Wang" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=as468c4644
Call-ID: 38a97b4f87c4efbccb99b9b5f51287c0 at 192.168.168.228
CSeq: 348963 REGISTER
User-Agent: Asterisk PBX 1.6.0-beta9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
Expires: 3600
Contact: <sip:441 at 192.168.168.228:17000;transport=tls>;expires=3600
Date: Thu, 21 Aug 2008 19:31:43 GMT
Content-Length: 0


<------------>
 Scheduling destruction of SIP dialog
'38a97b4f87c4efbccb99b9b5f51287c0 at 192.168.168.228' in 32000 ms
(Method: REGISTER)
qa-ast-002*CLI>
<--- Reliably Transmitting (no NAT) to 192.168.168.228:17000 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TLS
192.168.168.228:17000;branch=z9hG4bK430fce8bde8baffb79de618198e8498b;received=192.168.168.228;rport=28338
From: "Default Company" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=764913a6
To: <sip:402 at 192.168.168.83:5061;transport=tls>;tag=as31a3c11e
Call-ID: bd836115a9150fbd2288326855141036 at 192.168.168.228
CSeq: 348964 INVITE
User-Agent: Asterisk PBX 1.6.0-beta9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="asterisk", nonce="7961fb67"
Content-Length: 0


<------------>
 Scheduling destruction of SIP dialog
'bd836115a9150fbd2288326855141036 at 192.168.168.228' in 32000 ms
(Method: INVITE)
 Sending to 192.168.168.228 : 17000 (no NAT)
 Using INVITE request as basis request -
bd836115a9150fbd2288326855141036 at 192.168.168.228
 Found RTP audio format 0
 Found RTP audio format 101
 Peer audio RTP is at port 192.168.168.228:1025
 Found audio description format pcmu for ID 0
 Found audio description format telephone-event for ID 101
 Capabilities: us - 0xe (gsm|ulaw|alaw), peer - audio=0x4
(ulaw)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x4 (ulaw)
 Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1
(telephone-event), combined - 0x1 (telephone-event)
 Peer audio RTP is at port 192.168.168.228:1025
 Looking for 402 in from-sip (domain 192.168.168.83)
 list_route: hop: <sip:441 at 192.168.168.228:17000?transport=TLS>
qa-ast-002*CLI>
<--- Transmitting (no NAT) to 192.168.168.228:17000 --->
SIP/2.0 100 Trying
Via: SIP/2.0/TLS
192.168.168.228:17000;branch=z9hG4bK87309198af81105de328ea2d3ebbfd3d;received=192.168.168.228
From: "Default Company" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=764913a6
To: <sip:402 at 192.168.168.83:5061;transport=tls>
Call-ID: bd836115a9150fbd2288326855141036 at 192.168.168.228
CSeq: 348965 INVITE
User-Agent: Asterisk PBX 1.6.0-beta9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
Contact: <sip:402 at 192.168.168.83:5061;transport=TLS>
Content-Length: 0


<------------>
 Audio is at 192.168.168.83 port 13736
 Adding codec 0x4 (ulaw) to SDP
 Adding non-codec 0x1 (telephone-event) to SDP
qa-ast-002*CLI>
<--- Reliably Transmitting (no NAT) to 192.168.168.228:17000 --->
SIP/2.0 200 OK
Via: SIP/2.0/TLS
192.168.168.228:17000;branch=z9hG4bK87309198af81105de328ea2d3ebbfd3d;received=192.168.168.228
From: "Default Company" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=764913a6
To: <sip:402 at 192.168.168.83:5061;transport=tls>;tag=as274d577d
Call-ID: bd836115a9150fbd2288326855141036 at 192.168.168.228
CSeq: 348965 INVITE
User-Agent: Asterisk PBX 1.6.0-beta9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
Contact: <sip:402 at 192.168.168.83:5061;transport=TLS>
Content-Type: application/sdp
Content-Length: 271

v=0
o=root 1283334743 1283334743 IN IP4 192.168.168.83
s=Asterisk PBX 1.6.0-beta9
c=IN IP4 192.168.168.83
t=0 0
m=audio 13736 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv

<------------>
 set_destination: Parsing
<sip:441 at 192.168.168.228:17000?transport=TLS> for address/port to send
to
 set_destination: set destination to 192.168.168.228, port 17000
 Audio is at 192.168.168.83 port 13736
 Adding codec 0x4 (ulaw) to SDP
 Adding non-codec 0x1 (telephone-event) to SDP
 Reliably Transmitting (no NAT) to 192.168.168.228:17000:
INVITE sip:441 at 192.168.168.228:17000?transport=TLS SIP/2.0
Via: SIP/2.0/TLS 192.168.168.83:5060;branch=z9hG4bK7326e8e2;rport
Max-Forwards: 70
From: <sip:402 at 192.168.168.83:5061;transport=tls>;tag=as274d577d
To: "Default Company" <sip:441 at 192.168.168.83:5061;transport=tls>;tag=764913a6
Contact: <sip:402 at 192.168.168.83:5061;transport=TLS>
Call-ID: bd836115a9150fbd2288326855141036 at 192.168.168.228
CSeq: 102 INVITE
User-Agent: Asterisk PBX 1.6.0-beta9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
Supported: replaces, timer
X-asterisk-Info: SIP re-invite (External RTP bridge)
Content-Type: application/sdp
Content-Length: 271

v=0
o=root 1283334743 1283334744 IN IP4 192.168.168.83
s=Asterisk PBX 1.6.0-beta9
c=IN IP4 192.168.168.83
t=0 0
m=audio 13736 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv


---







More information about the asterisk-dev mailing list