[OpenSIPS-Users] B2B Opensips + RTPEngine

mohamed.kharroubi at sofrecom.com mohamed.kharroubi at sofrecom.com
Wed Jun 7 12:06:16 UTC 2023


Actually we’re using this part for incoming calls, hope it would shed some light on what we’re trying to do :


################################################################################
route[incoming_call] {
    # Save the call direction in case we have to handle changes on sdp offer (for RTP Engine only). The AVP var will persist over the SIP transaction
    $avp(call_direction) = "incoming";

    # Create dialog and update profile with callee
    #route(create_diag_update_profile, $rU);

    if ($(var(attrs){s.len}) >0) {
        # We retrieve the group with the attributes orf the dialplan rule
        $avp(group) = $(var(attrs){s.int});
    }
    else {
        # No group defined in the diaplan rule so we use usr_preferences
        avp_db_load("$rU","$avp(group)");
    }
        if (ds_select_domain($avp(group),4)){
            route(logger, "L_INFO", "Call from GATEWAY routed to OMS with TGRP");
           $var(result) = 1;

        }

      if ($var(result) > 0) {
        # Activate topology hiding if enabled
     #   route(activate_topology_hiding);
        $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin in-iface=external out-iface=internal ICE=remove";
        if (rtpengine_manage("$var(rtpengine_flags)"))
           t_on_reply("reply_early_offer");
      #  route(set_on_branch_route);
         route(branch_route_rtp_proxy);

        # Arm the branch callback to 'branch_route_rtp_proxy' if we have an RTP engine
       # route(set_on_branch_route);

      #  route(safe_relay_and_exit);
        b2b_init_request("top hiding");
      exit;
    }
}

route[branch_route_rtp_proxy] {

     if (has_body("application/sdp") && is_method("INVITE")) {
        # Early offer cases
        $var(cline) = $(rb{sdp.line,c});
        $var(sline) = $(rb{sdp.line,s});
        $var(log_msg) = "SDP content: o=" + $(rb{sdp.line,o}) + ", s=" + $var(sline) + " c=" + $var(cline) + ", m=" + $(rb{sdp.line,m});
        route(logger, "L_INFO", $var(log_msg));

        # Check the call direction
        if ($avp(call_direction) == "incoming")
        {
            $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin in-iface=external out-iface=internal ICE=remove";
            if (rtpengine_manage("$var(rtpengine_flags)"))
                t_on_reply("reply_early_offer");
        }
        else if ($avp(call_direction) == "outgoing") {
            if ($var(sline) == "s=oms" || $var(sline) == "s=acd") {
                $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin in-iface=internal out-iface=external ICE=remove";
                route(logger, "L_INFO", "BRANCH ROUTE OUTGOING");
                if (rtpengine_manage("$var(rtpengine_flags)"))
                    t_on_reply("reply_early_offer");

            }
            else {
                route(logger, "L_INFO", "No transformation needed on RTP, INVITE containing BToI (case where 2 UACs are linked");
            }
        }
    }
    else if (is_method("INVITE") && $avp(call_direction) == "incoming") {
        # We are in case of late offer we expect the SDP offer later
        t_on_reply("reply_late_offer");
    }
}

onreply_route[reply_early_offer] {
    if (has_body("application/sdp") ) {
        route(logger, "L_INFO", "SDP reply from GATEWAY to OMS for early offer");
        rtpengine_manage();
    }
}

onreply_route[reply_late_offer] {
    if (t_check_status("200") && has_body("application/sdp")){
       # We just received a response containing a late offer. We need to do some modification in the offer for the proxy. Only available for incoming calls.
       $var(rtpengine_flags) = "RTP/AVP replace-session-connection replace-origin in-iface=internal out-iface=external ICE=remove";
       rtpengine_manage("$var(rtpengine_flags)");

   } else if (has_body("application/sdp") ){
        route(logger, "L_INFO", "SDP reply from GATEWAY to OMS for late offer");
        rtpengine_manage();
   }
}
########################################################################

