<div dir="ltr">Thanks for your colaboration.<div><br></div><div>Here is the complete script:</div><div><br></div><div><div>route</div><div>{</div><div>    #########################</div><div>    ## Beginning of Script</div>
<div>    xlog(&quot;L_INFO&quot;, &quot;$ci|start|recieved $oP request $rm $ou | ru $ru&quot;);</div><div>    xlog(&quot;L_INFO&quot;, &quot;$ci|log|source $si:$sp&quot;);</div><div>    xlog(&quot;L_INFO&quot;, &quot;$ci|log|from $fu $(fu{uri.host})&quot;);</div>
<div>    xlog(&quot;L_INFO&quot;, &quot;$ci|log|to $tu&quot;);</div><div>    xlog(&quot;L_INFO&quot;, &quot;$ci|log|rU $rU&quot;);</div><div>    </div><div>    #########################</div><div><br></div><div>    if (!pike_check_req()) {</div>
<div>        xlog(&quot;L_ALERT&quot;, &quot;$ci|PIKE ACTIVE|pike active $(fu{uri.host})&quot;);</div><div><span class="" style="white-space:pre">        </span>acc_db_request(&quot;201 PIKE Active&quot;,&quot;acc_bye&quot;);</div>
<div>        exit;</div><div>    };</div><div><br></div><div>    if (has_totag()  &amp;&amp; (uri == myself)  &amp;&amp; is_method(&quot;INVITE|ACK|BYE|UPDATE&quot;))</div><div>    {</div><div><span class="" style="white-space:pre">                        </span>if(loose_route()) {</div>
<div><span class="" style="white-space:pre">                                </span>if(!match_dialog()) </div><div><span class="" style="white-space:pre">                                        </span>exit;</div><div><br></div><div><span class="" style="white-space:pre">                                </span>if(!t_relay()) </div>
<div><span class="" style="white-space:pre">                                        </span>t_reply_error();</div><div><br></div><div><span class="" style="white-space:pre">                                </span>exit;</div><div><span class="" style="white-space:pre">                        </span>} else {</div>
<div><span class="" style="white-space:pre">                                </span>if(is_method(&quot;ACK&quot;)) {</div><div><span class="" style="white-space:pre">                                        </span>if(t_check_trans()) {</div><div><span class="" style="white-space:pre">                                                </span>t_relay();</div>
<div><span class="" style="white-space:pre">                                                </span>exit;</div><div><span class="" style="white-space:pre">                                        </span>}</div><div><br></div><div><span class="" style="white-space:pre">                                        </span>exit;</div><div><span class="" style="white-space:pre">                                </span>}</div>
<div><br></div><div><span class="" style="white-space:pre">                                </span>sl_send_reply(&quot;404&quot;, &quot;Not here&quot;);</div><div><span class="" style="white-space:pre">                        </span>}</div><div><br></div><div><span class="" style="white-space:pre">                        </span>exit;</div>
<div><span class="" style="white-space:pre">                </span>}</div><div><br></div><div>    if (is_method(&quot;CANCEL&quot;)) {</div><div>        xlog(&quot;L_INFO&quot;, &quot;$ci|log|CANCEL CALL: rU $rU | tu $tu | fu $fu | rd $rd&quot;);</div>
<div><br></div><div>        if (t_check_trans())</div><div>                t_relay();</div><div>        exit;</div><div>    }</div><div><br></div><div>    t_check_trans();</div><div><br></div><div>    if (is_method(&quot;OPTIONS&quot;) ) {</div>
<div>        options_reply();</div><div><span class="" style="white-space:pre">                                </span>exit;</div><div>    };</div><div>    </div><div><span class="" style="white-space:pre">                </span>if (!is_method(&quot;REGISTER|MESSAGE&quot;))</div>
<div>        record_route();</div><div><br></div><div><span class="" style="white-space:pre">        </span>if(loose_route()) {</div><div><span class="" style="white-space:pre">                </span>xlog(&quot;L_ERR&quot;,&quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);</div>
<div><br></div><div><span class="" style="white-space:pre">                </span>if (!is_method(&quot;ACK&quot;))</div><div><span class="" style="white-space:pre">                        </span>send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);</div>
<div><span class="" style="white-space:pre">                        </span>exit;</div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre">        </span>if ($rU==NULL) {</div>
<div><span class="" style="white-space:pre">                </span>send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);</div><div><span class="" style="white-space:pre">                </span>acc_db_request(&quot;484 Address Incomplete&quot;,&quot;acc_bye&quot;);</div>
<div><span class="" style="white-space:pre">                </span>exit;</div><div><span class="" style="white-space:pre">        </span>}</div></div><div><br></div><div><br></div><div>Thanks</div><div><br></div><div>Wilmar</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Feb 5, 2014 at 7:19 AM, Vlad Paiu <span dir="ltr">&lt;<a href="mailto:vladpaiu@opensips.org" target="_blank">vladpaiu@opensips.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
The sequential processing part is a little bit wrong - you should have<br>
<br>
                if (loose_route() || match_dialog()) {<br>
                        if ($DLG_status==NULL) {<div class="im"><br>
                                xlog(&quot; cannot match request to a dialog \n&quot;);<br></div>
                                # something wrong - might want to drop such requests<br>
                        }<br>
<br>
<br>
Can you please also post a trace of the traffic flow when the Route header gets that bogus \304 header ? Trying to replicate this on my side and see what&#39;s wrong.<div class="im HOEnZb"><br>
<br>
Best Regards,<br>
<br>
Vlad Paiu<br>
OpenSIPS Developer<br>
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<u></u>com</a><br>
<br></div><div class="HOEnZb"><div class="h5">
On 03.02.2014 20:36, BJ Quinn wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Oh and the only manual manipulation of the route headers was an attempt to get rid of that \304 in the header.<br>
<br>
I think the \304 thing may be a red herring for now.  I still can&#39;t get the topology hiding to work.  Below is my config file.  It&#39;s literally the default config file with nothing changed but I&#39;ve put in my IP address on the listen line, added a couple of aliases, added UAC module to try to change the from header (that works) and the dialog module and a couple of modifications to the route to make topology hiding work (not working for me).<br>

<br>
Am I putting this in the wrong part of the route?<br>
<br>
Thx<br>
<br>
-BJ Quinn<br>
<br>
---<br>
debug=3<br>
log_stderror=no<br>
log_facility=LOG_LOCAL0<br>
<br>
fork=yes<br>
children=4<br>
<br>
auto_aliases=no<br>
<br>
listen=udp:xx.xx.xx.9:5060<br>
<br>
disable_tcp=yes<br>
<br>
disable_tls=yes<br>
<br>
alias=xx.xx.xx.76:5060<br>
alias=xx.xx.xx.77:5060<br>
<br>
mpath=&quot;/usr/lib64/opensips/<u></u>modules&quot;<br>
<br>
loadmodule &quot;signaling.so&quot;<br>
<br>
loadmodule &quot;sl.so&quot;<br>
<br>
loadmodule &quot;tm.so&quot;<br>
modparam(&quot;tm&quot;, &quot;fr_timer&quot;, 5)<br>
modparam(&quot;tm&quot;, &quot;fr_inv_timer&quot;, 30)<br>
modparam(&quot;tm&quot;, &quot;restart_fr_on_each_reply&quot;, 0)<br>
modparam(&quot;tm&quot;, &quot;onreply_avp_mode&quot;, 1)<br>
<br>
loadmodule &quot;rr.so&quot;<br>
modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)<br>
<br>
loadmodule &quot;maxfwd.so&quot;<br>
<br>
loadmodule &quot;sipmsgops.so&quot;<br>
<br>
loadmodule &quot;mi_fifo.so&quot;<br>
modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)<br>
modparam(&quot;mi_fifo&quot;, &quot;fifo_mode&quot;, 0666)<br>
<br>
loadmodule &quot;uri.so&quot;<br>
modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)<br>
<br>
loadmodule &quot;usrloc.so&quot;<br>
modparam(&quot;usrloc&quot;, &quot;nat_bflag&quot;, &quot;NAT&quot;)<br>
modparam(&quot;usrloc&quot;, &quot;db_mode&quot;,   0)<br>
<br>
loadmodule &quot;registrar.so&quot;<br>
modparam(&quot;registrar&quot;, &quot;tcp_persistent_flag&quot;, &quot;TCP_PERSISTENT&quot;)<br>
<br>
loadmodule &quot;acc.so&quot;<br>
modparam(&quot;acc&quot;, &quot;early_media&quot;, 0)<br>
modparam(&quot;acc&quot;, &quot;report_cancels&quot;, 0)<br>
modparam(&quot;acc&quot;, &quot;detect_direction&quot;, 0)<br>
modparam(&quot;acc&quot;, &quot;failed_transaction_flag&quot;, &quot;ACC_FAILED&quot;)<br>
modparam(&quot;acc&quot;, &quot;log_flag&quot;, &quot;ACC_DO&quot;)<br>
modparam(&quot;acc&quot;, &quot;log_missed_flag&quot;, &quot;ACC_MISSED&quot;)<br>
<br>
# added to rewrite from header<br>
loadmodule &quot;uac.so&quot;<br>
loadmodule &quot;uac_auth.so&quot;<br>
modparam(&quot;uac&quot;,&quot;restore_mode&quot;,<u></u>&quot;manual&quot;)<br>
<br>
#added for topology hiding<br>
loadmodule &quot;dialog.so&quot;<br>
<br>
route{<br>
        if (!mf_process_maxfwd_header(&quot;<u></u>10&quot;)) {<br>
                sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>
                exit;<br>
        }<br>
<br>
        if (has_totag()) {<br>
                if (loose_route()) {<br>
                        # added for topology hiding                     <br>
                        if ($DLG_status==NULL &amp;&amp; !match_dialog() ) {<br>
                                xlog(&quot; cannot match request to a dialog \n&quot;);<br>
                        }<br>
                        #/added for topology hiding<br>
<br>
                        if (is_method(&quot;BYE&quot;)) {<br>
                                setflag(ACC_DO);<br>
                                setflag(ACC_FAILED);<br>
                        } else if (is_method(&quot;INVITE&quot;)) {<br>
                                record_route();<br>
                        }<br>
<br>
                        route(relay);<br>
                } else {<br>
                        <br>
                        if ( is_method(&quot;ACK&quot;) ) {<br>
                                if ( t_check_trans() ) {<br>
                                        t_relay();<br>
                                        exit;<br>
                                } else {<br>
                                        exit;<br>
                                }<br>
                        }<br>
                        sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>
                }<br>
                exit;<br>
        }<br>
<br>
        if (is_method(&quot;CANCEL&quot;))<br>
        {<br>
                if (t_check_trans())<br>
                        t_relay();<br>
                exit;<br>
        }<br>
<br>
        t_check_trans();<br>
<br>
        if ( !(is_method(&quot;REGISTER&quot;)  ) ) {<br>
                if (from_uri==myself)<br>
                {<br>
                } else {<br>
                        if (!uri==myself) {<br>
                                send_reply(&quot;403&quot;,&quot;Rely forbidden&quot;);<br>
                                exit;<br>
                        }<br>
                }<br>
        }<br>
<br>
        if (loose_route()) {<br>
                xlog(&quot;L_ERR&quot;,<br>
                &quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);<br>
                if (!is_method(&quot;ACK&quot;))<br>
                        sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);<br>
                exit;<br>
        }<br>
