[sr-dev] [kamailio/kamailio] Kamailio in local network behind NAT (Issue #3173)

lehanich notifications at github.com
Fri Jul 1 13:38:32 CEST 2022


Hello,

I have  kamailio in local network behind NAT. Kamailio have one interface eth1 with ip 10.130.0.23

UserAgent - (internet) - (178.0.0.169)router_NAT - (LAN) - (10.130.0.23)kamailio+rtpproxy - pbx

I made two listeners:
listen=udp:[10.130.0.23:5070](http://10.130.0.23:5070/) #to pbx in lan (I don`t want to put via header with 178.0.0.169)
listen=udp:[10.130.0.23:5060](http://10.130.0.23:5060/) advertise [178.0.0.169:5060](http://178.0.0.169:5060/) #to internet (UserAgent need to get via header with 178.0.0.169  )


mhomed = 1 # I think It not useful  for my case

UserAgent send Register and Invite to [178.0.0.169:5060](http://178.0.0.169:5060/), Kamailio get it on udp:[10.130.0.23:5060](http://10.130.0.23:5060/)

Kamailio Relay it to   udp:[10.130.0.23:5070](http://10.130.0.23:5070/)

My pbx get requests from  udp:[10.130.0.23:5070](http://10.130.0.23:5070/) with via header 10.130.0.23

Responses to UserAgent go from  udp:[10.130.0.23:5060](http://10.130.0.23:5060/) with via 178.0.0.169


In  RELAY block:
if ($Ru == «udp:10.130.0.23:5070») {
#set_send_socket(«udp:10.130.0.23:5060»);
$fs = «udp:10.130.0.23:5060»;
#force_send_socket(«udp:10.130.0.23:5060»);
} else {
#set_send_socket(«udp:10.130.0.23:5070»);
$fs = «udp:10.130.0.23:5070»;
}
#$fs = «udp:10.130.0.23:5070»;
if (!t_relay()) {
sl_reply_error();
}

route[REGISTRAR] {
...
        if ($rd == "[mydomain.ru](http://mydomain.ru/)" || $rd == "[mydomain2.ru](http://mydomain2.ru/)") {

          set_send_socket("udp:[10.130.0.23:5070](http://10.130.0.23:5070/)");
          add_path();
          route(DISPATCH);
         }
...
}


It works for requests (INVITE and REGISTER) from UserAgent to PBX thought kamailio. But INVITE from my pbx to UserAgent go out only through udp:10.130.0.23:5070,  Kamailio realy it to internet from udp:10.130.0.23:5070

I get error in syslog:  (pv [pv_branch.c:62]: pv_get_branchx_helper(): error accessing branch [0])

I tried set_send_socket(«udp:10.130.0.23:5070»); and $fs = «udp:10.130.0.23:5070»;

Why I can`t relay outgoing requests to internet through another socket?

Thank you.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/3173
You are receiving this because you are subscribed to this thread.

Message ID: <kamailio/kamailio/issues/3173 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20220701/61d4b789/attachment-0001.htm>


More information about the sr-dev mailing list