Config code looks solid to me. Look at the 'c=' in SDP in the forward and reply re-INVITEs. If it gets properly overwritten (same way as it is for the dialog forming INVITE) when rtpengine is engaged, then I believe we are facing some kind of bug in the 4.2 version of Kamailio, something about this thread: https://lists.kamailio.org/pipermail/sr-users/2012-September/074567.html

I can't upgrade Kamailio at the moment to test my theory as it's a production environment, but may be you can?

On Fri, Mar 23, 2018 at 6:17 AM, gerry kernan <gerry.kernan@infinityit.ie> wrote:

Hi

 

I think my issue is related to rtpengine when the call is take off hold. Im using a private address and a public address . below is route section of our Kamailio.cfg and do I have somethimg setup incorrectly for handleing re-invites?

 

 

/usr/sbin/rtpengine --pidfile /var/run/rtpengine.pid --table=-1 --interface=priv/192.X.X.X --interface=pub/212.X.X.X --listen-ng=127.0.0.1:7722 --tos=184 --timeout=60 --log-level=7 --log-facility=local5 --homer-protocol=udp --homer-id=2011

 

 

request_route {

 

        route(SANITY);

 

        force_rport();

 

        # CANCEL processing

        if (is_method("CANCEL")) {

                if (t_check_trans()) {

                        route(RELAY);

                }

                exit;

        }

 

        # handle retransmissions

        if (!is_method("ACK")) {

                if(t_precheck_trans()) {

                        t_check_trans();

                        exit;

                }

                t_check_trans();

        }

 

        # handle requests within SIP dialogs

        route(WITHINDLG);

 

        ### only initial requests (no To tag)

 

        # record routing for dialog forming requests (in case they are routed)

        if (is_method("INVITE|SUBSCRIBE")) {

                record_route();

        }

 

        if (af==INET) {

                route(SIPIPV4);

        } else {

                route(SIPIPV6);

        }

}

 

# Stateful fowarding

route[RELAY] {

        if (!t_relay()) {

                sl_reply_error();

        }

        exit;

}

 

# Handle requests within SIP dialogs

route[WITHINDLG] {

        if (!has_totag()) return;

 

        # sequential request withing a dialog should

        # take the path determined by record-routing

        if (loose_route()) {

                route(DLGURI);

                if ( is_method("ACK") ) {

                        # ACK is forwarded statelessly

                        if (has_body("application/sdp")) {

                                rtpengine_answer();

                        }

                } else if ( is_method("NOTIFY") ) {

                        # Add Record-Route for in-dialog NOTIFY as per RFC 6665.

                        record_route();

                }

                route(DISPATCH);

                exit;

        }

 

        if ( is_method("ACK") ) {

                if ( t_check_trans() ) {

                        # no loose-route, but stateful ACK;

                        # must be an ACK after a 487

                        # or e.g. 404 from upstream server

                        route(RELAY);

                        exit;

                } else {

                        # ACK without matching transaction ... ignore and discard

                        exit;

                }

        }

        sl_send_reply("404","Not here");

        exit;

}

 

route[SIPIPV4] {

        if (src_ip != BACKEND_NET4)

        {

                # device (client) to server (backend)

                route(V4DEVTOSRV);

        } else {

                # server (backend) to devuce (client)

                route(V4SRVTODEV);

        }

}

 

route[SIPIPV6] {

        sl_send_reply("404", "Not routing for IPv6");

        exit;

}

 

route[V4DEVTOSRV] {

        xlog("L_NOTICE", "client->backend FROM CLIENT IP: $si $rm $ru  $td ID=$ci\n");

 

        # SIP request packet client->backend

 

        # - remove preloaded route headers

        remove_hf("Route");

 

        if (!lookup_domain("$td", "dattr_")) {

                xlog("L_ERR", "$si $rm $ru -- domain \"$td\" is not "

                                "found in domain table\n");

                xlog("attempt to login with unkown domain from $si");

                sl_send_reply("404", "No route for domain");

                exit;

        }

 

        if (!defined $avp(dattr_routeset)) {

                xlog("L_ERR", "$si $rm $ru -- attribute \"routeset\" is " +

                                "undefined for domain $td\n");

                sl_send_reply("404", "No route id for domain");

                exit;

        }

 

        if( !ds_select_dst(4000 + $avp(dattr_routeset), "1") ) {

                xlog("L_NOTICE", "Drop....\n");

                sl_send_reply("404", "No destination");

        }

 

        if (is_method("REGISTER")) {

                add_path_received();

        } else {

                if (nat_uac_test("19")) {

                        if(is_first_hop()) {

                                add_contact_alias();

                        }

                }

        }

 

        if (has_body("application/sdp")) {

                rtpengine_offer("direction=pub direction=priv ICE=remove");

        }

 

        route(DISPATCH);

 

        xlog("L_NOTICE", "DISPATCH: source address: $si SIP request's method: $rm SIP Request's URI: $ru ID=$ci\n");

        exit;

}

 

route[V4SRVTODEV] {

        # SIP request packet backend->client

 

        # Invites from backend contain Route field and it should be used

        # to reach the registered client

 

        xlog("L_NOTICE", "backend->client FROM BACKEND: source address: $si"

                        "  METHOD: $rm  $ru  To-URI: $tu ID=$ci \n");

 

        xlog("L_NOTICE", "backend->client $rm: TO $ru FROM $fu ID=$ci\n");

        if (has_body("application/sdp")) {

                rtpengine_offer("direction=priv direction=pub ICE=remove");

        }

 

        if(!is_present_hf("Route")) {

                sl_send_reply("404", "No record routing");

                exit;

        }

        loose_route();

 

        route(DISPATCH);

}

 