<br>
        if (!is_method(&quot;REGISTER|MESSAGE&quot;<u></u>))<br>
                record_route();<br>
<br>
        if (is_method(&quot;INVITE&quot;)) {<br>
                <br>
                setflag(ACC_DO); # do accounting<br>
        }<br>
<br>
         if (is_method(&quot;INVITE&quot;)) {<br>
                # rewrite from header<br>
                uac_replace_from(&quot;sip:$fU@xx.<u></u>xx.xx.9&quot;);<br>
                # trying to fix that /304 problem               <br>
                #remove_hf(&quot;Route&quot;);<br>
                #append_hf(&quot;Route: &lt;sip:xx.xx.xx.9;lr&gt;&quot;);<br>
                create_dialog();<br>
                topology_hiding();<br>
                exit;<br>
         }<br>
<br>
        if (!uri==myself) {<br>
                append_hf(&quot;P-hint: outbound\r\n&quot;);<br>
                route(relay);<br>
        }<br>
<br>
        if (is_method(&quot;PUBLISH|SUBSCRIBE&quot;<u></u>))<br>
        {<br>
                sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>
                exit;<br>
        }<br>
<br>
        if (is_method(&quot;REGISTER&quot;))<br>
        {<br>
                if (   0 ) setflag(TCP_PERSISTENT);<br>
                if (!save(&quot;location&quot;))<br>
                        sl_reply_error();<br>
<br>
                exit;<br>
        }<br>
