[SR-Users] Kamailio : Listening on multiple ports behind NAT

Reda Aouad reda.aouad at gmail.com
Mon Jan 16 15:41:25 CET 2012


Hello,

I am trying to implement the following configuration :

- Kamailio as a SIP proxy/registrar behind a one-to-one NAT (port number is
not modified) listening on ports 5060 and 53 (and more ports in the future)
- aliases correctly configured :
    alias= udp: public_ip:53
    alias= udp: public_ip:5060
    alias= udp: hostname:53
    alias= udp: hostname:5060
- listen directive correctly on private ip address and both ports :
    listen=udp:private_ip:53
    listen=udp:private_ip:5060
- advertised_address=public_ip
- record_route_preset("public_ip") is used to announce the public IP
address in the RR header
- user A : registered on port 5060
- user B : registered on port 53

Suppose user A tries to call user B.

The Record-Route header in the INVITE forwarded from Kamailio to user B
should contain the port number on which user B is connected (53), to force
user B to send future requests to that port number. But I have no method to
know which port user B is connected to, and that problem is aggravated when
user B has multiple registrations on different port numbers and parralel
forking is done. Declaring advertised_port doesn't solve the problem. I
cannot force port number 53 in record_route_preset("public_ip:53") since it
wouldn't work when user B calls user A. Using the record_route( ) function,
Kamailio doesn't use the advertised_address to construct the RR header.

Another problem is that the record_route_preset function clears the DID
cookie set by the dialog module, which makes Kamailio fallback to SIP
elements to match the request to an existing dialog, thus dialog matching
becomes slower, and performance is an issue for me.

Any suggestions? I know that one solution would be to run Kamailio with a
public IP address and no NAT, but unfortunately it's not possible.

I suggest that the function record_route( ) takes a public IP address as a
parameter, still doing what it does (correct record routing and cookie
addition did=xxx and loose route lr=on), but only replacing the private IP
address on which Kamailio listens with a public IP address. Or that the
record_route( ) function uses the advertised_address to construct the RR
header.

Thank you
RA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120116/c5151fa6/attachment-0001.htm>


More information about the sr-users mailing list