Hello,

I have the following setup:

UAC (Bria)  ------ Kamailio -------- Freeswitch

Kamailio is used to authenticate the client using basic authentication.
Upon authentication the INVITE is sent to Freeswitch for further handling.
Kamailio stays in the path using record-route.

At this point, the authentication and calling FS works fine.
For now, FS just answers, plays a file and hangsup the call.
Answering the call and playing a file works fine.
When FS hangs up the call, the BYE message is sent back to Kamailio.

The problem is the BYE message from FS contains a Route header which points to 
Kamailio again.
Which causes Kamailio to send the BYE message back to itself. Kamailio then 
replies with a 404.
The BYE is never sent to the UAC.

When I remove the record_route() for INVITEs, the call works fine, but Kamailio 
isn't kept in the signaling path.
The BYE is sent directly to the UAC.

T 10.0.5.52:54822 -> 10.0.5.50:5060 [AP]
BYE sip:grant@10.0.0.40:5060;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 10.0.5.52;rport;branch=z9hG4bK99X8a4Q8BFy1a.
Route: <sip:10.0.5.50;transport=tcp;lr=on>.
Max-Forwards: 70.
From: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
To: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 73909300 BYE.
User-Agent: CM SBC.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Reason: Q.850;cause=16;text="NORMAL_CLEARING".
Content-Length: 0.

Here is the WITHINDLG route:

route[WITHINDLG] {
                xlog("L_INFO", "[R-ROUTE-WITHINDLG:$ci] !>" 
"Route:WITHINDLG;UnixTime:$TV(un);RequestURI:$rU;RequestMethod:$rm;FromTag:$ft;ToTag:$tt;CallID:$ci;From:$fU;To:$rU\r\n");

                if (!has_totag()) {
                               return;
                }

                # Sequential request within a dialog should take the path 
determined by record-routing
                if (loose_route()) {
                               route(RELAY);
                               exit;
                } else {
                               if (is_method("ACK")) {
                                               if (t_check_trans()) {
                                                               # No 
Loose-Route, but stateful ACK. Must be ACK after 487
                                                               route(RELAY);
                                                               exit;
                                               } else {
                                                               # ACK without 
matching transaction
                                                               exit;
                                               }
                               }
                               sl_send_reply("404","Not here");
                }
                exit;
}

I'm using TCP as the transport.
Kamailio: 4.2.3
Freeswitch: 1.5.15


I've attached a SIP trace from the point of view of Kamailio.
UAC: 10.0.0.40
Kamailio: 10.0.5.50
Freeswitch: 10.0.5.52

What is going on here?
The whole Record-Route thing confuses me a lot.

Regards,

Grant

##
T 10.0.0.40:5061 -> 10.0.5.50:5060 [AP]
INVITE sip:123456789@10.0.0.40;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-1f1d0e30ecbf9d27-1---d8754z-.
Max-Forwards: 70.
Contact: <sip:grant@10.0.0.40:5060;transport=tcp>.
To: <sip:123456789@10.0.0.40>.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO.
Content-Type: application/sdp.
Proxy-Authorization: Digest 
username="XXXXXXXXXXXXXXXXXX",realm="10.0.0.40",nonce="XXXXXXXXXXXXXXXXXXXXXXX",uri="sip:123456789@10.0.0.40;transport=tcp",response="XXXXXXXXXXXXXXXXXXXXXXX",algorithm=MD5.
Supported: replaces.
User-Agent: Bria 4 4.1.1 74246-83cf110a-W6.2.
Content-Length: 209.
.
v=0.
o=- 13072964325806914 1 IN IP4 10.0.0.40.
s=Bria 4 release 4.1.1 stamp 74246.
c=IN IP4 10.0.0.40.
t=0 0.
m=audio 26358 RTP/AVP 0 8 101.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendrecv.

##
T 10.0.5.50:5060 -> 10.0.0.40:5061 [AP]
SIP/2.0 100 trying -- your call is important to us.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-1f1d0e30ecbf9d27-1---d8754z-.
To: <sip:123456789@10.0.0.40>.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 INVITE.
Content-Length: 0.
.