<br>
        if ($rU==NULL) {<br>
                sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>
                exit;<br>
        }<br>
<br>
        if (!lookup(&quot;location&quot;,&quot;m&quot;)) {<br>
                t_newtran();<br>
                t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>
                exit;<br>
        }<br>
<br>
        setflag(ACC_MISSED);<br>
        route(relay);<br>
}<br>
<br>
<br>
route[relay] {<br>
        if (is_method(&quot;INVITE&quot;)) {<br>
                t_on_branch(&quot;per_branch_ops&quot;);<br>
                t_on_reply(&quot;handle_nat&quot;);<br>
                t_on_failure(&quot;missed_call&quot;);<br>
        }<br>
<br>
        if (!t_relay()) {<br>
                send_reply(&quot;500&quot;,&quot;Internal Error&quot;);<br>
        };<br>
        exit;<br>
}<br>
<br>
<br>
<br>
<br>
branch_route[per_branch_ops] {<br>
        xlog(&quot;new branch at $ru\n&quot;);<br>
}<br>
<br>
<br>
onreply_route[handle_nat] {<br>
        <br>
        xlog(&quot;incoming reply\n&quot;);<br>
}<br>
<br>
<br>
failure_route[missed_call] {<br>
        if (t_was_cancelled()) {<br>
                exit;<br>
        }<br>
}<br>
<br>
<br>
---<br>
<br>
----- Original Message -----<br>
From: &quot;BJ Quinn&quot; &lt;<a href="mailto:bjquinn@seidal.com" target="_blank">bjquinn@seidal.com</a>&gt;<br>
To: &quot;OpenSIPS users mailling list&quot; &lt;<a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a>&gt;<br>
Sent: Monday, February 3, 2014 10:27:22 AM<br>
Subject: Re: [OpenSIPS-Users] topology hiding<br>
<br>
Thanks, I&#39;ll do that. What about the topology hiding? Am I doing that incorrectly?<br>
<br>
-BJ<br>
<br>
----- Original Message -----<br>
From: &quot;Vlad Paiu&quot; &lt;<a href="mailto:vladpaiu@opensips.org" target="_blank">vladpaiu@opensips.org</a>&gt;<br>
To: <a href="mailto:users@lists.opensips.org" target="_blank">users@lists.opensips.org</a><br>
Sent: Monday, February 3, 2014 7:46:41 AM<br>
Subject: Re: [OpenSIPS-Users] topology hiding<br>
<br>
Hello,<br>
<br>
No, you should not regex out those bogus characters, this seems like a<br>
bug - could you please send us to SIP trace for your scenario so I can<br>
understand how and when it&#39;s happening ? Are you currently doing any<br>
manual manipulation on the Route headers in your script ?<br>
<br>
Also, if possible, Please open an issue on<br>
<a href="https://github.com/OpenSIPS/opensips/issue" target="_blank">https://github.com/OpenSIPS/<u></u>opensips/issue</a> for this so we can better<br>
keep track of it.<br>
<br>
<br>
Best Regards,<br>
<br>
Vlad Paiu<br>
OpenSIPS Developer<br>
<a href="http://www.opensips-solutions.com" target="_blank">http://www.opensips-solutions.<u></u>com</a><br>
<br>
On 01.02.2014 02:26, BJ Quinn wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I&#39;d like to use topology_hiding(), but I can&#39;t quite understand how to integrate it into the routing part of the configuration file. I have my opensips box on a public IP and some machines initiating calls through the opensips box that are also on public IPs, so no NAT going on or anything like that. However, a couple of the carriers we&#39;re trying to use don&#39;t like seeing the IP address of the machines initiating the call (in Route and Contact headers, etc.) and that&#39;s causing problems including some carriers don&#39;t think the call has set up properly (even though it goes through), which leads to missing BYEs. Anyway, seems like topology_hiding() is a great idea anyway, regardless of the fact that I&#39;ve had a carrier specifically request it.<br>

