<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hi Nitesh,<br>
    <br>
    Be sure all the remove_hf() are on the right execution path and
    BEFORE the t_relay() for the sequential requests.<br>
    <br>
    Regards,<br>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a class="moz-txt-link-freetext" href="https://www.opensips-solutions.com">https://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 5-16 Dec 2022, online
  <a class="moz-txt-link-freetext" href="https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/">https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/</a></pre>
    <div class="moz-cite-prefix">On 11/1/22 2:15 PM, Nitesh Divecha
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJbqcDOZV0oBojADSyq-1W+BA3xqYXky7Xk0iuWDqjq0cug+Bw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Bogdan,
        <div><br>
        </div>
        <div>Thanks for your feedback. </div>
        <div><br>
        </div>
        <div>After reading the docs and following this tutorial (<a
            href="https://opensips.org/Documentation/Tutorials-Topology-Hiding"
            moz-do-not-send="true">https://opensips.org/Documentation/Tutorials-Topology-Hiding</a>)
          I finally got it working. Thank you!</div>
        <div><br>
        </div>
        <div>INVITE is clean, topology is hidden and ACK is sent back
          and forth. Calls are holding good. </div>
        <div><br>
        </div>
        <div>While confirming each ACK and BYE, I noticed Originator's
          User-Agent is passed on again only on to ACK and BYE. </div>
        <div><br>
        </div>
        <div>I tried to define under: </div>
        <div><br>
        </div>
        <div>route{</div>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">if
          (has_totag()) {<br>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">if
            ( is_method("ACK") ) {</blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px"> 
                                        if(remove_hf("User-Agent")){<br>
                                                  xlog("*** has-totag
          -> ACK User-Agent found and removed on $rm from $si
          (callid=$ci). ***\n");<br>
                                          }<br>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">}</blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">if
            (is_method("BYE")) {</blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
            <blockquote style="margin:0 0 0
              40px;border:none;padding:0px">xlog("*** if is_method(BYE)
              on $rm from $si (callid=$ci) ***\n");</blockquote>
          </blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
            <blockquote style="margin:0 0 0
              40px;border:none;padding:0px">if(remove_hf("User-Agent")){</blockquote>
          </blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
            <blockquote style="margin:0 0 0
              40px;border:none;padding:0px">
              <blockquote style="margin:0 0 0
                40px;border:none;padding:0px">xlog("*** is_method BYE
                User-Agent found and removed on $rm from $si
                (callid=$ci). ***\n");<br>
              </blockquote>
            </blockquote>
          </blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
            <blockquote style="margin:0 0 0
              40px;border:none;padding:0px">}</blockquote>
          </blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">#
            do accounting even if the transaction fails</blockquote>
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">do_accounting("db","failed");</blockquote>
          <blockquote style="margin:0 0 0 40px;border:none;padding:0px">}</blockquote>
        </blockquote>
        <blockquote style="margin:0 0 0 40px;border:none;padding:0px">}</blockquote>
        <div>}</div>
        <div><br>
        </div>
        <div>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 :-).</div>
        <div><br>
        </div>
        <div>Any suggestions? </div>
        <div><br>
        </div>
        <div>Cheers,</div>
        <div>Nitesh</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Thu, Oct 27, 2022 at 11:34
          AM Bogdan-Andrei Iancu <<a
            href="mailto:bogdan@opensips.org" moz-do-not-send="true">bogdan@opensips.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
          <div> <font face="monospace">Hi Nitesh,<br>
              <br>
              Where you have the loose_route() in your script right now,
              use topology_hiding_match()<br>
                 
              <a
href="https://opensips.org/html/docs/modules/3.2.x/topology_hiding.html#func_topology_hiding_match"
                target="_blank" moz-do-not-send="true">https://opensips.org/html/docs/modules/3.2.x/topology_hiding.html#func_topology_hiding_match</a><br>
              <br>
              Regards,<br>
            </font>
            <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 5-16 Dec 2022, online
  <a href="https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/" target="_blank" moz-do-not-send="true">https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/</a></pre>
            <div>On 10/27/22 3:51 PM, Nitesh Divecha wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">Hey Bogdan-Andrei,
                <div><br>
                </div>
                <div>Thanks for your feedback. </div>
                <div><br>
                </div>
                <div>To be honest - I don't know! </div>
                <div><br>
                </div>
                <div>I followed some online tutorials and tried to
                  implement "topology_hiding()" after <span
                    style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">is_method("INVITE")
                    since the first message sent to Outbound Provider is
                    INVITE. </span></div>
                <div><br>
                </div>
                <div>I never tried topology_hiding_match().</div>
                <div><br>
                </div>
                <div>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. </div>
                <div><br>
                </div>
                <div>I guess Bootcamp is the answer :-)</div>
                <div><br>
                </div>
                <div>
                  <div>Cheers,</div>
                  <div>Nitesh</div>
                  <div><br>
                  </div>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Thu, Oct 27, 2022
                  at 4:02 AM Bogdan-Andrei Iancu <<a
                    href="mailto:bogdan@opensips.org" target="_blank"
                    moz-do-not-send="true">bogdan@opensips.org</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px
0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
                  <div> <font face="monospace">Hi Nitesh,<br>
                      <br>
                      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.<br>
                      <br>
                      Regards,<br>
                    </font>
                    <pre cols="72">Bogdan-Andrei Iancu

OpenSIPS Founder and Developer
  <a href="https://www.opensips-solutions.com" target="_blank" moz-do-not-send="true">https://www.opensips-solutions.com</a>
OpenSIPS Bootcamp 5-16 Dec 2022, online
  <a href="https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/" target="_blank" moz-do-not-send="true">https://www.opensips.org/training/OpenSIPS_eBootcamp_2022/</a></pre>
                    <div>On 10/26/22 9:05 PM, Nitesh Divecha wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <div dir="ltr">Hello All, 
                        <div><br>
                        </div>
                        <div>I don't know if this is by design or me not
                          implementing correctly! I'm a newbie to
                          OpenSIPS... </div>
                        <div><br>
                        </div>
                        <div>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. </div>
                        <div><br>
                        </div>
                        <div>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. </div>
                        <div><br>
                        </div>
                        <div>On the sngrep it shows that call from ATA
                          to OpenSIPS "COMPLETED" while OpenSIPS to
                          Outbound Provider "CALL SETUP".</div>
                        <div><br>
                        </div>
                        <div>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...</div>
                        <div><br>
                        </div>
                        <div>Here is my cfg:</div>
                        <div><br>
                        </div>
                        <div>route {</div>
                        <div>...</div>
                        <div><span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">if
                            (dp_translate(10 ,$rU ,$rU) ) {</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          xlog("*** Dial plan translate
                            from source $avp(src) to $rU ***\n");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          $avp(furi) = "<a
                              href="mailto:sip%3Axxxxxxxxxx@gothamcity.com"
                              target="_blank" moz-do-not-send="true">sip:xxxxxxxxxx@gothamcity.com</a>";</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          uac_replace_from( ,
                            "$avp(furi)");</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          #strip(1);</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          if (!do_routing(0)) {</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                                  send_reply(500,"No
                            PSTN Route found");</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                                  exit;</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          }</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          # t_on_branch("change_from");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          route(relay);</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          exit;</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  }</span><br>
                        </div>
                        <div><span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">...</span></div>
                        <div>}</div>
                        <div><br>
                        </div>
                        <div><span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">route[relay]
                            {</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  # for INVITEs enable some additional
                            helper routes</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  if (is_method("INVITE")) {</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          # create_dialog();</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          topology_hiding("UC");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          if(remove_hf("User-Agent")){</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                                  xlog("*** 4.
                            User-Agent found and removed. ***\n");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          }</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          if (isflagset("NAT")
                            && has_body("application/sdp")) {</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                                  rtpproxy_offer("ro");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          }</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          t_on_branch("per_branch_ops");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          t_on_reply("handle_nat");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          t_on_failure("missed_call");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  }</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  if (isflagset("NAT")) {</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          add_rr_param(";nat=yes");</span><br
style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  }</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  if (!t_relay()) {</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                          send_reply(500,"Internal
                            Error");</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  }</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"> 
                                  exit;</span><br
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">
                          <span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">}</span><br>
                        </div>
                        <div><span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px"><br>
                          </span></div>
                        <div><span
                            style="color:rgb(0,0,0);font-family:Helvetica;font-size:12px">My
                            eyes are sore and my head is spinning... </span><span
style="font-size:12px;color:rgb(0,0,0);font-family:Helvetica">Any help
                            will be highly appreciated... Thanks! </span></div>
                        <div><font face="Helvetica" color="#000000"><span
                              style="font-size:12px"><br>
                            </span></font></div>
                        <div><font face="Helvetica" color="#000000"><span
                              style="font-size:12px">Cheers,</span></font></div>
                        <div><font face="Helvetica" color="#000000"><span
                              style="font-size:12px">Nitesh</span></font></div>
                        <div><font face="Helvetica" color="#000000"><span
                              style="font-size:12px"><br>
                            </span></font></div>
                      </div>
                      <br>
                      <fieldset></fieldset>
                      <pre>_______________________________________________
Users mailing list
<a href="mailto:Users@lists.opensips.org" target="_blank" moz-do-not-send="true">Users@lists.opensips.org</a>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank" moz-do-not-send="true">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
                    </blockquote>
                    <br>
                  </div>
                </blockquote>
              </div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
  </body>
</html>