#
T 10.0.5.50:35422 -> 10.0.5.52:5060 [AP]
INVITE sip:123456789@10.0.5.52:5060 SIP/2.0.
Record-Route: <sip:10.0.5.50;transport=tcp;lr=on>.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKa70b.257648f565916f0bcaf1ca44adc4b6a1.0;i=b.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-1f1d0e30ecbf9d27-1---d8754z-.
Max-Forwards: 69.
Contact: <sip:grant@10.0.0.40:5060;transport=tcp>.
To: <sip:123456789@10.0.0.40>.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 INVITE.
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, 
INFO.
Content-Type: application/sdp.
Supported: replaces.
User-Agent: Bria 4 4.1.1 74246-83cf110a-W6.2.
Content-Length: 209.
.
v=0.
o=- 13072964325806914 1 IN IP4 10.0.0.40.
s=Bria 4 release 4.1.1 stamp 74246.
c=IN IP4 10.0.0.40.
t=0 0.
m=audio 26358 RTP/AVP 0 8 101.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=sendrecv.

#
T 10.0.5.52:5060 -> 10.0.5.50:35422 [AP]
SIP/2.0 100 Trying.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKa70b.257648f565916f0bcaf1ca44adc4b6a1.0;i=b;rport=35422.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-1f1d0e30ecbf9d27-1---d8754z-.
Record-Route: <sip:10.0.5.50;transport=tcp;lr=on>.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
To: <sip:123456789@10.0.0.40>.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 INVITE.
User-Agent: CM SBC.
Content-Length: 0.
.

##
T 10.0.5.52:5060 -> 10.0.5.50:35422 [AP]
SIP/2.0 200 OK.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKa70b.257648f565916f0bcaf1ca44adc4b6a1.0;i=b;rport=35422.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-1f1d0e30ecbf9d27-1---d8754z-.
Record-Route: <sip:10.0.5.50;transport=tcp;lr=on>.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 INVITE.
Contact: <sip:123456789@10.0.5.52:5060;transport=tcp>.
User-Agent: CM SBC.
Accept: application/sdp.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Allow-Events: talk, hold, conference, refer.
Content-Type: application/sdp.
Content-Disposition: session.
Content-Length: 220.
Remote-Party-ID: "123456789" 
<sip:123456789@10.0.0.40>;party=calling;privacy=off;screen=no.
.
v=0.
o=FreeSWITCH 1428466128 1428466129 IN IP4 10.0.5.52.
s=FreeSWITCH.
c=IN IP4 10.0.5.52.
t=0 0.
m=audio 24598 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.

##
T 10.0.5.50:5060 -> 10.0.0.40:5061 [AP]
SIP/2.0 200 OK.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-1f1d0e30ecbf9d27-1---d8754z-.
Record-Route: <sip:10.0.5.50;transport=tcp;lr=on>.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 INVITE.
Contact: <sip:123456789@10.0.5.52:5060;transport=tcp>.
User-Agent: CM SBC.
Accept: application/sdp.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Allow-Events: talk, hold, conference, refer.
Content-Type: application/sdp.
Content-Disposition: session.
Content-Length: 220.
Remote-Party-ID: "123456789" 
<sip:123456789@10.0.0.40>;party=calling;privacy=off;screen=no.
.
v=0.
o=FreeSWITCH 1428466128 1428466129 IN IP4 10.0.5.52.
s=FreeSWITCH.
c=IN IP4 10.0.5.52.
t=0 0.
m=audio 24598 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-16.
a=ptime:20.

#
T 10.0.0.40:5061 -> 10.0.5.50:5060 [A]
..,..o
#
T 10.0.0.40:5061 -> 10.0.5.50:5060 [AP]
ACK sip:123456789@10.0.5.52:5060;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-b3052b0ad4ea706c-1---d8754z-.
Max-Forwards: 70.
Route: <sip:10.0.5.50;transport=tcp;lr>.
Contact: <sip:grant@10.0.0.40:5060;transport=tcp>.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 ACK.
User-Agent: Bria 4 4.1.1 74246-83cf110a-W6.2.
Content-Length: 0.
.

#
T 10.0.5.50:35422 -> 10.0.5.52:5060 [AP]
ACK sip:123456789@10.0.5.52:5060;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKa70b.ce0a7804968de7b6ce80a9b935bd786b.0;i=b.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-b3052b0ad4ea706c-1---d8754z-.
Max-Forwards: 69.
Contact: <sip:grant@10.0.0.40:5060;transport=tcp>.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 2 ACK.
User-Agent: Bria 4 4.1.1 74246-83cf110a-W6.2.
Content-Length: 0.
.

###
T 10.0.5.52:54822 -> 10.0.5.50:5060 [AP]
BYE sip:grant@10.0.0.40:5060;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 10.0.5.52;rport;branch=z9hG4bK99X8a4Q8BFy1a.
Route: <sip:10.0.5.50;transport=tcp;lr=on>.
Max-Forwards: 70.
From: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
To: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 73909300 BYE.
User-Agent: CM SBC.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Reason: Q.850;cause=16;text="NORMAL_CLEARING".
Content-Length: 0.
.

