[SR-Users] rport parameter in VIA header in uac remote registration

Jetse Verschuren j.verschuren at vanderventions.nl
Wed Nov 11 21:28:56 CET 2020

Thanks for your quick response,

Unfortunately add_local_rport() didn't work, but
event_route[tm:loal-request] did work. In the end I manually changed the
header (see below), not the prettiest solution, but it works.

event_route [tm:local-request] {
        xlog("L_INFO", "Routing locally generated $rm to $ru\n");

        if (is_method("REGISTER")) {
                xlog("L_INFO", "Adding rhost parameter to REGISTER
                # Add rport parameter to Via header
                assign_hf_value("Via", "$hdr(Via);rport");

Thanks again,

On Wed, Nov 11, 2020 at 9:42 AM Daniel-Constantin Mierla <miconda at gmail.com>

> Hello,
> try to catch uac registrations requests inside
> event_route[tm:local-requests] and use add_local_rport() for them -- not
> sure it works because I haven't tracked in the code, given that
> add_local_rport() was intended for forwarding incoming requests, but it is
> a chance it does.
> Cheers,
> Daniel
> On 11.11.20 08:38, Jetse Verschuren wrote:
> Hi,
> I'm currently trying to connect Kamailio, running in docker, to my
> FritzBox. The FritzBox is the modem provided by my ISP, with a builtin voip
> server which I can use to dial out (basically a PSTN gateway). In my setup
> I have a custom router/firewall/NAT between the FritzBox and the server.
> When I connect LinPhone to the FritzBox, from behind the NAT, it works
> fine. But when I use the Kamailio uac remote registration,  I don't get a
> response. After some investigation with wireshark, I found that the the SIP
> response from the FritzBox comes on the wrong port, and gets rejected by
> the NAT. The request comes from port 1025, but the response is sent to port
> 5060. I compared the requests from LinPhone and Kamailio, and combined with
> some research, found it probably was the rport option in the VIA header.
> From what I read, it basically signals the uas to use the source port to
> reply to, instead of the port indicated in the request, which would be
> necessary to effectively go through a NAT.
> After reading a lot of documentation (and even parts of the source), I
> wasn't able to find an option to enable this option. Is there some option I
> completely missed, or is it not possible? Or am I completely wrong in my
> "diagnosis"?
> Thanks in advance,
> Jetse
> _______________________________________________
> Kamailio (SER) - Users Mailing Listsr-users at lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Funding: https://www.paypal.me/dcmierla
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20201111/f6dce328/attachment.htm>

More information about the sr-users mailing list