Hi Klaus
Thanks for posting the working solution.
You are right that mhomed=1 won't help if the sockets both have same IP address. Though I think if you used it with two different IPs and the correct routing tables on the OS then it would work.
In any case your solution is a good one.
Richard
On 7 January 2013 15:45, Klaus Darilion klaus.mailinglists@pernau.atwrote:
Hi all!
On 04.01.2013 18:57, Ovidiu Sas wrote:
Hello Klauss,
I use record_route_preset for this kind of scenarios: http://kamailio.org/docs/**modules/3.3.x/modules_k/rr.**html#id2550086http://kamailio.org/docs/modules/3.3.x/modules_k/rr.html#id2550086 That was the main reason that I enhanced record_route_preset with the second parameter (see the Note on string2).
I haven't tried your idea with two sockets. Let us know if it's working. If you need to use the same port on the internal and external interface, you could add a new IP to the host and listen on two sockets on the same port and force the socket when sending a request out. listen=udp:10.10.0.2 listen=udp:10.10.0.3 advertise pu.bl.ic.ip
I did some basic tests (incoming, outgoing, on/off-hold). The service provider's SIP trunk was an Asterisk with NAT traversal disabled. Kamailio was NATed 1:1 to the public IP address (exclusively, without port translation). I tested Kamailio only doing near-end NAT-traversal (taking care of its own NAT).
I used two IP addresses for the two sockets, but I must works also with a single IP address and different ports.
Conclusion: works :-)
Following is the setup how I tested it (if you need to add far-end NAT traversal (SIP clients behind another NAT) then it will more complex).
regards Klaus
# Service Provider for SIP Trunk: 5.5.5.5 # public IP address of Kamailio/rtpproxy: 3.3.3.3 # rtpproxy binds to 10.10.0.3 listen=udp:10.10.0.2 listen=udp:10.10.0.3 advertise 3.3.3.3:5060 mhomed=0
route[RELAY] { if (src_ip == 5.5.5.5) { force_send_socket("10.10.0.2")**; rtpproxy_manage("","10.10.0.3"**); } else { force_send_socket("10.10.0.3")**; rtpproxy_manage("","3.3.3.3"); } ... t_relay(); }
onreply_route { if (src_ip == 5.5.5.5) { force_send_socket("10.10.0.2")**; rtpproxy_manage("","10.10.0.3"**); } else { force_send_socket("10.10.0.3")**; rtpproxy_manage("","3.3.3.3");
}
}
______________________________**_________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/**cgi-bin/mailman/listinfo/sr-**usershttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users