route[DISPATCH] {

 

        xlog("L_NOTICE", "ROUTE-DISPATCH $si $rm $ru ID=$ci \n");

 

        xlog("L_NOTICE", "ROUTE-DISPATCH Messege buff.... ID=$ci $rm  \n $mb\n");

 

        if(!is_method("ACK")) {

                if (has_body("application/sdp")) {

                        xlog("L_NOTICE", "SDP Offer....ID=$ci\n");

                        t_on_reply("INVSDP");

                } else {

                        t_on_reply("INVNOSDP");

                }

        }

        xlog("L_NOTICE", "DISPATCH $si METHOD: $rm $ru $du ID=$ci\n");

        xlog("L_NOTCIE", "Return code: $rc ID=$ci\n");

        route(RELAY);

        exit;

}

 

 

# URI update for dialog requests

route[DLGURI] {

        if(!isdsturiset()) {

                handle_ruri_alias();

        }

        return;

}

 

route[REPLYALIAS] {

        if(src_ip != BACKEND_NET4) {

                # SIP reply packet client->backend

                xlog("L_NOTICE", "FROM CLIENT($si onreply_route- ): Method: $rm"

                                "$ru To: $tu Recieved on: $Ri ID=$ci ");

                add_contact_alias();

        } else {

                # SIP reply packet backend->client

                xlog("L_NOTICE", "FROM BACKEND($si onreply_route): Method: $rm"

                                " $ru To: $tu Recieved on: $Ri  ID=$ci");

                xlog("L_NOTICE", "FROM BACKEND #rtpengine_answer# ($si onreply_route):"

                                " source address: $si SIP request's method: $rm SIP Request's"

                                " URI: $ru ID=$ci\n");

        }

}

 

onreply_route[INVSDP] {

        if (af!=INET) {

                exit;

        }

        if (has_body("application/sdp")) {

        xlog("L_NOTICE", "INVSDP Route: Method: $rm"

                                " $ru To: $tu Recieved on: $Ri  ID=$ci\n $mb\n");

 

                rtpengine_answer();

        }

        route(REPLYALIAS);

        exit;

}

 

onreply_route[INVNOSDP] {

        if (af!=INET) {

                exit;

        }

        if (has_body("application/sdp")) {

        xlog("L_NOTICE", "INVNOSDP Route: Method: $rm"

                                " $ru To: $tu Recieved on: $Ri  ID=$ci\n $mb\n");

 

       

                if(src_ip == BACKEND_NET4) {

                        rtpengine_offer("direction=priv direction=pub ICE=remove");

                } else {

                        rtpengine_offer("direction=pub direction=priv ICE=remove");

                }

        }

        route(REPLYALIAS);

        exit;

}

 

 

Best Regards

 

Gerry Kernan

 

From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of gerry kernan
Sent: 23 March 2018 08:50
To: 'Kamailio (SER) - Users Mailing List' <sr-users@lists.kamailio.org>
Subject: Re: [SR-Users] <UNJUNKED> Re: Audio stops after resuming call from hold

 

Hi Segriu

 

I think my issue is with  rtpengine . I’m using direction parameter to set a LAN and WAN IP on the offer and I think it’s getting messed up during re-invites

 

 

 

 

 

Best Regards

 

Gerry Kernan

 

From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Sergiu Pojoga
Sent: 23 March 2018 01:34
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: <UNJUNKED> Re: [SR-Users] Audio stops after resuming call from hold

 

OMG, what are the odds, a client reported the same problem today! Edge proxy running same 4.2.3, requests are forwarded to a farm of Asterisks v13 in a similar way based on $rd, far-end NAT traversal is handled by Kamailio.

 

I've had only an hour or so to debug today. Re-invites containing SDP are handled the same way as invites in terms of SDP mangling, all looks good in that sense. There's nothing special to be done about re-invites.

 

Preliminary clue is that this happens (or not) depending on the type of firewall/NAT behind which the phone is located. In the case with the trouble, it's a Sonicwall, probably a Symmetric NAT. Is doesn't happen to a phone behind a Full/Restricted Cone NAT. 

 

What nat= are you setting for Asterisk peers?

Do you engage rtpproxy/rtpengine?

Any far-end NAT traversal manipulations involved such as SIP ALG or STUN?

 

Cheers.

 

On Thu, Mar 22, 2018 at 3:55 PM, gerry kernan <gerry.kernan@infinityit.ie> wrote:

Hi

 

Hoping someone can point me in the right direction.

I have a Kamailio Ver: 4.2.3-1.1  running in front of a few asterisk servers Ver: 13.17.2  sip is routed to an asterisk server depending the domain name in the sip request, all working as expected . but if a call is put on hold  after resuming the call the party that placed the call on hold can’t hear any audio. The other party can hear . do I need to do anything special to handle re-invites for calls put on hold?

 

 

Gerry Kernan

 

cid:image001.jpg@01D105A5.2701B0E0

 

Infinity IT   |   17 The Mall   |   Beacon Court   |   Sandyford   |   Dublin D18 E3C8   |   Ireland

Tel:  +353 - (0)1 - 293 0090   |   E-Mail:  gerry.kernan@infinityit.ie

 

Managed IT Services       Infinity IT - www.infinityit.ie

IP Telephony                    Asterisk Consulting www.asteriskconsulting.com

Contact Centre                Total Interact www.totalinteract.com

 


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

 


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users