Hi,
we have a setup, where we have a TCP loadbalancer, which converts the requests from attached devices using TCP into UDP for the rest of our setup. This loadbalancer has a service IP, and additionally the host IP, it listens to different addresses.
Example: Host IP is: 1.1.1.1 Service IP is: 2.2.2.2 Device is at: 5.5.5.5 Proxy: 9.9.9.9 Gateway: 8.8.8.8
Kamailio listen IPs: tcp:1.1.1.1:15060 (used just for XMLRPC querys) tcp:2.2.2.2:5060 udp:1.1.1.1:5062 udp:2.2.2.2:5060
The Host IP should only be used for some management functions, not for routing.
We've had the problem at first, that when converting from TCP to UDP, Kamailio did not use the same IP but instead the first configured one. I got rid of that by using force_send_socket.
Now I'm calling a registered device. Since the registered device is saved with a path, the request comes in via UDP with the following parameters:
U 2014/05/13 16:15:31.225132 9.9.9.9:5060 -> 2.2.2.2:5060 INVITE sip:user@5.5.5.5:5060;uniq=F373C9746E87D6271688292199F83;transport=tcp SIP/2.0 Record-Route: sip:9.9.9.9;lr Record-Route: sip:2.2.2.2;lr;ftag=as458ff869 Via: SIP/2.0/UDP 9.9.9.9;branch=z9hG4bK17ec.ea7c017baba4072b27c5b0b9daa23346.0 Route: sip:2.2.2.2;lr;received=sip:5.5.5.5:4956%3Btransport%3Dtcp Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bK17ec.7db07192e57ae94739d5c3e1444d7ef3.0 Via: SIP/2.0/UDP 8.8.8.8:5060;branch=z9hG4bK5ba05442
Up until now everything looks good. But this is what the loadbalancer sends out:
T 2014/05/13 16:15:31.226987 2.2.2.2:5060 -> 5.5.5.5:4956 [A] INVITE sip:user@5.5.5.5:5060;uniq=F373C9746E87D6271688292199F83;transport=tcp SIP/2.0 Record-Route: sip:1.1.1.1:15060;transport=tcp;r2=on;lr;ftag=as458ff869 Record-Route: sip:2.2.2.2;r2=on;lr;ftag=as458ff869 Record-Route: sip:9.9.9.9;lr Record-Route: sip:2.2.2.2;lr;ftag=as458ff869 Via: SIP/2.0/TCP 1.1.1.1:15060 ;branch=z9hG4bK17ec.99e285f5a9e03594d3f7ae6048d1868d.0 Via: SIP/2.0/UDP 9.9.9.9;branch=z9hG4bK17ec.ea7c017baba4072b27c5b0b9daa23346.0 Via: SIP/2.0/UDP 2.2.2.2;branch=z9hG4bK17ec.7db07192e57ae94739d5c3e1444d7ef3.0 Via: SIP/2.0/UDP 8.8.8.8:5060;branch=z9hG4bK5ba05442
As you can see, the the packet is sent out through the correct socket. But in RR and Via header it advertises the other TCP socket. This breaks BYEs later on.
Is there some way, I can influence, which IP and port Kamailio writes into those headers? Or is this a bug, that Kamailio doesn't check the sending socket correctly?
Best Regards, Sebastian
Hello Sebastian,
On 05/13/2014 10:36 AM, Sebastian Damm wrote:
Is there some way, I can influence, which IP and port Kamailio writes into those headers? Or is this a bug, that Kamailio doesn't check the sending socket correctly?
Have a look at replacing your record_route() call with record_route_preset():
http://kamailio.org/docs/modules/4.1.x/modules/rr.html#idp114624
As for the advertised address more generally, i.e. in Via, have a look at this core parameter:
http://www.kamailio.org/wiki/cookbooks/4.1.x/core#advertised_address
-- Alex
Hi Alex,
On Tue, May 13, 2014 at 4:39 PM, Alex Balashov abalashov@evaristesys.comwrote:
Have a look at replacing your record_route() call with record_route_preset():
http://kamailio.org/docs/modules/4.1.x/modules/rr.html#idp114624
As for the advertised address more generally, i.e. in Via, have a look at this core parameter:
http://www.kamailio.org/wiki/cookbooks/4.1.x/core#advertised_address
Thanks. I just added the advertised_address parameter as a test, now Kamailio puts the external IP into Via and RR, but still uses the port 15060 from the other socket.
However, the docs say: "If empty or not set (default value) the socket address from where the request will be sent is used."
This is what I would expect, but this is not what's happening. It uses a different socket for the Via and RR header than it actually uses for sending the request out.
I worked around this problem by placing the listen line for the unused TCP connection after the used one, and now it looks a lot better. But I still think, that the Via and RR headers should never differ from the actually used socket, when not using the set_advertised_address function.
Best Regards, Sebastian
Sebastian,
There is also an 'advertised_port' parameter, which might be of aid to you here.
Hi Alex,
yes, I've seen it. But I don't want to use it since I can't set it generally, because this Loadbalancer also serves TLS, and TLS uses a different port.
Any comments about this difference between the sending socket vs. the advertised socket when not configured specially?
Best Regards, Sebastian http://www.sipgate.co.uk
Hello,
do you have mhomed=1? In that case, kernel routing rules are returning what interface is the one to use -- kamailio does some temporary sockets to retrieve the interface from kernel.
Cheers, Daniel
On 13/05/14 18:02, Sebastian Damm wrote:
Hi Alex,
yes, I've seen it. But I don't want to use it since I can't set it generally, because this Loadbalancer also serves TLS, and TLS uses a different port.
Any comments about this difference between the sending socket vs. the advertised socket when not configured specially?
Best Regards, Sebastian
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-users
Hi Daniel,
unless mhomed is set to 1 by default, I don't have it set. At which time is the IP for RR and Via headers determined? Before sending out? It looks to me that it is determined a lot earlier, thus not using the value from the socket the packet actually gets sent out at the end.
Best Regards, Sebastian
On Tue, May 13, 2014 at 8:38 PM, Daniel-Constantin Mierla <miconda@gmail.com
wrote:
Hello,
do you have mhomed=1? In that case, kernel routing rules are returning what interface is the one to use -- kamailio does some temporary sockets to retrieve the interface from kernel.
Cheers, Daniel
On 13/05/14 18:02, Sebastian Damm wrote:
Hi Alex,
yes, I've seen it. But I don't want to use it since I can't set it generally, because this Loadbalancer also serves TLS, and TLS uses a different port.
Any comments about this difference between the sending socket vs. the advertised socket when not configured specially?
Best Regards, Sebastian
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users@lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
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-users