Hi Nitesh,

Be sure all the remove_hf() are on the right execution path and BEFORE the t_relay() for the sequential requests.

Regards,

Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  https://www.opensips-solutions.com
OpenSIPS Bootcamp 5-16 Dec 2022, online
  https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/

On 11/1/22 2:15 PM, Nitesh Divecha wrote:
Bogdan,

Thanks for your feedback.

After reading the docs and following this tutorial (https://opensips.org/Documentation/Tutorials-Topology-Hiding <https://opensips.org/Documentation/Tutorials-Topology-Hiding>) I finally got it working. Thank you!

INVITE is clean, topology is hidden and ACK is sent back and forth. Calls are holding good.

While confirming each ACK and BYE, I noticed Originator's User-Agent is passed on again only on to ACK and BYE.

I tried to define under:

route{

    if (has_totag()) {

        if ( is_method("ACK") ) {

                                  if(remove_hf("User-Agent")){
                                            xlog("*** has-totag -> ACK
    User-Agent found and removed on $rm from $si (callid=$ci). ***\n");
                                    }

        }

        if (is_method("BYE")) {

            xlog("*** if is_method(BYE) on $rm from $si (callid=$ci)
            ***\n");

            if(remove_hf("User-Agent")){

                xlog("*** is_method BYE User-Agent found and removed
                on $rm from $si (callid=$ci). ***\n");

            }

        # do accounting even if the transaction fails

        do_accounting("db","failed");

        }

    }

}

But still Originator's User-Agent is passed on to ACK and BYE... Ignore the xlog(""), it is just my way of learning what each line is doing and if getting executed :-).

Any suggestions?

Cheers,
Nitesh









On Thu, Oct 27, 2022 at 11:34 AM Bogdan-Andrei Iancu <bog...@opensips.org <mailto:bog...@opensips.org>> wrote:

    Hi Nitesh,

    Where you have the loose_route() in your script right now, use
    topology_hiding_match()
    
https://opensips.org/html/docs/modules/3.2.x/topology_hiding.html#func_topology_hiding_match
    
<https://opensips.org/html/docs/modules/3.2.x/topology_hiding.html#func_topology_hiding_match>

    Regards,

    Bogdan-Andrei Iancu

    OpenSIPS Founder and Developer
       https://www.opensips-solutions.com  <https://www.opensips-solutions.com>
    OpenSIPS Bootcamp 5-16 Dec 2022, online
       https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/  
<https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/>

    On 10/27/22 3:51 PM, Nitesh Divecha wrote:
    Hey Bogdan-Andrei,

    Thanks for your feedback.

    To be honest - I don't know!

    I followed some online tutorials and tried to implement
    "topology_hiding()" after is_method("INVITE") since the first
    message sent to Outbound Provider is INVITE.

    I never tried topology_hiding_match().

    What is the right way to implement topology_hiding module? My
    scenario is simple, I'm using the default cfg and making ATA
    register to OpenSIPS to make Outbound PSTN calls.

    I guess Bootcamp is the answer :-)

    Cheers,
    Nitesh


    On Thu, Oct 27, 2022 at 4:02 AM Bogdan-Andrei Iancu
    <bog...@opensips.org <mailto:bog...@opensips.org>> wrote:

        Hi Nitesh,

        Do you do topology_hiding_match() for the sequential requests
        (instead of the typical loose_route()) ?  As it seems you cfg
        fails to properly handle the in-dialog / sequential requests.

        Regards,

        Bogdan-Andrei Iancu

        OpenSIPS Founder and Developer
           https://www.opensips-solutions.com  
<https://www.opensips-solutions.com>
        OpenSIPS Bootcamp 5-16 Dec 2022, online
           https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/  
<https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/>

        On 10/26/22 9:05 PM, Nitesh Divecha wrote:
        Hello All,

        I don't know if this is by design or me not implementing
        correctly! I'm a newbie to OpenSIPS...

        So I generated a new opensips_residential.cfg file and only
        edited it with topology_hiding("UC"); under INVITE. Plus all
        the extras to make ATA register successfully and SIP trunk.

        Every time I make a call two INVITE dialogs are created. One
        from ATA to OpenSIPS and second one from OpenSIPS to
        Outbound Provider. When a PSTN call is answered, the
        Outbound Provider sends 200 OK back to OpenSIPS, and
        OpenSIPS sends back 200 OK to ATA. Then ATA acknowledges
        with ACK back to OpenSIPS BUT OpenSIPS fails to send ACK to
        the Outbound Provider. So Outbound Provider sends 200 OK
        again to OpenSIPS and OpenSIPS sends 200 OK to ATA then ATA
        acknowledges with ACK back to OpenSIPS BUT OpenSIPS fails to
        send back ACK... This dance goes on for 30 secs and until
        Outbound Provider drops the call due to no ACK.

        On the sngrep it shows that call from ATA to OpenSIPS
        "COMPLETED" while OpenSIPS to Outbound Provider "CALL SETUP".

        If I comment out topology_hiding("UC"); then everything
        works perfectly and sngrep shows only one INVITE dialog from
        ATA to OpenSIPS to Outbound Provider except the Outbound
        Provider can see everything that is ATA's IP info, etc...

        Here is my cfg:

        route {
        ...
        if (dp_translate(10 ,$rU ,$rU) ) {
                      xlog("*** Dial plan translate from source
        $avp(src) to $rU ***\n");

                      $avp(furi) = "sip:xxxxxxx...@gothamcity.com
        <mailto:sip%3axxxxxxx...@gothamcity.com>";
                      uac_replace_from( , "$avp(furi)");
                      #strip(1);
                      if (!do_routing(0)) {
                              send_reply(500,"No PSTN Route found");
                              exit;
                      }
                      # t_on_branch("change_from");
                      route(relay);
                      exit;
              }
        ...
        }

        route[relay] {
              # for INVITEs enable some additional helper routes
              if (is_method("INVITE")) {
                      # create_dialog();
                      topology_hiding("UC");
                      if(remove_hf("User-Agent")){
                              xlog("*** 4. User-Agent found and
        removed. ***\n");
                      }

                      if (isflagset("NAT") &&
        has_body("application/sdp")) {
                              rtpproxy_offer("ro");
                      }

                      t_on_branch("per_branch_ops");
                      t_on_reply("handle_nat");
                      t_on_failure("missed_call");
              }

              if (isflagset("NAT")) {
                      add_rr_param(";nat=yes");
              }

              if (!t_relay()) {
                      send_reply(500,"Internal Error");
              }
              exit;
        }

        My eyes are sore and my head is spinning... Any help will be
        highly appreciated... Thanks!

        Cheers,
        Nitesh


        _______________________________________________
        Users mailing list
        Users@lists.opensips.org  <mailto:Users@lists.opensips.org>
        http://lists.opensips.org/cgi-bin/mailman/listinfo/users  
<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>



_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to