[asterisk-bugs] [Asterisk 0016351]: Asterisk 1.6.1 won't "answer" the phone when using a callcentric sip trunk

Asterisk Bug Tracker noreply at bugs.digium.com
Sat Nov 6 13:11:34 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=16351 
====================================================================== 
Reported By:                cattelan
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   16351
Category:                   Channels/chan_sip/Interoperability
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     acknowledged
Asterisk Version:           SVN 
JIRA:                       SWP-1301 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Request Review:              
====================================================================== 
Date Submitted:             2009-11-30 11:16 CST
Last Modified:              2010-11-06 13:11 CDT
====================================================================== 
Summary:                    Asterisk 1.6.1 won't "answer" the phone when using a
callcentric sip trunk
Description: 
I have been trying for a while to upgrade my system from a 1.4 based
asterisk to a 1.6 asterisk, but have never been able to get it to function
correctly with my sip provider (calcentric)

I finally sat down and did some comparisons of the sip debug info and I
think I have found an issue. 

callcentric wants to use port 5080 vs the standard 5060 port.
It appears that 1.4 is correctly sending the sip answer message via port
5080 but 1.6 does not -- it is trying to use port 5060.

Here is the relevant sip debug messages.

asterisk 1.4.22


    -- Executing [s at ivr-2:7] Answer("SIP/66.193.176.35-1ecd0160", "") in
new stack
Audio is at 10.0.0.13 port 12644
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
pbx-barn-old*CLI> 
<--- Reliably Transmitting (no NAT) to 204.11.192.36:5080 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP
204.11.192.36:5080;branch=z9hG4bK-26fd0d9fbdc6e35702ab0c2b568e095a;received=204.11.192.36
From: "Russell Cattelan"
<sip:16128053144 at 66.193.176.35>;tag=3468510726-41122
To: <sip:16514820379 at ss.callcentric.com>;tag=as700a9f61
Call-ID: 13715408-3468510726-41097 at msw1.telengy.net
CSeq: 1 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Contact: <sip:17772080931 at 10.0.0.13>
Content-Type: application/sdp
Content-Length: 258

v=0
o=root 21108 21108 IN IP4 10.0.0.13
s=session
c=IN IP4 10.0.0.13
t=0 0
m=audio 12644 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv


Asterisk 1.6.1 

---
    -- SIP/203-a8007498 answered SIP/66.193.176.35-c0008898
Audio is at 10.0.0.31 port 15980
Adding codec 0x4 (ulaw) to SDP
Adding codec 0x8 (alaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
barn-pbx*CLI> 
<--- Reliably Transmitting (no NAT) to 204.11.192.22:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP
204.11.192.22:5060;branch=z9hG4bK-79eb04ffe8db79dc1c9a1bec67872e62;received=204.11.192.22
From: "Russell Cattelan"
<sip:16128053144 at 66.193.176.35>;tag=3468510938-450305
To: <sip:16514820379 at ss.callcentric.com>;tag=as524972e9
Call-ID: 13715775-3468510938-450277 at msw1.telengy.net
CSeq: 1 INVITE
Server: Asterisk PBX 1.6.1.9
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Require: timer
Session-Expires: -1;refresher=uas
Contact: <sip:17772080931 at 10.0.0.31>
Content-Type: application/sdp
Content-Length: 279

v=0
o=root 233148858 233148858 IN IP4 10.0.0.31
s=Asterisk PBX 1.6.1.9
c=IN IP4 10.0.0.31
t=0 0
m=audio 15980 RTP/AVP 0 8 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv
======================================================================
Relationships       ID      Summary
----------------------------------------------------------------------
related to          0016827 Asterisk does not honor the bindport.
====================================================================== 

---------------------------------------------------------------------- 
 (0128678) cattelan (reporter) - 2010-11-06 13:11
 https://issues.asterisk.org/view.php?id=16351#c128678 
---------------------------------------------------------------------- 
So I finally spent some time and added a bunch of debug prints and I think
I finally
tracked down the issue. I *think* the issue is with the addition of
socket.port.

The code correctly looks up the port number from the dns and populates the
addr.sin_port but
the defaddr and the socket.port is set to the default sip port .

I'm not sure if both the defaddr socket.port should be set to
addr.sin_port but it appears to be working
the that way.


Index: asterisk-1.6.2/channels/chan_sip.c
===================================================================
--- asterisk-1.6.2.orig/channels/chan_sip.c
+++ asterisk-1.6.2/channels/chan_sip.c
@@ -24457,15 +24457,13 @@ static struct sip_peer *build_peer(const
 		}
 	}
 
-	if (!peer->addr.sin_port) {
+	if (!peer->addr.sin_port)
 		peer->addr.sin_port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ?
STANDARD_TLS_PORT : STANDARD_SIP_PORT));
-	}
-	if (!peer->defaddr.sin_port) {
-		peer->defaddr.sin_port = htons(((peer->socket.type & SIP_TRANSPORT_TLS)
? STANDARD_TLS_PORT : STANDARD_SIP_PORT));
-	}
-	if (!peer->socket.port) {
-		peer->socket.port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ?
STANDARD_TLS_PORT : STANDARD_SIP_PORT));
-	}
+	if (!peer->defaddr.sin_port)
+		peer->defaddr.sin_port = peer->addr.sin_port;
+	if (!peer->socket.port)
+		peer->socket.port = peer->addr.sin_port;
+	
 
 	if (!sip_cfg.ignore_regexpire && peer->host_dynamic && realtime) {
 		time_t nowtime = time(NULL); 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-11-06 13:11 cattelan       Note Added: 0128678                          
======================================================================




More information about the asterisk-bugs mailing list