[SR-Users] Routing PSTN calls from Asterisk through Kamailio to UAC & loose_route

Anthony Messina amessina at messinet.com
Fri Mar 27 23:52:49 CET 2015


Vitaliy, thank you for being a second set of eyes on this.  This issue was my 
fault completely--I had neglected to remove the "fromdomain" parameter on the  
Asterisk side when I was testing something else, so the calls coming from 
Asterisk were of course appearing to come from "example.com" which internally 
resolves to 10.1.1.1, the same address as Kamailio, but without the port.

Thanks again.  -A

On Thursday, March 26, 2015 05:55:16 PM Vitaliy Aleksandrov wrote:
> According to your description BYE was sent using the information from R-URI
> which had no 5080 port. Asterisk should have added port 5080 to the
> outgoing Invite contact so that it could be used for in-dialog routing.
> 
> Can you show a full trace with sip traffic between kamailio and asterisk. To
> catch sip traffic on all interfaces use "-i any" option for tcpdump or "-d
> any" for ngrep.
> 
> I've been working on integration of Asterisk and Kamailio, currently on the
> same host with different ports, and have come across a problem with calls
> that originate from the Asterisk side (PSTN/DAHDI) and route through
> Kamailio to a SIP UAC.  In short, when the SIP UAC (10.1.1.9) sends the
> BYE, loose_route() is returning -1 and the BYE is routed back to Kamailio
> (10.1.1.1:5060) instead of Asterisk (10.1.1.1:5080).  I am using the stock
> WITHINDLG route configuration.
> 
> RR module settings are as follows:
> modparam("rr", "enable_full_lr", 1)
> modparam("rr", "append_fromtag", 1)
> 
> The BYE from the SIP UAC contains the following Route header which only
> contains the contents of Kamailio's Record-Route header.  I have attached
> the full sip trace for review as well.
> 
> Route:
> <sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes>.
> 
> What would be the best method to resolve this issue in either Asterisk or
> Kamailio?  Should I manually add a Record-Route header for the Asterisk
> host:port to Kamailio config? Is there something to be done in Asterisk?
> 
> Thanks.  -A

-- 
Anthony - https://messinet.com/ - https://messinet.com/~amessina/gallery
8F89 5E72 8DF0 BCF0 10BE 9967 92DC 35DC B001 4A4E
-------------- next part --------------
INVITE sip:sipuac1 at 10.1.1.9:5060;transport=udp SIP/2.0.
Record-Route: <sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes>.
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK6f4d.055e1daca77b51d0ceb990515cc44e56.0.
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;rport=5080;branch=z9hG4bKPj522c1fb9-73b7-4ebb-bf20-44a92ddd13ed.
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
To: <sip:2200 at example.com>.
Contact: <sip:9f7900bd-ef13-477c-a490-2e293b886505 at example.com>.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 2657 INVITE.
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE.
Supported: 100rel, timer, replaces, norefersub.
Session-Expires: 1800.
Min-SE: 90.
Alert-Info: info=<Bellcore-dr2>.
Max-Forwards: 69.
User-Agent: Asterisk PBX 13.2.0.
Content-Type: application/sdp.
Content-Length:   319.
Route: <sip:10.1.1.1:5080>.
.
v=0.
o=- 1141388262 1141388262 IN IP4 10.1.1.1.
s=Asterisk.
c=IN IP4 10.1.1.1.
t=0 0.
m=audio 30520 RTP/AVP 9 0 3 97 101.
a=rtpmap:9 G722/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:3 GSM/8000.
a=rtpmap:97 iLBC/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.
a=maxptime:30.
a=sendrecv.                                                                                                                                                                                                                                  
a=rtcp:30521.                                                                                                                                                                                                                                
                                                                                                                                                                                                                                             
#                                                                                                                                                                                                                                            
U 2015/03/25 17:42:39.882274 10.1.1.9:5060 -> 10.1.1.1:5060                                                                                                                                                                            
SIP/2.0 100 Trying.                                                                                                                                                                                                                          
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.                                                                                                                                                                                               
CSeq: 2657 INVITE.                                                                                                                                                                                                                           
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.                                                                                                                                              
To: <sip:2200 at example.com>;tag=3617a1de20d55ba.                                                                                                                                                                                             
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK6f4d.055e1daca77b51d0ceb990515cc44e56.0.                                                                                                                                                           
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;branch=z9hG4bKPj522c1fb9-73b7-4ebb-bf20-44a92ddd13ed;rport=5080.                                                                                                                        
Content-Length: 0.                                                                                                                                                                                                                           
User-Agent: Aastra 480i Cordless/1.4.3.1001 Brcm Callctrl/1.5.1.0 MxSF/v3.2.8.45.                                                                                                                                                            
.                                                                                                                                                                                                                                            
                                                                                                                                                                                                                                             
#                                                                                                                                                                                                                                            
U 2015/03/25 17:42:39.911087 10.1.1.9:5060 -> 10.1.1.1:5060                                                                                                                                                                            
SIP/2.0 180 Ringing.                                                                                                                                                                                                                         
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.                                                                                                                                                                                               
CSeq: 2657 INVITE.                                                                                                                                                                                                                           
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.                                                                                                                                              
To: <sip:2200 at example.com>;tag=3617a1de20d55ba.                                                                                                                                                                                             
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK6f4d.055e1daca77b51d0ceb990515cc44e56.0.                                                                                                                                                           
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;branch=z9hG4bKPj522c1fb9-73b7-4ebb-bf20-44a92ddd13ed;rport=5080.                                                                                                                        
Record-Route: <sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes>.                                                                                                                                                      
Content-Length: 0.                                                                                                                                                                                                                           
Call-Info: <sip:example.com>;appearance-index=1.                                                                                                                                                                                            
Allow-Events: talk, hold, conference.                                                                                                                                                                                                        
Contact: sip:sipuac1 at 10.1.1.9:5060.                                                                                                                                                                                                 
User-Agent: Aastra 480i Cordless/1.4.3.1001 Brcm Callctrl/1.5.1.0 MxSF/v3.2.8.45.                                                                                                                                                            
.                                                                                                                                                                                                                                            