Bien Cordialement,
[cid:image001.png at 01D99940.00DF6F60]    [cid:image002.jpg at 01D99940.00DF6F60] <http://www.orange.com/>
Kharroubi Mohamed
Senior DevOps/System Engineer
Orange/ IMT/ OLPS/ OPS/ International Centers/ Tunisia

mohamed.kharroubi at sofrecom.com<mailto:mohamed.kharroubi at sofrecom.com>
www.sofrecom.com<http://www.sofrecom.com/>

Part of the Orange group

De : Users <users-bounces at lists.opensips.org> De la part de Brett Nemeroff
Envoyé : mercredi 7 juin 2023 12:43
À : OpenSIPS users mailling list <users at lists.opensips.org>
Cc : BARKAOUI Chaker SOFRECOM <chaker.barkaoui at sofrecom.com>; DESGEORGE Guillaume INNOV/IT-S <guillaume.desgeorge at orange.com>; GUESMI Amel SOFRECOM <amel.guesmi at orange.com>
Objet : Re: [OpenSIPS-Users] B2B Opensips + RTPEngine

We are going to need to see a little more of where this is called. It’s worth mentioning that it has to be called at the right time. Simply firing  this off doesn’t automatically manage the session.

Thanks,
Brett

On Wed, Jun 7, 2023 at 6:19 AM <mohamed.kharroubi at sofrecom.com<mailto:mohamed.kharroubi at sofrecom.com>> wrote:
Hello,

So we don’t use that function regarding RTPEngine, but we use the rtpengine_manage() instead.

Here is an example of how we use it inside the routing logic :

####################################################################################
$var(rtpengine_flags) = "replace-session-connection replace-origin in-iface=internal out-iface=external";
        rtpengine_manage("$var(rtpengine_flags)");
####################################################################################

Bien Cordialement,
[cid:image001.png at 01D99940.00DF6F60]    [cid:image002.jpg at 01D99940.00DF6F60] <http://www.orange.com/>
Kharroubi Mohamed
Senior DevOps/System Engineer
Orange/ IMT/ OLPS/ OPS/ International Centers/ Tunisia

mohamed.kharroubi at sofrecom.com<mailto:mohamed.kharroubi at sofrecom.com>
www.sofrecom.com<http://www.sofrecom.com/>

Part of the Orange group

De : Users <users-bounces at lists.opensips.org<mailto:users-bounces at lists.opensips.org>> De la part de Jehanzaib Younis
Envoyé : mercredi 7 juin 2023 00:29
À : OpenSIPS users mailling list <users at lists.opensips.org<mailto:users at lists.opensips.org>>
Objet : Re: [OpenSIPS-Users] B2B Opensips + RTPEngine

Hi there,

Can you write an example of how you used rtpengine_offer() ?


Regards,
Jehanzaib


On Wed, Jun 7, 2023 at 3:07 AM <mohamed.kharroubi at sofrecom.com<mailto:mohamed.kharroubi at sofrecom.com>> wrote:
Hello Community,

We are trying to set up an Opensips with RTPEngine in a B2B configuration to handle media processing. There is no scenario for the B2B we’re trying to implement, we’re just using the topology « «top hiding » !

However, regardless of our configuration, the SDP of the INVITE and 200 OK packets is not modified to include the RTPEngine IP address and port

How should the RTPEngine be configured in the Opensips.cfg or which function(s) should be called to achieve this?
Bien Cordialement,
[cid:image001.png at 01D99940.00DF6F60]    [cid:image002.jpg at 01D99940.00DF6F60] <http://www.orange.com/>
Kharroubi Mohamed
Senior DevOps/System Engineer
Orange/ IMT/ OLPS/ OPS/ International Centers/ Tunisia

mohamed.kharroubi at sofrecom.com<mailto:mohamed.kharroubi at sofrecom.com>
www.sofrecom.com<http://www.sofrecom.com/>

Part of the Orange group

_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230607/49aeab27/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 2476 bytes
Desc: image001.png
URL: <http://lists.opensips.org/pipermail/users/attachments/20230607/49aeab27/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.jpg
Type: image/jpeg
Size: 785 bytes
Desc: image002.jpg
URL: <http://lists.opensips.org/pipermail/users/attachments/20230607/49aeab27/attachment-0001.jpg>


More information about the Users mailing list