[SR-Users] forcing socket doesn't work for ACK

Mauricio Tejeda mtejedas21 at gmail.com
Mon Apr 1 21:07:14 CEST 2019


Hello

Check your reply_route.

An example I use with public and private interfaces and mhomed=1


onreply_route[MANAGE_REPLY] {
xdbg("incoming reply\n");
if(t_check_status("(180|183|200)")){
fix_nated_contact();
}


El lun., 1 de abr. de 2019 12:38 p. m., David Villasmil <
david.villasmil.work at gmail.com> escribió:

> Hello guys,
> 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:
>
> function to check the destination (i tried using $sndto(ip) but it always
> returns NULL):
>
> route[CHECK_DEST_NET] {
> if ( $du=~"sip:172\..*" ) {
> setflag(FLAG_TO_PRIVATE);
> xlog("L_ERR", "[CHECK_SOURCE] Packet going to PRIVATE -> [$du]\n" );
> } else {
> setflag(FLAG_TO_PUBLIC);
> xlog("L_ERR", "[CHECK_SOURCE] Packet going to PUBLIC -> [$du]\n" );
> }
>
> return;
> }
>
> on my relay:
>
> route(CHECK_DEST_NET);
>
> if (isflagset(FLAG_TO_PRIVATE)) {
> xlog("L_ERR", "[RELAY] forcing socket to PRIVATE NET\n" );
> force_send_socket(LISTEN_INSIDE_IF:LISTEN_INSIDE_PORT);
> } else {
> xlog("L_ERR", "[RELAY] forcing socket to PUBLIC NET\n" );
> force_send_socket(LISTEN_OUTSIDE_IF:LISTEN_OUTSIDE_PORT);
> }
>
>
> This works nicely, except for ACKs and potentially other packets sent
> statelessly?
>
> Anyone knows how to fix this?
>
> Regards,
>
> David Villasmil
> email: david.villasmil.work at gmail.com
> phone: +34669448337
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190401/3d177c76/attachment.html>


More information about the sr-users mailing list