#
U 2015/03/25 17:42:50.012951 10.1.1.1:5060 -> 10.1.1.9:5060
....
#
U 2015/03/25 17:42:51.696604 10.1.1.9:5060 -> 10.1.1.1:5060
SIP/2.0 200 OK.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 2657 INVITE.
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
To: <sip:2200 at example.com>;tag=3617a1de20d55ba.
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK6f4d.055e1daca77b51d0ceb990515cc44e56.0.
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;branch=z9hG4bKPj522c1fb9-73b7-4ebb-bf20-44a92ddd13ed;rport=5080.
Record-Route: <sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes>.
Content-Length: 203.
Session-Expires: 1800;refresher=uac.
Require: timer.
Call-Info: <sip:example.com>;appearance-index=1.
Allow-Events: talk,hold,conference.
Allow:NOTIFY,REFER,OPTIONS,INVITE,ACK,CANCEL,BYE,INFO.
Content-Type: application/sdp.
Supported: replaces.
Contact: sip:sipuac1 at 10.1.1.9:5060.
User-Agent: Aastra 480i Cordless/1.4.3.1001 Brcm Callctrl/1.5.1.0 MxSF/v3.2.8.45.
.
v=0.
o=MxSIP 0 1634248351 IN IP4 10.1.1.9.
s=SIP Call.
c=IN IP4 10.1.1.9.
t=0 0.
m=audio 3000 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=ptime:20.

#
U 2015/03/25 17:42:51.700088 10.1.1.1:5060 -> 10.1.1.9:5060
ACK sip:sipuac1 at 10.1.1.9:5060 SIP/2.0.
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK6f4d.f27b2296b5fa7279ff08c135da90b4e4.0.
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;rport=5080;branch=z9hG4bKPj04521f53-6781-40c2-8d20-4a0c767dfd3b.
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
To: <sip:2200 at example.com>;tag=3617a1de20d55ba.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 2657 ACK.
Max-Forwards: 69.
User-Agent: Asterisk PBX 13.2.0.
Content-Length:  0.
.

#
U 2015/03/25 17:43:11.690086 10.1.1.9:5060 -> 10.1.1.1:5060
BYE sip:9f7900bd-ef13-477c-a490-2e293b886505 at example.com SIP/2.0.
Via: SIP/2.0/UDP 10.1.1.9:5060;branch=z9hG4bKfcf67cc54.
Max-Forwards: 70.
Content-Length: 0.
To: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
From: <sip:2200 at example.com>;tag=3617a1de20d55ba.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 440935283 BYE.
Route: <sip:10.1.1.1;lr=on;ftag=2400d939-de0b-4456-9e01-f9a3302f3e25;nat=yes>.
Supported: timer.
Call-Info: <sip:example.com>;appearance-index=1.
Supported: replaces.
User-Agent: Aastra 480i Cordless/1.4.3.1001 Brcm Callctrl/1.5.1.0 MxSF/v3.2.8.45.
.

#
U 2015/03/25 17:43:11.690728 10.1.1.1:5060 -> 10.1.1.9:5060
SIP/2.0 404 Not Found.
Via: SIP/2.0/UDP 10.1.1.9:5060;rport=5060;branch=z9hG4bKfcf67cc54.
To: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
From: <sip:2200 at example.com>;tag=3617a1de20d55ba.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 440935283 BYE.
Server: Kamailio.
Content-Length: 0.
.

#
U 2015/03/25 17:43:20.015806 10.1.1.1:5060 -> 10.1.1.9:5060
....
#
U 2015/03/25 17:43:26.453279 10.1.1.1:5060 -> 10.1.1.9:5060
BYE sip:sipuac1 at 10.1.1.9:5060 SIP/2.0.
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK405d.f9fa0b6296dde81fdf69545e10f428f0.0.
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;rport=5080;branch=z9hG4bKPjfc3f7cf9-24b0-4e14-bb50-7c112912c211.
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
To: <sip:2200 at example.com>;tag=3617a1de20d55ba.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 2658 BYE.
Reason: Q.850;cause=16.
Max-Forwards: 69.
User-Agent: Asterisk PBX 13.2.0.
Content-Length:  0.
.

#
U 2015/03/25 17:43:26.501109 10.1.1.9:5060 -> 10.1.1.1:5060
SIP/2.0 481 Call Does Not Exist.
Call-ID: 7dc52f67-590e-4482-9065-00bf56512104.
CSeq: 2658 BYE.
From: "UNKNOWN" <sip:3125551212 at example.com>;tag=2400d939-de0b-4456-9e01-f9a3302f3e25.
To: <sip:2200 at example.com>;tag=3617a1de20d55ba.
Via: SIP/2.0/UDP 10.1.1.1;branch=z9hG4bK405d.f9fa0b6296dde81fdf69545e10f428f0.0.
Via: SIP/2.0/UDP 10.1.1.1:5080;received=10.1.1.1;branch=z9hG4bKPjfc3f7cf9-24b0-4e14-bb50-7c112912c211;rport=5080.
Content-Length: 0.
User-Agent: Aastra 480i Cordless/1.4.3.1001 Brcm Callctrl/1.5.1.0 MxSF/v3.2.8.45.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150327/dc684753/attachment.sig>


More information about the sr-users mailing list