[SR-Users] Kamailio behind NAT
Алексей Якимкин
ayakimkin at gmail.com
Fri Jul 8 14:31:53 CEST 2022
I`ve solved this issue. The condition if ($Ru == «*udp*:10.130.0.23:5070»)
was wrong.
Here is the correct code:
if ($Ru eq "sip:10.130.0.23:5070") {
$fs = "udp:10.130.0.23:5060";
} else {
$fs = "udp:10.130.0.23:5070";
}
пт, 1 июл. 2022 г. в 15:17, Алексей Якимкин <ayakimkin at gmail.com>:
> Hello,
>
> Are you ips (LAN_IP and WAN_IP) on sepparate interfaces?
>
> I use add_path for Register requests. It insert header Path:
> <sip:10.130.0.23:5070;lr>
>
> My pbx calls to User-Agent throught 10.130.0.23:5070. INVITE(from
> kamailio) go out to internet from 10.130.0.23:5070
>
> This line "$fs = «udp:10.130.0.23:5060»;" don`t work, It produces an
> error:
> (pv [pv_branch.c:62]: pv_get_branchx_helper(): error accessing branch [0])
>
>
> ср, 29 июн. 2022 г. в 18:55, ZZ Wave <zzwave at gmail.com>:
>
>> I use this with NATed Kamailio and Asterisk for "transparent"
>> registrations:
>>
>> if (is_method("REGISTER")) {
>> add_path();
>> }
>> if ($Ri=="LAN_IP") {
>> $fs="udp:WAN_IP:5060";
>> } else {
>> $fs="udp:LAN_IP:5060";
>> }
>>
>> AFAIK FreeSwitch supports Path as well but Yate doesn't
>>
>> ср, 29 июн. 2022 г. в 12:25, Алексей Якимкин <ayakimkin at gmail.com>:
>>
>>> 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_with_NAT - (LAN) -
>>> kamailio+rtpproxy - pbx
>>>
>>> I made two listeners:
>>> listen=udp: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 advertise 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, Kamailio get it
>>> on udp:10.130.0.23:5060
>>>
>>> Kamailio Relay it to udp:10.130.0.23:5070
>>>
>>> My pbx get requests from udp:10.130.0.23:5070 with via header
>>> 10.130.0.23
>>>
>>> Responses to UserAgent go from udp: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" || $rd == "mydomain2.ru") {
>>>
>>> set_send_socket("udp:10.130.0.23:5070");
>>>
>>> }
>>>
>>> }
>>>
>>>
>>> It works for requests from UserAgent to PBX. But INVITE from my pbx to
>>> UserAgent goes 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?
>>>
>>>
>>> --
>>>
>>> Best regards,
>>> Alex
>>>
>>> __________________________________________________________
>>> Kamailio - Users Mailing List - Non Commercial Discussions
>>> * sr-users at lists.kamailio.org
>>> Important: keep the mailing list in the recipients, do not reply only to
>>> the sender!
>>> Edit mailing list options or unsubscribe:
>>> * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>> __________________________________________________________
>> Kamailio - Users Mailing List - Non Commercial Discussions
>> * sr-users at lists.kamailio.org
>> Important: keep the mailing list in the recipients, do not reply only to
>> the sender!
>> Edit mailing list options or unsubscribe:
>> * 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/20220708/3728a8a8/attachment.htm>
More information about the sr-users
mailing list