<div dir="ltr"><div>Hi again,<br><br></div>Well I have read a bit more about the modes and yes, we use brigde mode as OpenSIPS is behind both sides of the NAT not only on the WAN side,  OpenSIPs is within the firewall,<br><div class="gmail_extra"><br></div><div class="gmail_extra">So basically the engage_rtp_proxy is not a good idea.<br><br><div><div>route[1] {</div><div><span style="white-space:pre-wrap">        </span>if(!cache_fetch(&quot;local&quot;, &quot;outerip_$var(destinationIp)&quot;, $avp(outerIp))) {</div><div><span style="white-space:pre-wrap">                </span>get_outer_ip(&quot;$var(destinationIp)&quot;, &quot;$avp(outerIp)&quot;);</div><div><span style="white-space:pre-wrap">                </span>cache_store(&quot;local&quot;, &quot;outerip_$var(destinationIp)&quot;, &quot;$avp(outerIp)&quot;, 10);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>$fs = $proto + &quot;:&quot; + $avp(outerIp);</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;BYE|CANCEL&quot;)) {</div><div><span style="white-space:pre-wrap">                </span>unforce_rtp_proxy();</div><div><span style="white-space:pre-wrap">        </span>} else if (is_method(&quot;INVITE&quot;)){</div><span class="im"><div><span style="white-space:pre-wrap">                </span>if (has_body(&quot;application/sdp&quot;)) {</div><div><span style="white-space:pre-wrap">                        </span>$var(trustconnectionip) = &quot;%TRUSTCONNECTIONIP%&quot;;</div><div><span style="white-space:pre-wrap">                        </span>$var(ciptrusted) = &quot;no&quot;;</div><div><span style="white-space:pre-wrap">                        </span>if ($var(trustconnectionip)==&quot;yes&quot;) {</div><div><span style="white-space:pre-wrap">                                </span>$var(ciptrusted) = &quot;yes&quot;;</div><div><span style="white-space:pre-wrap">                        </span>} else if ($var(trustconnectionip)==&quot;auto&quot;) {</div><div><span style="white-space:pre-wrap">                                </span>$var(sdpc) = $(rb{sdp.line,c}{s.substr,9,0});</div><div><span style="white-space:pre-wrap">                                </span>if($td == $fd &amp;&amp; $td != $var(sdpc)) {</div><div><span style="white-space:pre-wrap">                                        </span>$var(ciptrusted) = &quot;yes&quot;;</div><div><span style="white-space:pre-wrap">                                </span>}</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span>if ($var(ciptrusted)==&quot;yes&quot;) {</div><div><span style="white-space:pre-wrap">                                </span>rtpproxy_offer(&quot;focnr&quot;);</div><div><span style="white-space:pre-wrap">                        </span>} else {</div><div><span style="white-space:pre-wrap">                                        </span>rtpproxy_offer(&quot;focn&quot;);</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div></span><div><span style="white-space:pre-wrap">        </span># Prevent $var(destinationPort) from getting default port number 5060 for TLS if no port specified in R-URI.</div><div><span style="white-space:pre-wrap">        </span>if($(ru{uri.port})==&quot;&quot; &amp;&amp; $proto==&quot;tls&quot; &amp;&amp; $var(destinationPort)==&quot;5060&quot;) {</div><div><span style="white-space:pre-wrap">                </span>$var(destinationPort) = 5061;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span># force the transport protocol to the same one the client used</div><div><span style="white-space:pre-wrap">        </span>$du = &quot;sip:&quot;+$var(destinationIp)+&quot;:&quot;+$var(destinationPort)+&quot;;transport=&quot;+$proto;</div><div><br></div><div><span style="white-space:pre-wrap">        </span>t_on_reply(&quot;1&quot;);</div><div><br></div><div><span style="white-space:pre-wrap">        </span># for INVITEs enable some additional helper routes</div><div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;INVITE&quot;)) {</div><div><span style="white-space:pre-wrap">                </span>t_on_failure(&quot;1&quot;);</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (!t_relay()) {</div><div><span style="white-space:pre-wrap">                </span>xlog(&quot;L_INFO&quot;, &quot;Relay error&quot;);</div><div><span style="white-space:pre-wrap">                </span>sl_reply_error();</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span>exit;</div><div>}</div></div><div><br></div><div>The route[1] is set in the main route under this conditions</div><div><br></div><div><div>if (has_totag()) {</div><div><span style="white-space:pre-wrap">                </span># sequential request within a dialog should</div><div><span style="white-space:pre-wrap">                </span># take the path determined by record-routing</div><div><span style="white-space:pre-wrap">                </span>if (loose_route()) {</div><div><span style="white-space:pre-wrap">                        </span>$var(destinationIp) = $avp(requestIp);</div><div><span style="white-space:pre-wrap">                        </span>$var(destinationPort) = $rp;</div><div><br></div><div><span style="white-space:pre-wrap">                        </span>if (is_method(&quot;INVITE&quot;)) {</div><div><span style="white-space:pre-wrap">                                </span># even if in most of the cases is useless, do RR for</div><div><span style="white-space:pre-wrap">                                </span># re-INVITEs alos, as some buggy clients do change route set</div><div><span style="white-space:pre-wrap">                                </span># during the dialog.</div><div><span style="white-space:pre-wrap">                                </span>record_route();</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span># route it out to whatever destination was set by loose_route()</div><div><span style="white-space:pre-wrap">                        </span># in $du (destination URI).</div><div><span style="white-space:pre-wrap">                        </span>route(1);</div></div><div>...</div><div>       exit;</div><div>}</div><div>....</div><div><br></div><div>And if there is no REGISTER, PUBLISH, CANCEL</div><div><br></div><div>route(1);</div><div>}</div><br></div></div>