[Home]

Summary:ASTERISK-19502: Wrong port specified on SIP INVITE response when using custom TCP port
Reporter:Seth Miller (smiller)Labels:
Date Opened:2012-03-08 09:17:17.000-0600Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Channels/chan_sip/TCP-TLS
Versions:10.1.2 13.18.4 Frequency of
Occurrence
Related
Issues:
Environment:Ubuntu Server 11.10Attachments:
Description:After specifying a custom SIP port in sip.conf:

udpbindaddr=0.0.0.0:8925
tcpbindaddr=0.0.0.0:8925


operation using UDP transport is normal, but when using TCP transport Asterisk specifies the wrong port in the INVITE message, as follows:


Using UDP (correct response):


Received:
192.168.0.62:4033 <- 125.137.61.10:8925
[pbx.testserver.com/125.137.61.10:8925; 125.137.61.10:8925]
830
SIP/2.0 200 OK
Via: SIP/2.0/UDP
192.168.0.62:4033;branch=z9hG4bKrEBGe2DJePrhhWsR;received=97.23.74.126;rport=4033
From: "Tom" <sip:460@pbx.testserver.com:8925>;tag=F03BD320754F86C854C1EAF1DFC3AED2
To: <sip:256@pbx.testserver.com:8925>;tag=as0818278a
Call-ID: 9590211AA57086D6A948F00DC2B9623F57E9A3DC
CSeq: 2 INVITE
Server: Asterisk PBX 10.1.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:256@125.137.61.10:8925>
Content-Type: application/sdp
Content-Length: 282



Using TCP (incorrect response):


Received:
192.168.0.62:65009 <- pbx.testserver.com/125.137.61.10:8925
[pbx.testserver.com/125.137.61.10:8925; 125.137.61.10:8925]
836
SIP/2.0 200 OK
Via: SIP/2.0/TCP
192.168.0.62:65009;branch=z9hG4bKFuTKuZb8AsoRhbyA;received=97.23.74.126;rport=65009
From: "Tom" <sip:460@pbx.testserver.com>;tag=2C9624E0B9A7E5283CA5E362CC7BC594
To: <sip:256@pbx.testserver.com>;tag=as5fbd3f8f
Call-ID: D37F16A22EF49A91B5D828313631B6818310CE89
CSeq: 2 INVITE
Server: Asterisk PBX 10.1.2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO, PUBLISH
Supported: replaces, timer
Contact: <sip:256@125.137.61.10:5060;transport=TCP>  
Content-Type: application/sdp
Content-Length: 280


Note that in the line 'Contact: <sip:256@125.137.61.10:5060;transport=TCP>' the wrong port is specified (5060 instead of 8925).
Comments:By: Matt Jordan (mjordan) 2012-04-02 12:09:24.674-0500

Do you also have bindaddr enabled?  If so, Asterisk will also be listening for inbound TCP requests on port 5060.

What port did the inbound INVITE connect to?

By: Seth Miller (smiller) 2012-04-02 12:33:17.897-0500


>Do you also have bindaddr enabled?

No, I do not have a separate bindaddr entry. The only associated commands in sip.conf are:

udpbindaddr=0.0.0.0:8925
tcpbindaddr=0.0.0.0:8925
tcpenable=yes
transport=udp,tcp


>If so, Asterisk will also be listening for inbound TCP requests on port 5060.

That is not what is desired. By setting an alternate port I am indicating that I want to avoid listening on 5060.


>What port did the inbound INVITE connect to?

It connected to 8925. The problem seems to be when Asterisk responds with:

Contact: <sip:256@125.137.61.10:5060;transport=TCP>

This causes subsequent communications (such as BYE) to be sent to port 5060 instead of 8925, and Asterisk does not respond (the channel stays up indefinitely.) Note that is occurs only when using TCP transport, when using UDP the response is correct:

Contact: <sip:256@125.137.61.10:8925>

Why would there be a difference?


By: Matt Jordan (mjordan) 2012-04-02 12:37:07.252-0500

So, when I stated "If so, Asterisk will also be listening for inbound TCP requests on port 5060." - that only applies if you also use bindaddr.  Since you aren't, then that doesn't apply.

As for why there's a difference: the contact header is constructed slightly differently depending on the transport (as you can see, given the transport= tag).

By: Jacek (jacek) 2012-05-09 13:44:03.539-0500

Check if you can use externtcpport=8925 as a workaround (https://reviewboard.asterisk.org/r/392/).

By: Seth Miller (smiller) 2012-05-09 14:20:39.064-0500

Yes, that seems to be effective. Calls using TCP transport seem to terminate properly when 'externtcpport=8925' is used.