[SR-Users] Kamailio and NAT

Gholamreza Sabery gr.sabery at gmail.com
Wed Jan 13 12:59:18 CET 2016


When you are running Kamailio behind a NAT you should use advertise
parameter of listen address. According to documentation " A typical use
case for advertise address is when running SIP server behind a
NAT/Firewall, when the local IP address (to be used for bind) is different
than the public IP address (to be used for advertising).". For example:

listen=udp:10.10.10.10:5060 advertise  11.11.11.11:5060

For more info refer to http://www.kamailio.org/wiki/cookbooks/3.3.x/core#listen

Regards

Gholamreza Sabery Tabrizy



On Wed, Jan 13, 2016 at 2:39 AM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

> Hello,
>
> can you get the SIP trace with all the packets of such dialog outside of
> the NAT router? It will help to see the headers and based on that we may be
> able to provide a solution.
>
> Cheers,
> Daniel
>
>
> On 12/01/16 19:13, Nelson Migliaro wrote:
>
> Thank you for your answer.
>
> The problem I have is with internet router doing to PAT to SIP port.
> I am already advertising public IP but unfortunately I cant know the
> public port I am using.
>
> 2015-12-28 18:17 GMT+01:00 Alexandru Covalschi <568691 at gmail.com>:
>
>> AFAIK bye is usually sent to the address stored in record_route. Try
>> setting changing record_route() to
>> record_route_preset("PUBLICIP:5060;nat=yes:)
>>
>> 2015-12-23 16:28 GMT+02:00 Nelson Migliaro < <eng.migliaro at gmail.com>
>> eng.migliaro at gmail.com>:
>>
>>>
>>> Hello,
>>>
>>> I am running Kamailio behind NAT.
>>>
>>> Kanailio has a private IP and I am relaying NAT to internet router.
>>>
>>> I am using:
>>>
>>> - #!define WITH_NAT
>>> - listen=udp:PRIVATE-IP:5060 advertise PUBLIC-IP:5060
>>>
>>> - Patched RTP proxy including the advertise option
>>>
>>> And everything goes fine. I can make calls and have two way audio.
>>>
>>> The problem begins when the callee ends the call. BYE is not received in
>>> Kamailio (caller)
>>>
>>> I included the public IP using "add_contact_alias" because
>>> "set_contact_alias" was not adding the public IP. I included this in in
>>> NATDETECT (pre loaded router)
>>>
>>>         if(is_first_hop()) {
>>>             xlog("L_NOTICE","Metodo: $rm \n");
>>>             xlog("L_NOTICE","is first hop\n");
>>>             #set_contact_alias();
>>>                  if (!add_contact_alias("PUBLIC-IP", "$Rp", "udp")) {
>>>                  xlog("L_ERR", "Error in aliasing contact $ct\n");
>>>                     send_reply("400", "Bad request");
>>>                             exit;
>>>                     }
>>>         }
>>>
>>> I think the problem is related to destination that BYE is sent by the
>>> vendor. From what I see IP and port is taken from advertised in contact
>>> (PUBLIC-IP and 5060).
>>> The problem is that internet router changes the source port.
>>>
>>> Contact: <sip:999999999 at PRIVATE-IP:5060;alias=PUBLIC-IP~5060~1>
>>>
>>> --- Is it correcto to add_contact_alias("PUBLIC-IP", "$Rp", "udp") in
>>> order to received new transactions or should I follow a different
>>> procedure???
>>>
>>> Thank you
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>> sr-users at lists.sip-router.org
>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>>
>>
>>
>> --
>> Alexandru Covalschi
>> ABRISS-Solutions
>> VoIP engineer and system administrator
>> phone: +37367398493
>> web: http://abs-telecom.com/
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users at lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Book: SIP Routing With Kamailio - http://www.asipto.comhttp://miconda.eu
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160113/31773a37/attachment.html>


More information about the sr-users mailing list