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