<br>
I&#39;m using 1.10. So I&#39;ve started with the basic Residential scenario made from osipsconfig. I didn&#39;t check any of the options (like ENABLE_TCP, USE_ALIASES, etc.) and modified only my IP address and added a couple of aliases for the machines making the calls. I added the following outside of the routing logic to load the dialog module to make topology_hiding() available.<br>

<br>
loadmodule &quot;dialog.so&quot;<br>
<br>
Then, under &quot;if(has_totag()) { if (loose_route()) {&quot; I added --<br>
<br>
if ($DLG_status==NULL &amp;&amp; !match_dialog() ) {<br>
xlog(&quot; cannot match request to a dialog \n&quot;);<br>
}<br>
<br>
And outside of the &quot;if(has_totag())&quot; section I added --<br>
<br>
if (is_method(&quot;INVITE&quot;)) {<br>
create_dialog();<br>
topology_hiding();<br>
}<br>
<br>
Without these added sections, things are fine on some carriers and with other carriers I have the problems described above which causes me to want to enable topology hiding. With these added sections, I get 408 timeouts since it appears that the opensips box is responding NOT HERE to the carrier&#39;s 200 OKs.<br>

<br>
Also, possibly unrelated, in either case I&#39;m getting a weird &quot;\304&quot; added to my Route header. Should I just replace the Route header and regex that out?<br>
<br>
Route: &lt;sip:xx.xx.xx.xx:\304;lr&gt;<br>
<br>
Thanks!<br>
<br>
-BJ Quinn<br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
</blockquote>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
<br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
<br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
</blockquote>
<br>
<br>
______________________________<u></u>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-<u></u>bin/mailman/listinfo/users</a><br>
</div></div></blockquote></div><br></div>