Hi gentlemen,

I'm having a bit of a hard time developing a bridge for media sessions.

I have a box with 2 interfaces; eth0 has the private IP p.r.i.v and eth1 has public IP p.u.b.l.

When I receive a message in the private IP I try sending the call to a public proxy we have (p.u.b.2) using Carrierroute module but the source IP used is p.r.i.v. It is obvious that p.u.b.2 will not be able to route back messages.

#
U 192.168.200.11:5060 -> p.r.i.v:5060
INVITE sip:1568767139@p.r.i.v SIP/2.0.
Via: SIP/2.0/UDP 192.168.200.11:5060;branch=z9hG4bK5d94bc09.
From: "60911000" <sip:60911000@p.r.i.v>;tag=as6d477d46.
To: <sip:1568767139@p.r.i.v>.
Contact: <sip:60911000@192.168.200.11>.
...

#
U p.r.i.v:5060 -> p.u.b.2:5060
INVITE sip:1568767139@p.u.b.2 SIP/2.0.
Record-Route: <sip:p.r.i.v;lr=on;ftag=as6d477d46>.
Via: SIP/2.0/UDP p.r.i.v;branch=z9hG4bKf531.440788e1.0.
Via: SIP/2.0/UDP 192.168.200.11:5060;rport=5060;received=192.168.200.11;branch=z9hG4bK5d94bc09.
From: "60911000" <sip:60911000@p.r.i.v>;tag=as6d477d46.
To: <sip:1568767139@p.r.i.v>.
Contact: <sip:60911000@192.168.200.11>.
...

I try then to set listen=0.0.0.0 so kamailio will be binded to all IPs but then the Route headers and Via use this 0.0.0.0

#
U 192.168.200.11:5060 -> p.r.i.v:5060
INVITE sip:1568767139@p.r.i.v SIP/2.0.
Via: SIP/2.0/UDP 192.168.200.11:5060;branch=z9hG4bK14a00df7.
From: "60911000" <sip:60911000@p.r.i.v>;tag=as502405cf.
To: <sip:1568767139@p.r.i.v>.
Contact: <sip:60911000@192.168.200.11>.
...

#
U p.u.b.l:5060 -> p.u.b.2:5060
INVITE sip:1568767139@p.u.b.2 SIP/2.0.
Record-Route: <sip:0.0.0.0;lr=on;ftag=as502405cf>.
Via: SIP/2.0/UDP 0.0.0.0;branch=z9hG4bK711b.8d28549.0.
Via: SIP/2.0/UDP 192.168.200.11:5060;rport=5060;received=192.168.200.11;branch=z9hG4bK14a00df7.
From: "60911000" <sip:60911000@p.r.i.v>;tag=as502405cf.
To: <sip:1568767139@p.r.i.v>.
Contact: <sip:60911000@192.168.200.11>.
...

In this case the destination UA cannot return the call because it does not have a valid IP to do so.

Is there any way to make Kamailio act in a different way? Like letting me modify the IP it will use for Via and Record-Route headers. Be aware that I'm supposed to do some kind of mirror for calls coming from outside the network (origin is public and destination is private).

I'm sure I'll be asking some more on this same thread as I test.

Thanks in advance!
Uriel