#
T 10.0.5.50:52101 -> 10.0.5.50:5060 [AP]
BYE sip:10.0.5.50;transport=tcp;lr=on SIP/2.0.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKe10e.84bbec9db9e727e6e616ae381805868a.0;i=d.
Via: SIP/2.0/TCP 
10.0.5.52;received=10.0.5.52;rport=54822;branch=z9hG4bK99X8a4Q8BFy1a.
Max-Forwards: 69.
From: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
To: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 73909300 BYE.
User-Agent: CM SBC.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Reason: Q.850;cause=16;text="NORMAL_CLEARING".
Content-Length: 0.
.

#
T 10.0.5.50:5060 -> 10.0.5.50:52101 [AP]
SIP/2.0 404 Not here.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKe10e.84bbec9db9e727e6e616ae381805868a.0;i=d.
Via: SIP/2.0/TCP 
10.0.5.52;received=10.0.5.52;rport=54822;branch=z9hG4bK99X8a4Q8BFy1a.
From: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
To: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 73909300 BYE.
Content-Length: 0.
.

##
T 10.0.5.50:5060 -> 10.0.5.52:54822 [AP]
SIP/2.0 404 Not here.
Via: SIP/2.0/TCP 
10.0.5.52;received=10.0.5.52;rport=54822;branch=z9hG4bK99X8a4Q8BFy1a.
From: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
To: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 73909300 BYE.
Content-Length: 0.
.

#


















#
T 10.0.0.40:5061 -> 10.0.5.50:5060 [AP]
BYE sip:123456789@10.0.5.52:5060;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-d0bc3134485a0b0a-1---d8754z-.
Max-Forwards: 70.
Route: <sip:10.0.5.50;transport=tcp;lr>.
Contact: <sip:grant@10.0.0.40:5060;transport=tcp>.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 3 BYE.
Proxy-Authorization: Digest 
username="XXXXXXXXXXXXXXXXXX",realm="10.0.0.40",nonce="XXXXXXXXXXXXXXXXXX",uri="sip:123456789@10.0.5.52:5060;transport=tcp",response="XXXXXXXXXXXXXXXXXX",algorithm=MD5.
User-Agent: Bria 4 4.1.1 74246-83cf110a-W6.2.
Content-Length: 0.
.

##
T 10.0.5.50:35422 -> 10.0.5.52:5060 [AP]
BYE sip:123456789@10.0.5.52:5060;transport=tcp SIP/2.0.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKb70b.472f487c97f20fb9e33f5c37a886718c.0;i=b.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-d0bc3134485a0b0a-1---d8754z-.
Max-Forwards: 69.
Contact: <sip:grant@10.0.0.40:5060;transport=tcp>.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 3 BYE.
Proxy-Authorization: Digest 
username="XXXXXXXXXXXXXXXXXX",realm="10.0.0.40",nonce="XXXXXXXXXXXXXXXXXX",uri="sip:123456789@10.0.5.52:5060;transport=tcp",response="XXXXXXXXXXXXXXXXXX",algorithm=MD5.
User-Agent: Bria 4 4.1.1 74246-83cf110a-W6.2.
Content-Length: 0.
.

##
T 10.0.5.52:5060 -> 10.0.5.50:35422 [AP]
SIP/2.0 481 Call Does Not Exist.
Via: SIP/2.0/TCP 
10.0.5.50;branch=z9hG4bKb70b.472f487c97f20fb9e33f5c37a886718c.0;i=b;rport=35422.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-d0bc3134485a0b0a-1---d8754z-.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 3 BYE.
User-Agent: CM SBC.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Content-Length: 0.
.

#
T 10.0.5.50:5060 -> 10.0.0.40:5061 [AP]
SIP/2.0 481 Call Does Not Exist.
Via: SIP/2.0/TCP 
10.0.0.40:5060;branch=z9hG4bK-d8754z-d0bc3134485a0b0a-1---d8754z-.
From: <sip:grant@10.0.0.40>;tag=dbc9c27b.
To: <sip:123456789@10.0.0.40>;tag=aey7rKe7DmQte.
Call-ID: NmQ4YjYyMDFkNmMwZjg0ZmU5NjQ3ODhjYzU0MDBmNGI.
CSeq: 3 BYE.
User-Agent: CM SBC.
Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, NOTIFY.
Supported: timer, path, replaces.
Content-Length: 0.
.

##
T 10.0.0.40:5061 -> 10.0.5.50:5060 [A]
..l.Q.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to