[SR-Users] How to statelessly send a reply to custom destination?

Daniel-Constantin Mierla miconda at gmail.com
Fri Jul 5 10:34:23 CEST 2019


Hello,

if you want to send the reply to the source ip/port, not the address in
the top Via header, then do:

force_rport();

sl_send_reply(...);

Cheers,
Daniel

On 05.07.19 10:27, George Diamantopoulos wrote:
> Thank you for the reply Karsten!
>
> I'm afraid the options_reply() function won't work for me. The reason
> is that it seems to only handle OPTIONS where the RURI username is not
> set, and in my case I need to be able to handle these cases.
>
> Moreover, it is not evident from the siputils module documentation if
> it will perform NAT traversal on the side of kamailio, which is my
> original problem. I'm beginning to think I can't serve NATted
> endpoints' requests statelessly and that I'd have to handle the reply
> statefully, am I right in thinking that?
>
> BR,
> George
>
> On Fri, 5 Jul 2019 at 09:37, Karsten Horsmann <khorsmann at gmail.com
> <mailto:khorsmann at gmail.com>> wrote:
>
>     Hi George,
>
>     i use something like that (shameless stolen from other
>     configuration files within request-route).
>
>     Thats for answering options to my internal kamailio.
>     But Alex Balashov wrote an nice blog poste about NAT/OPTION Pings 
>     with
>     kamailio: http://www.evaristesys.com/blog/server-side-nat-traversal-with-kamailio-the-definitive-guide/
>
>         ### only initial requests (no To tag)
>         if (is_method("OPTIONS"))
>         {
>             if (uri=~"sip:.*[@]+.*")  {
>                 sl_send_reply("501", "Not Implemented");
>             }
>             else {
>                 options_reply();
>                 exit;
>             }
>         }
>
>     Cheers Karsten
>
>     Am Do., 4. Juli 2019 um 10:29 Uhr schrieb George Diamantopoulos
>     <georgediam at gmail.com <mailto:georgediam at gmail.com>>:
>
>         Hello all,
>
>         I've been trying to handle OPTIONS statelessly, but proper
>         handling fails for UACs behind NAT without ALG. I thought I'd
>         overcome this by setting the $du pseudovariable, but
>         apparently I'm missing something. The following does not work:
>
>                 if ($Rp == "6050") {
>                     force_send_socket(udp:10.10.10.10:6050
>         <http://10.10.10.10:6050>);
>                 }
>                 $du = "sip:" + $si + ":" + $sp;
>                 sl_send_reply("200","OK");
>                 exit;
>
>         I'm now realising that I put this in request_route() so
>         force_send_socket() and $du have no use whatsoever, since the
>         request is not forwarded anywhere. Is this the reason?
>
>         So the question is, how can I do the following things for a
>         stateless reply: a) choose a sending socket for the reply and
>         b) change the destination for the reply to something other
>         than the URI in the first Via header.
>
>         Thanks!
>
>         BR,
>         George
>         _______________________________________________
>         Kamailio (SER) - Users Mailing List
>         sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>         https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
>
>     -- 
>     Mit freundlichen Grüßen
>     *Karsten Horsmann*
>     _______________________________________________
>     Kamailio (SER) - Users Mailing List
>     sr-users at lists.kamailio.org <mailto:sr-users at lists.kamailio.org>
>     https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190705/51187757/attachment.html>


More information about the sr-users mailing list