<div dir="auto"><div>Hello<div dir="auto"><br></div><div dir="auto">Check your reply_route.</div><div dir="auto"><br></div><div dir="auto">An example I use with public and private interfaces and mhomed=1</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div style="color:rgb(33,33,33);font-family:-apple-system,helveticaneue;font-size:16px" dir="auto">onreply_route[MANAGE_REPLY] {</div><div style="color:rgb(33,33,33);font-family:-apple-system,helveticaneue;font-size:16px" dir="auto">xdbg("incoming reply\n");</div><div style="color:rgb(33,33,33);font-family:-apple-system,helveticaneue;font-size:16px" dir="auto">if(t_check_status("(180|183|200)")){</div><div style="color:rgb(33,33,33);font-family:-apple-system,helveticaneue;font-size:16px" dir="auto">fix_nated_contact();</div><div style="color:rgb(33,33,33);font-family:-apple-system,helveticaneue;font-size:16px" dir="auto">}</div></div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El lun., 1 de abr. de 2019 12:38 p. m., David Villasmil <<a href="mailto:david.villasmil.work@gmail.com">david.villasmil.work@gmail.com</a>> escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;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="m_4178714406628837214gmail_signature"><div dir="ltr"><div>Regards,</div><div><br></div>David Villasmil<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank" rel="noreferrer">david.villasmil.work@gmail.com</a></div><div>phone: +34669448337</div></div></div></div></div></div></div></div>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank" rel="noreferrer">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div></div></div>