<div dir="ltr"><pre class="gmail-code">mhomed=1</pre><pre class="gmail-code">Kam will auto select the socket</pre></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 1, 2019 at 1:59 PM David Villasmil <<a href="mailto:david.villasmil.work@gmail.com">david.villasmil.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">anyone? :)<div><div dir="ltr" class="gmail-m_5462607109033714353gmail_signature"><div dir="ltr"><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 1, 2019 at 4:37 PM David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello guys,<div>I have public and private IPs, and i need to force the sending socket replying to internal out externals endpoint, so i'm using this:</div><div><br></div><div>function to check the destination (i tried using $sndto(ip) but it always returns NULL):</div><div><font face="monospace, monospace" size="1"><br></font></div><div><div><font face="monospace, monospace" size="1">route[CHECK_DEST_NET] {</font></div><div><span style="font-family:monospace,monospace;font-size:x-small;white-space:pre-wrap">       </span><span style="font-family:monospace,monospace;font-size:x-small">if ( $du=~"sip:172\..*" ) {</span><br></div><div><span style="font-family:monospace,monospace;font-size:x-small;white-space:pre-wrap">           </span><span style="font-family:monospace,monospace;font-size:x-small">setflag(FLAG_TO_PRIVATE);</span><br></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">            </span>xlog("L_ERR", "[CHECK_SOURCE] Packet going to PRIVATE -> [$du]\n" );</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">    </span>} else {</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">               </span>setflag(FLAG_TO_PUBLIC);</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">               </span>xlog("L_ERR", "[CHECK_SOURCE] Packet going to PUBLIC -> [$du]\n" );</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">     </span>}</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">   </span>return;</font></div><div><font face="monospace, monospace" size="1">}</font></div></div><div><br></div><div>on my relay:</div><div><br></div><div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">  </span>route(CHECK_DEST_NET);</font></div><div><font face="monospace, monospace" size="1"><br></font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">      </span>if (isflagset(FLAG_TO_PRIVATE)) {</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">              </span>xlog("L_ERR", "[RELAY] forcing socket to PRIVATE NET\n" );</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">         </span>force_send_socket(LISTEN_INSIDE_IF:LISTEN_INSIDE_PORT);</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">        </span>} else {</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">               </span>xlog("L_ERR", "[RELAY] forcing socket to PUBLIC NET\n" );</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">          </span>force_send_socket(LISTEN_OUTSIDE_IF:LISTEN_OUTSIDE_PORT);</font></div><div><font face="monospace, monospace" size="1"><span style="white-space:pre-wrap">      </span>}</font></div></div><div><br></div><div><br></div><div>This works nicely, except for ACKs and potentially other packets sent statelessly?</div><div><br></div><div>Anyone knows how to fix this?</div><div><br clear="all"><div><div dir="ltr" class="gmail-m_5462607109033714353gmail-m_6502452138919666560gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div></div></div></div></div>
</blockquote></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>