Hello Dmitry, 

I was wondering if you got this working? I'm facing a similar scenario and I don't know if it's worth going this path vs having a second port on internal IP without advertise just for internal traffic.... ?

Thanks, 
Joel.

On Mon, Dec 17, 2018 at 3:55 AM Dmitry Sytchev <kbdfck@gmail.com> wrote:
Yes, I'm handling external IP with domain module, so I'm matching it
as 'myself'.
I'll try to do it this way.

Thank you, Daniel!

пн, 17 дек. 2018 г. в 14:49, Daniel-Constantin Mierla <miconda@gmail.com>:
>
>
> On 17.12.18 12:37, Daniel-Constantin Mierla wrote:
> > Hello,
> >
> >
> > On 17.12.18 11:38, Dmitry Sytchev wrote:
> >> Hi all!
> >> I have a question that arises in mailing list sometimes, but it is
> >> still not clear for me how to work with this.
> >>
> >> We have AWS instance with standard Amazon bi-nat, so basically
> >> communication with external hosts works with
> >> listen udp:ip:port advertise ip:port
> >>
> >> But in case when we need to send external call to internal network by
> >> internal ip addresses, we want to have internal host in record-route.
> >> As far as I understand, basic recommendation is to use separate port
> >> or internal address and select it with appropriate function.
> >>
> >> Maybe it is more theoretical question, but can we do something to
> >> generate correct record-routes and VIA for calls coming from external
> >> network to make their softswitches happy, and still maintain internal
> >> address in messages going to internal hosts, using single host and
> >> port on Kamailio behind nat?
> > you can do also without setting advertise address for a listen socket.
> > Just listen on local IP and then you have to use
> > set_advertise_address(...) to set the IP in Via and
> > record_route_preset(...) to set the Record-Route header.
> >
> > Only that the config becomes a bit more complex, you have to add IF
> > conditions when to add private or public IP addresses there.
>
> One thing I forgot: the public IP has to be treated as local IP (to
> match against 'myself'), so you have to do conditions on it -- either
> directly in the config conditions, or adding an alias or using domain
> module.
>
> Cheers,
> Daniel
>
> --
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> Kamailio World Conference - May 6-8, 2019 -- www.kamailioworld.com
> Kamailio Advanced Training - Mar 4-6, 2019 -- www.asipto.com
>


--
Best regards,

Dmitry Sytchev,
IT Engineer

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users