Hi,
I'm trying to set up a HA-OBP for both natted and non-natted users.
Atm my setup looks like that:
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
At the loadbalancer I use add_path and add_path_received to add a path-header to the request sent to the Registrar. (Of course only for register requests). I use a few parameters for telling the registrar module to use the path header. When looking in the mysql-db I can see the correct value in the path-field in the location-table.
When getting an invite from the PSTN gateway for one of the UAC's the Proxy is adding a route-header according to the path-value in the mysql. That seems also correct. Now to my problem:
The loadbalancer is sending out the INVITE to the private-ip, not to the public-nat-ip of the UAC. It seems that the received-parameter in the Route-header is somehow ignored. I am using the use_received parameter in the loadbalancer, but it does not work.
In the following you can find the SIP trace (made on the loadbalancer) and the loadbalancer config, since I think there is the problem.
Thanks,
Florian
Here is the SIP-trace of the INVITE:
09:49:07.785294 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP, length: 1101 E..i..@.?.Yb..,F..,+.....U.BINVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 69 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 312
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [PSTN Gateway] t=0 0 m=audio 19178 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv
09:49:07.786459 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP, length: 445 E.....@.@.Z...,+..,F........SIP/2.0 100 Giving a try Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Proxy+Registrar] Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:07.786608 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:08.258116 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:09.258109 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:11.258107 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:15.023388 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP, length: 397 E.....@.?."..,F..,+......a.CANCEL sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar] CSeq: 102 CANCEL Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
09:49:15.024138 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP, length: 413 E.....@.@.[...,+..,F........SIP/2.0 200 canceling Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Proxy+Registrar] From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec9825e-db87 CSeq: 102 CANCEL Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.024576 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP, length: 493 E.. ..@.@.Z...,+..,F........SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Proxy+Registrar] Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec9825e-db87 Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.025180 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP, length: 433 E.....@.?.[...,F..,+.......MACK sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec9825e-db87 CSeq: 102 ACK Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
----------------This is the config of my loadbalancer--------------------:
####### Global Parameters #########
debug=100 log_stderror=yes log_facility=LOG_LOCAL0
fork=no children=4
disable_tcp=yes
port=5060
listen=[Loadbalancer]
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "nathelper.so" loadmodule "dispatcher.so" loadmodule "path.so"
# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs #modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) #modparam("rr", "append_fromtag", 0)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "/var/run/rtpproxy/rtpproxy.sock") modparam("nathelper", "received_avp", "$avp(i:80)")
# -- dispatcher params -- modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
# -- path params -- modparam("path", "use_received", 1)
####### Routing Logic ########
# main request routing logic
route{ xlog("L_ALERT", "[$rm] from [$fu] to [$tu]\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
# NAT detection route(4);
if (has_totag()) { xlog("L_ALERT", "_____HASTOTAG [$rm] from [$fu] to [$tu]\n"); # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("L_ALERT", "_____LOOSE_ROUTE [$rm] from [$fu] to [$tu]\n"); t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { xlog("L_ALERT", "_____NON-LOOSE, STATEFUL-ACK [$rm] from [$fu] to [$tu]\n"); # non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server t_relay(); exit; } else { xlog("L_ALERT", "_____ACK_WITHOUT_TRANSACTION [$rm] from [$fu] to [$tu]\n"); # ACK without matching transaction ... ignore and discard.\n"); exit; } } sl_send_reply("404","Not here"); } exit; }
#initial requests
# CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; }
t_check_trans();
# record routing if (!is_method("REGISTER|MESSAGE")) xlog("L_ALERT", "_____RECORD_ROUTING [$rm] from [$fu] to [$tu]\n"); record_route();
#if ($rU==NULL) { # # request with no Username in RURI # sl_send_reply("484","Address Incomplete"); # exit; #}
if (check_route_param("nat=yes")) { setbflag(6); } #if (isflagset(5) || isbflagset(6)) { route(5); #}
/* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("1"); t_on_failure("1"); }
if(!ds_is_from_list()) { ds_select_domain("0", "0"); } if (!t_relay()) { sl_reply_error(); } }
# Caller NAT detection route route[4]{ force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { add_path_received(); fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } else { add_path(); } return; }
# RTPProxy control route[5] { if (is_method("BYE")) { unforce_rtp_proxy(); } else if (is_method("INVITE")){ force_rtp_proxy(); } if (!has_totag()) add_rr_param(";nat=yes"); return; }
onreply_route[1] { xdbg("incoming reply\n");
#if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") { if (status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } if (isbflagset(6)) { fix_nated_contact(); } }
failure_route[1] { #if (is_method("INVITE") && (isbflagset(6) || isflagset(5))) { if (is_method("INVITE")) { unforce_rtp_proxy(); }
if (t_was_cancelled()) { exit; } }
The request sent out by the LB still has the Route header. This indicates that either: - the load balancer does not detect the domain/IP in the Route header as an internal one (alias=....) - the loose_route function is not called in the LB.
regards klaus
Florian Meister schrieb:
Hi,
I'm trying to set up a HA-OBP for both natted and non-natted users.
Atm my setup looks like that:
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
At the loadbalancer I use add_path and add_path_received to add a path-header to the request sent to the Registrar. (Of course only for register requests). I use a few parameters for telling the registrar module to use the path header. When looking in the mysql-db I can see the correct value in the path-field in the location-table.
When getting an invite from the PSTN gateway for one of the UAC's the Proxy is adding a route-header according to the path-value in the mysql. That seems also correct. Now to my problem:
The loadbalancer is sending out the INVITE to the private-ip, not to the public-nat-ip of the UAC. It seems that the received-parameter in the Route-header is somehow ignored. I am using the use_received parameter in the loadbalancer, but it does not work.
In the following you can find the SIP trace (made on the loadbalancer) and the loadbalancer config, since I think there is the problem.
Thanks,
Florian
Here is the SIP-trace of the INVITE:
09:49:07.785294 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP, length: 1101 E..i..@.?.Yb..,F..,+.....U.BINVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 69 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 312
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [PSTN Gateway] t=0 0 m=audio 19178 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv
09:49:07.786459 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP, length: 445 E.....@.@.Z...,+..,F........SIP/2.0 100 Giving a try Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Proxy+Registrar] Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:07.786608 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:08.258116 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:09.258109 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:11.258107 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060: SIP, length: 1307 E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP [Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of UAC]:64224"> Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:15.023388 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP, length: 397 E.....@.?."..,F..,+......a.CANCEL sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar] CSeq: 102 CANCEL Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
09:49:15.024138 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP, length: 413 E.....@.@.[...,+..,F........SIP/2.0 200 canceling Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Proxy+Registrar] From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec9825e-db87 CSeq: 102 CANCEL Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.024576 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP, length: 493 E.. ..@.@.Z...,+..,F........SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Proxy+Registrar] Via: SIP/2.0/UDP [PSTN Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e To: sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec9825e-db87 Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.025180 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP, length: 433 E.....@.?.[...,F..,+.......MACK sip:435572949012@[PRIVATE IP of UAC];user=phone SIP/2.0 Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN Gateway]>;tag=as33339e2e Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec9825e-db87 CSeq: 102 ACK Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
----------------This is the config of my loadbalancer--------------------:
####### Global Parameters #########
debug=100 log_stderror=yes log_facility=LOG_LOCAL0
fork=no children=4
disable_tcp=yes
port=5060
listen=[Loadbalancer]
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "nathelper.so" loadmodule "dispatcher.so" loadmodule "path.so"
# ----------------- setting module-specific parameters ---------------
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs #modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) #modparam("rr", "append_fromtag", 0)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "/var/run/rtpproxy/rtpproxy.sock") modparam("nathelper", "received_avp", "$avp(i:80)")
# -- dispatcher params -- modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
# -- path params -- modparam("path", "use_received", 1)
####### Routing Logic ########
# main request routing logic
route{ xlog("L_ALERT", "[$rm] from [$fu] to [$tu]\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
# NAT detection route(4); if (has_totag()) { xlog("L_ALERT", "_____HASTOTAG [$rm] from [$fu] to [$tu]\n"); # sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("L_ALERT", "_____LOOSE_ROUTE [$rm] from [$fu] to [$tu]\n"); t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { xlog("L_ALERT", "_____NON-LOOSE, STATEFUL-ACK [$rm] from [$fu] to [$tu]\n"); # non loose-route, but stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server t_relay(); exit; } else { xlog("L_ALERT", "_____ACK_WITHOUT_TRANSACTION [$rm] from [$fu] to [$tu]\n"); # ACK without matching transaction ... ignore and discard.\n"); exit; } } sl_send_reply("404","Not here"); } exit; } #initial requests # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } t_check_trans(); # record routing if (!is_method("REGISTER|MESSAGE")) xlog("L_ALERT", "_____RECORD_ROUTING [$rm] from [$fu] to [$tu]\n"); record_route(); #if ($rU==NULL) { # # request with no Username in RURI # sl_send_reply("484","Address Incomplete"); # exit; #} if (check_route_param("nat=yes")) { setbflag(6); } #if (isflagset(5) || isbflagset(6)) { route(5); #} /* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("1"); t_on_failure("1"); } if(!ds_is_from_list()) { ds_select_domain("0", "0"); } if (!t_relay()) { sl_reply_error(); }
}
# Caller NAT detection route route[4]{ force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { add_path_received(); fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } else { add_path(); } return; }
# RTPProxy control route[5] { if (is_method("BYE")) { unforce_rtp_proxy(); } else if (is_method("INVITE")){ force_rtp_proxy(); } if (!has_totag()) add_rr_param(";nat=yes"); return; }
onreply_route[1] { xdbg("incoming reply\n");
#if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-9][0-9])") { if (status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } if (isbflagset(6)) { fix_nated_contact(); }
}
failure_route[1] { #if (is_method("INVITE") && (isbflagset(6) || isflagset(5))) { if (is_method("INVITE")) { unforce_rtp_proxy(); }
if (t_was_cancelled()) { exit; }
}
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
The request sent out by the LB still has the Route header. This indicates that either:
- the load balancer does not detect the domain/IP in the Route header
as an internal one (alias=....)
- the loose_route function is not called in the LB.
Many thanks ! I did not call loose_route in the LB, I think that will solve it.
Best regards,
Florian
Florian Meister schrieb:
Hi,
I'm trying to set up a HA-OBP for both natted and non-natted users.
Atm my setup looks like that:
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
At the loadbalancer I use add_path and add_path_received to add a
path-header to the request sent to the Registrar. (Of course only for register requests). I use a few parameters for telling the registrar module to use the path header. When looking in the mysql-db I can see the correct value in the path-field in the location-table.
When getting an invite from the PSTN gateway for one of the UAC's the
Proxy is adding a route-header according to the path-value in the mysql. That seems also correct. Now to my problem:
The loadbalancer is sending out the INVITE to the private-ip, not to
the public-nat-ip of the UAC. It seems that the received-parameter in the Route-header is somehow ignored. I am using the use_received parameter in the loadbalancer, but it does not work.
In the following you can find the SIP trace (made on the
loadbalancer) and the loadbalancer config, since I think there is the problem.
Thanks,
Florian
Here is the SIP-trace of the INVITE:
09:49:07.785294 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP,
length: 1101
E..i..@.?.Yb..,F..,+.....U.BINVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 69 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 312
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [PSTN Gateway] t=0 0 m=audio 19178 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv
09:49:07.786459 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP,
length: 445
E.....@.@.Z...,+..,F........SIP/2.0 100 Giving a try Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:07.786608 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3 d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:08.258116 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3 d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:09.258109 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3 d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:11.258107 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3 d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:15.023388 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP,
length: 397
E.....@.?."..,F..,+......a.CANCEL sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar] CSeq: 102 CANCEL Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
09:49:15.024138 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP,
length: 413
E.....@.@.[...,+..,F........SIP/2.0 200 canceling Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr oxy+Registrar]
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98 25e-db87
CSeq: 102 CANCEL Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.024576 IP [Loadbalancer].5060 > [Proxy+Registrar].5060: SIP,
length: 493
E.. ..@.@.Z...,+..,F........SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98 25e-db87
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.025180 IP [Proxy+Registrar].5060 > [Loadbalancer].5060: SIP,
length: 433
E.....@.?.[...,F..,+.......MACK sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98 25e-db87
CSeq: 102 ACK Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
----------------This is the config of my loadbalancer----------------
----:
####### Global Parameters #########
debug=100 log_stderror=yes log_facility=LOG_LOCAL0
fork=no children=4
disable_tcp=yes
port=5060
listen=[Loadbalancer]
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "nathelper.so" loadmodule "dispatcher.so" loadmodule "path.so"
# ----------------- setting module-specific parameters --------------
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs #modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) #modparam("rr", "append_fromtag", 0)
# -- nathelper modparam("nathelper", "rtpproxy_sock",
"/var/run/rtpproxy/rtpproxy.sock")
modparam("nathelper", "received_avp", "$avp(i:80)")
# -- dispatcher params -- modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
# -- path params -- modparam("path", "use_received", 1)
####### Routing Logic ########
# main request routing logic
route{ xlog("L_ALERT", "[$rm] from [$fu] to [$tu]\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
# NAT detection route(4); if (has_totag()) { xlog("L_ALERT", "_____HASTOTAG [$rm] from [$fu] to
[$tu]\n");
# sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("L_ALERT", "_____LOOSE_ROUTE [$rm] from
[$fu] to [$tu]\n");
t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { xlog("L_ALERT", "_____NON-
LOOSE, STATEFUL-ACK [$rm] from [$fu] to [$tu]\n");
# non loose-route, but
stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
t_relay(); exit; } else { xlog("L_ALERT",
"_____ACK_WITHOUT_TRANSACTION [$rm] from [$fu] to [$tu]\n");
# ACK without matching
transaction ... ignore and discard.\n");
exit; } } sl_send_reply("404","Not here"); } exit; } #initial requests # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } t_check_trans(); # record routing if (!is_method("REGISTER|MESSAGE")) xlog("L_ALERT", "_____RECORD_ROUTING [$rm] from [$fu]
to [$tu]\n");
record_route(); #if ($rU==NULL) { # # request with no Username in RURI # sl_send_reply("484","Address Incomplete"); # exit; #} if (check_route_param("nat=yes")) { setbflag(6); } #if (isflagset(5) || isbflagset(6)) { route(5); #} /* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("1"); t_on_failure("1"); } if(!ds_is_from_list()) { ds_select_domain("0", "0"); } if (!t_relay()) { sl_reply_error(); }
}
# Caller NAT detection route route[4]{ force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { add_path_received(); fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } else { add_path(); } return; }
# RTPProxy control route[5] { if (is_method("BYE")) { unforce_rtp_proxy(); } else if (is_method("INVITE")){ force_rtp_proxy(); } if (!has_totag()) add_rr_param(";nat=yes"); return; }
onreply_route[1] { xdbg("incoming reply\n");
#if ((isflagset(5) || isbflagset(6)) && status=~"(183)|(2[0-
9][0-9])") {
if (status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } if (isbflagset(6)) { fix_nated_contact(); }
}
failure_route[1] { #if (is_method("INVITE") && (isbflagset(6) || isflagset(5)))
{
if (is_method("INVITE")) { unforce_rtp_proxy(); } if (t_was_cancelled()) { exit; }
}
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Hi,
as thought invite messages are routed now correctly to the public IP of the UAC.
Now I have another problem. ACK and BYE messages have the same problem. The loadbalancer(s) are trying to send the messages to the private IP, which of course does not work.
I thought at least the BYE message is an in-dialog-request, and therefore it should work ? Do you have an idea how to route this kind of messages correctly through the LB to the UAC's ?
best regards,
Florian
The request sent out by the LB still has the Route header. This indicates that either:
- the load balancer does not detect the domain/IP in the Route
header
as an internal one (alias=....)
- the loose_route function is not called in the LB.
Many thanks ! I did not call loose_route in the LB, I think that will solve it.
Best regards,
Florian
Florian Meister schrieb:
Hi,
I'm trying to set up a HA-OBP for both natted and non-natted users.
Atm my setup looks like that:
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
At the loadbalancer I use add_path and add_path_received to add a
path-header to the request sent to the Registrar. (Of course only for register requests). I use a few parameters for telling the registrar module to use the path header. When looking in the mysql-db I can see the correct value in the path-field in the location-table.
When getting an invite from the PSTN gateway for one of the UAC's
the
Proxy is adding a route-header according to the path-value in the mysql. That seems also correct. Now to my problem:
The loadbalancer is sending out the INVITE to the private-ip, not
to
the public-nat-ip of the UAC. It seems that the received-parameter in the Route-header is somehow ignored. I am using the use_received parameter in the loadbalancer, but it does not work.
In the following you can find the SIP trace (made on the
loadbalancer) and the loadbalancer config, since I think there is the problem.
Thanks,
Florian
Here is the SIP-trace of the INVITE:
09:49:07.785294 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 1101
E..i..@.?.Yb..,F..,+.....U.BINVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 69 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 312
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [PSTN Gateway] t=0 0 m=audio 19178 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv
09:49:07.786459 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 445
E.....@.@.Z...,+..,F........SIP/2.0 100 Giving a try Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:07.786608 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:08.258116 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:09.258109 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:11.258107 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:15.023388 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 397
E.....@.?."..,F..,+......a.CANCEL sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar] CSeq: 102 CANCEL Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
09:49:15.024138 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 413
E.....@.@.[...,+..,F........SIP/2.0 200 canceling Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
CSeq: 102 CANCEL Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.024576 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 493
E.. ..@.@.Z...,+..,F........SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.025180 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 433
E.....@.?.[...,F..,+.......MACK sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
CSeq: 102 ACK Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
----------------This is the config of my loadbalancer--------------
--
----:
####### Global Parameters #########
debug=100 log_stderror=yes log_facility=LOG_LOCAL0
fork=no children=4
disable_tcp=yes
port=5060
listen=[Loadbalancer]
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "nathelper.so" loadmodule "dispatcher.so" loadmodule "path.so"
# ----------------- setting module-specific parameters ------------
--
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs #modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) #modparam("rr", "append_fromtag", 0)
# -- nathelper modparam("nathelper", "rtpproxy_sock",
"/var/run/rtpproxy/rtpproxy.sock")
modparam("nathelper", "received_avp", "$avp(i:80)")
# -- dispatcher params -- modparam("dispatcher", "list_file",
"/etc/kamailio/dispatcher.list")
# -- path params -- modparam("path", "use_received", 1)
####### Routing Logic ########
# main request routing logic
route{ xlog("L_ALERT", "[$rm] from [$fu] to [$tu]\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
# NAT detection route(4); if (has_totag()) { xlog("L_ALERT", "_____HASTOTAG [$rm] from [$fu] to
[$tu]\n");
# sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("L_ALERT", "_____LOOSE_ROUTE [$rm]
from
[$fu] to [$tu]\n");
t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { xlog("L_ALERT", "_____NON-
LOOSE, STATEFUL-ACK [$rm] from [$fu] to [$tu]\n");
# non loose-route, but
stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
t_relay(); exit; } else { xlog("L_ALERT",
"_____ACK_WITHOUT_TRANSACTION [$rm] from [$fu] to [$tu]\n");
# ACK without matching
transaction ... ignore and discard.\n");
exit; } } sl_send_reply("404","Not here"); } exit; } #initial requests # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } t_check_trans(); # record routing if (!is_method("REGISTER|MESSAGE")) xlog("L_ALERT", "_____RECORD_ROUTING [$rm] from
[$fu]
to [$tu]\n");
record_route(); #if ($rU==NULL) { # # request with no Username in RURI # sl_send_reply("484","Address Incomplete"); # exit; #} if (check_route_param("nat=yes")) { setbflag(6); } #if (isflagset(5) || isbflagset(6)) { route(5); #} /* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("1"); t_on_failure("1"); } if(!ds_is_from_list()) { ds_select_domain("0", "0"); } if (!t_relay()) { sl_reply_error(); }
}
# Caller NAT detection route route[4]{ force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { add_path_received(); fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } else { add_path(); } return; }
# RTPProxy control route[5] { if (is_method("BYE")) { unforce_rtp_proxy(); } else if (is_method("INVITE")){ force_rtp_proxy(); } if (!has_totag()) add_rr_param(";nat=yes"); return; }
onreply_route[1] { xdbg("incoming reply\n");
#if ((isflagset(5) || isbflagset(6)) &&
status=~"(183)|(2[0-
9][0-9])") {
if (status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } if (isbflagset(6)) { fix_nated_contact(); }
}
failure_route[1] { #if (is_method("INVITE") && (isbflagset(6) ||
isflagset(5)))
{
if (is_method("INVITE")) { unforce_rtp_proxy(); } if (t_was_cancelled()) { exit; }
}
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
as thought invite messages are routed now correctly to the public IP of the UAC.
Now I have another problem. ACK and BYE messages have the same problem. The loadbalancer(s) are trying to send the messages to the private IP, which of course does not work.
I thought at least the BYE message is an in-dialog-request, and therefore it should work ? Do you have an idea how to route this kind of messages correctly through the LB to the UAC's ?
Hi,
I've solved the problem. No need to answer :D
Best regards, Florian
The request sent out by the LB still has the Route header. This indicates that either:
- the load balancer does not detect the domain/IP in the Route
header
as an internal one (alias=....)
- the loose_route function is not called in the LB.
Many thanks ! I did not call loose_route in the LB, I think that will solve it.
Best regards,
Florian
Florian Meister schrieb:
Hi,
I'm trying to set up a HA-OBP for both natted and non-natted
users.
Atm my setup looks like that:
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
At the loadbalancer I use add_path and add_path_received to add a
path-header to the request sent to the Registrar. (Of course only
for
register requests). I use a few parameters for telling the
registrar
module to use the path header. When looking in the mysql-db I can
see
the correct value in the path-field in the location-table.
When getting an invite from the PSTN gateway for one of the UAC's
the
Proxy is adding a route-header according to the path-value in the mysql. That seems also correct. Now to my problem:
The loadbalancer is sending out the INVITE to the private-ip, not
to
the public-nat-ip of the UAC. It seems that the received-parameter
in
the Route-header is somehow ignored. I am using the use_received parameter in the loadbalancer, but it does not work.
In the following you can find the SIP trace (made on the
loadbalancer) and the loadbalancer config, since I think there is
the
problem.
Thanks,
Florian
Here is the SIP-trace of the INVITE:
09:49:07.785294 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 1101
E..i..@.?.Yb..,F..,+.....U.BINVITE sip:435572949012@[PRIVATE IP
of
UAC];user=phone SIP/2.0
Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 69 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 312
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [PSTN Gateway] t=0 0 m=audio 19178 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv
09:49:07.786459 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 445
E.....@.@.Z...,+..,F........SIP/2.0 100 Giving a try Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:07.786608 IP [Loadbalancer].5060 > [PRIVATE IP of
UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP
of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:08.258116 IP [Loadbalancer].5060 > [PRIVATE IP of
UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP
of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:09.258109 IP [Loadbalancer].5060 > [PRIVATE IP of
UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP
of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:11.258107 IP [Loadbalancer].5060 > [PRIVATE IP of
UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP
of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE,
NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:15.023388 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 397
E.....@.?."..,F..,+......a.CANCEL sip:435572949012@[PRIVATE IP
of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar] CSeq: 102 CANCEL Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
09:49:15.024138 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 413
E.....@.@.[...,+..,F........SIP/2.0 200 canceling Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
CSeq: 102 CANCEL Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.024576 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 493
E.. ..@.@.Z...,+..,F........SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.025180 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 433
E.....@.?.[...,F..,+.......MACK sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
CSeq: 102 ACK Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
----------------This is the config of my loadbalancer------------
--
--
----:
####### Global Parameters #########
debug=100 log_stderror=yes log_facility=LOG_LOCAL0
fork=no children=4
disable_tcp=yes
port=5060
listen=[Loadbalancer]
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "nathelper.so" loadmodule "dispatcher.so" loadmodule "path.so"
# ----------------- setting module-specific parameters ----------
--
--
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs #modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) #modparam("rr", "append_fromtag", 0)
# -- nathelper modparam("nathelper", "rtpproxy_sock",
"/var/run/rtpproxy/rtpproxy.sock")
modparam("nathelper", "received_avp", "$avp(i:80)")
# -- dispatcher params -- modparam("dispatcher", "list_file",
"/etc/kamailio/dispatcher.list")
# -- path params -- modparam("path", "use_received", 1)
####### Routing Logic ########
# main request routing logic
route{ xlog("L_ALERT", "[$rm] from [$fu] to [$tu]\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
# NAT detection route(4); if (has_totag()) { xlog("L_ALERT", "_____HASTOTAG [$rm] from [$fu]
to
[$tu]\n");
# sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("L_ALERT", "_____LOOSE_ROUTE [$rm]
from
[$fu] to [$tu]\n");
t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { xlog("L_ALERT",
"_____NON-
LOOSE, STATEFUL-ACK [$rm] from [$fu] to [$tu]\n");
# non loose-route, but
stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
t_relay(); exit; } else { xlog("L_ALERT",
"_____ACK_WITHOUT_TRANSACTION [$rm] from [$fu] to [$tu]\n");
# ACK without matching
transaction ... ignore and discard.\n");
exit; } } sl_send_reply("404","Not here"); } exit; } #initial requests # CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; } t_check_trans(); # record routing if (!is_method("REGISTER|MESSAGE")) xlog("L_ALERT", "_____RECORD_ROUTING [$rm] from
[$fu]
to [$tu]\n");
record_route(); #if ($rU==NULL) { # # request with no Username in RURI # sl_send_reply("484","Address Incomplete"); # exit; #} if (check_route_param("nat=yes")) { setbflag(6); } #if (isflagset(5) || isbflagset(6)) { route(5); #} /* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("1"); t_on_failure("1"); } if(!ds_is_from_list()) { ds_select_domain("0", "0"); } if (!t_relay()) { sl_reply_error(); }
}
# Caller NAT detection route route[4]{ force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { add_path_received(); fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } else { add_path(); } return; }
# RTPProxy control route[5] { if (is_method("BYE")) { unforce_rtp_proxy(); } else if (is_method("INVITE")){ force_rtp_proxy(); } if (!has_totag()) add_rr_param(";nat=yes"); return; }
onreply_route[1] { xdbg("incoming reply\n");
#if ((isflagset(5) || isbflagset(6)) &&
status=~"(183)|(2[0-
9][0-9])") {
if (status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } if (isbflagset(6)) { fix_nated_contact(); }
}
failure_route[1] { #if (is_method("INVITE") && (isbflagset(6) ||
isflagset(5)))
{
if (is_method("INVITE")) { unforce_rtp_proxy(); } if (t_was_cancelled()) { exit; }
}
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
Florian Meister schrieb:
Hi,
as thought invite messages are routed now correctly to the public IP of the UAC.
Now I have another problem. ACK and BYE messages have the same problem. The loadbalancer(s) are trying to send the messages to the private IP, which of course does not work.
I thought at least the BYE message is an in-dialog-request, and therefore it should work ? Do you have an idea how to route this kind of messages correctly through the LB to the UAC's ?
How do you route in-dialog messages? LB and proxy/registrar should use record-route on initial request to stay in the proxy-chain. LB and proxy/registrar should route in-dialog requests with loose_route() and t_relay().
Also, on the LB you have to do the NAT traversal for the clients: i.e. fix_nated_contact() on messages from the client. If the LB is multihomed and uses double-record-routing I think you could the same mechanism like path (adding "received" to the record-route header) too.
regards klaus
best regards,
Florian
The request sent out by the LB still has the Route header. This indicates that either: - the load balancer does not detect the domain/IP in the Route
header
as an internal one (alias=....) - the loose_route function is not called in the LB.
Many thanks ! I did not call loose_route in the LB, I think that will solve it.
Best regards,
Florian
Florian Meister schrieb:
Hi,
I'm trying to set up a HA-OBP for both natted and non-natted users.
Atm my setup looks like that:
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
At the loadbalancer I use add_path and add_path_received to add a
path-header to the request sent to the Registrar. (Of course only for register requests). I use a few parameters for telling the registrar module to use the path header. When looking in the mysql-db I can see the correct value in the path-field in the location-table.
When getting an invite from the PSTN gateway for one of the UAC's
the
Proxy is adding a route-header according to the path-value in the mysql. That seems also correct. Now to my problem:
The loadbalancer is sending out the INVITE to the private-ip, not
to
the public-nat-ip of the UAC. It seems that the received-parameter in the Route-header is somehow ignored. I am using the use_received parameter in the loadbalancer, but it does not work.
In the following you can find the SIP trace (made on the
loadbalancer) and the loadbalancer config, since I think there is the problem.
Thanks,
Florian
Here is the SIP-trace of the INVITE:
09:49:07.785294 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 1101
E..i..@.?.Yb..,F..,+.....U.BINVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 69 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 312
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [PSTN Gateway] t=0 0 m=audio 19178 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv
09:49:07.786459 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 445
E.....@.@.Z...,+..,F........SIP/2.0 100 Giving a try Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:07.786608 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:08.258116 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:09.258109 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:11.258107 IP [Loadbalancer].5060 > [PRIVATE IP of UAC].5060:
SIP, length: 1307
E..7..@.@..@..,+.........#>.INVITE sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Record-Route: sip:[Loadbalancer];lr;ftag=as33339e2e;nat=yes Record-Route: sip:[Proxy+Registrar];lr;ftag=as33339e2e Via: SIP/2.0/UDP [Loadbalancer];branch=z9hG4bK3d51.207ba0a5.0 Via: SIP/2.0/UDP
[Proxy+Registrar];rport=5060;received=[Proxy+Registrar];branch=z9hG4bK3
d51.bf3830b5.0
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
Route: <sip:[Loadbalancer];lr;received="sip:[PUBLIC NAT IP of
UAC]:64224">
Max-Forwards: 68 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To: sip:+435572949012@[Proxy+Registrar] Contact: <sip:4366480588134@[PSTN Gateway]> Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE User-Agent: Asterisk PBX 1.6.1.5 Date: Fri, 25 Sep 2009 07:40:26 GMT Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY,
INFO
Supported: replaces, timer Content-Type: application/sdp Content-Length: 330 Path: sip:[Loadbalancer];lr
v=0 o=root 1940822246 1940822246 IN IP4 [PSTN Gateway] s=Asterisk PBX 1.6.1.5 c=IN IP4 [Loadbalancer] t=0 0 m=audio 35480 RTP/AVP 8 3 0 101 a=rtpmap:8 PCMA/8000 a=rtpmap:3 GSM/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:101 telephone-event/8000 a=fmtp:101 0-16 a=silenceSupp:off - - - - a=ptime:20 a=sendrecv a=nortpproxy:yes
09:49:15.023388 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 397
E.....@.?."..,F..,+......a.CANCEL sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To: sip:+435572949012@[Proxy+Registrar] CSeq: 102 CANCEL Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
09:49:15.024138 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 413
E.....@.@.[...,+..,F........SIP/2.0 200 canceling Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
CSeq: 102 CANCEL Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.024576 IP [Loadbalancer].5060 > [Proxy+Registrar].5060:
SIP,
length: 493
E.. ..@.@.Z...,+..,F........SIP/2.0 487 Request Terminated Via: SIP/2.0/UDP
[Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0;rport=5060;received=[Pr
oxy+Registrar]
Via: SIP/2.0/UDP [PSTN
Gateway]:5060;branch=z9hG4bK521a62f5;rport=5060
From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] CSeq: 102 INVITE Server: Kamailio (1.5.1-notls (i386/linux)) Content-Length: 0
09:49:15.025180 IP [Proxy+Registrar].5060 > [Loadbalancer].5060:
SIP,
length: 433
E.....@.?.[...,F..,+.......MACK sip:435572949012@[PRIVATE IP of
UAC];user=phone SIP/2.0
Via: SIP/2.0/UDP [Proxy+Registrar];branch=z9hG4bK3d51.bf3830b5.0 From: "4366480588134" <sip:4366480588134@[PSTN
Gateway]>;tag=as33339e2e
Call-ID: 067ebe30188025880d0c9f6e78c1b86d@[PSTN Gateway] To:
sip:+435572949012@[Proxy+Registrar];tag=77b8b5897dbef36847302656cec98
25e-db87
CSeq: 102 ACK Max-Forwards: 70 User-Agent: OpenSER (1.3.2-notls (x86_64/linux)) Content-Length: 0
----------------This is the config of my loadbalancer--------------
--
----:
####### Global Parameters #########
debug=100 log_stderror=yes log_facility=LOG_LOCAL0
fork=no children=4
disable_tcp=yes
port=5060
listen=[Loadbalancer]
####### Modules Section ########
mpath="/usr/lib/kamailio/modules/"
loadmodule "mi_fifo.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "pv.so" loadmodule "maxfwd.so" loadmodule "textops.so" loadmodule "siputils.so" loadmodule "xlog.so" loadmodule "nathelper.so" loadmodule "dispatcher.so" loadmodule "path.so"
# ----------------- setting module-specific parameters
--
# ----- mi_fifo params ----- modparam("mi_fifo", "fifo_name", "/tmp/kamailio_fifo")
# ----- rr params ----- # add value to ;lr param to cope with most of the UAs #modparam("rr", "enable_full_lr", 1) # do not append from tag to the RR (no need for this script) #modparam("rr", "append_fromtag", 0)
# -- nathelper modparam("nathelper", "rtpproxy_sock",
"/var/run/rtpproxy/rtpproxy.sock")
modparam("nathelper", "received_avp", "$avp(i:80)")
# -- dispatcher params -- modparam("dispatcher", "list_file",
"/etc/kamailio/dispatcher.list")
# -- path params -- modparam("path", "use_received", 1)
####### Routing Logic ########
# main request routing logic
route{ xlog("L_ALERT", "[$rm] from [$fu] to [$tu]\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); exit; }
# NAT detection route(4);
if (has_totag()) { xlog("L_ALERT", "_____HASTOTAG [$rm] from [$fu] to
[$tu]\n");
# sequential request withing a dialog should # take the path determined by record-routing if (loose_route()) { xlog("L_ALERT", "_____LOOSE_ROUTE [$rm]
from
[$fu] to [$tu]\n");
t_relay(); exit; } else { if ( is_method("ACK") ) { if ( t_check_trans() ) { xlog("L_ALERT", "_____NON-
LOOSE, STATEFUL-ACK [$rm] from [$fu] to [$tu]\n");
# non loose-route, but
stateful ACK; must be an ACK after a 487 or e.g. 404 from upstream server
t_relay(); exit; } else { xlog("L_ALERT",
"_____ACK_WITHOUT_TRANSACTION [$rm] from [$fu] to [$tu]\n");
# ACK without matching
transaction ... ignore and discard.\n");
exit; } } sl_send_reply("404","Not here"); } exit; }
#initial requests
# CANCEL processing if (is_method("CANCEL")) { if (t_check_trans()) t_relay(); exit; }
t_check_trans();
# record routing if (!is_method("REGISTER|MESSAGE")) xlog("L_ALERT", "_____RECORD_ROUTING [$rm] from
[$fu]
to [$tu]\n");
record_route();
#if ($rU==NULL) { # # request with no Username in RURI # sl_send_reply("484","Address Incomplete"); # exit; #}
if (check_route_param("nat=yes")) { setbflag(6); } #if (isflagset(5) || isbflagset(6)) { route(5); #}
/* example how to enable some additional event routes */ if (is_method("INVITE")) { t_on_reply("1"); t_on_failure("1"); }
if(!ds_is_from_list()) { ds_select_domain("0", "0"); } if (!t_relay()) { sl_reply_error(); } }
# Caller NAT detection route route[4]{ force_rport(); if (nat_uac_test("19")) { if (method=="REGISTER") { add_path_received(); fix_nated_register(); } else { fix_nated_contact(); } setflag(5); } else { add_path(); } return; }
# RTPProxy control route[5] { if (is_method("BYE")) { unforce_rtp_proxy(); } else if (is_method("INVITE")){ force_rtp_proxy(); } if (!has_totag()) add_rr_param(";nat=yes"); return; }
onreply_route[1] { xdbg("incoming reply\n");
#if ((isflagset(5) || isbflagset(6)) &&
status=~"(183)|(2[0-
9][0-9])") {
if (status=~"(183)|(2[0-9][0-9])") { force_rtp_proxy(); } if (isbflagset(6)) { fix_nated_contact(); } }
failure_route[1] { #if (is_method("INVITE") && (isbflagset(6) ||
isflagset(5)))
{
if (is_method("INVITE")) { unforce_rtp_proxy(); }
if (t_was_cancelled()) { exit; } }
_______________________________________________ Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
_______________________________________________ Kamailio (OpenSER)
- Users mailing list Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
_______________________________________________ Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
How do you route in-dialog messages? LB and proxy/registrar should use record-route on initial request to stay in the proxy-chain. LB and proxy/registrar should route in-dialog requests with loose_route() and t_relay().
Also, on the LB you have to do the NAT traversal for the clients: i.e. fix_nated_contact() on messages from the client. If the LB is multihomed and uses double-record-routing I think you could the same mechanism like path (adding "received" to the record-route header) too.
I already found my problem. It was as you mentioned a NAT problem. In the preloaded-route (which is added by the proxy for path support) the nat-flag is not set. In the response I check for the existence of the nat flag for diciding to do fix_nated_contact. Since it does not exist, I have the wrong contact in the response.
I am checking now for both ";nat=yes" and "received=", because if there is a received header it is a natted device.
Best regards,
Florian
Florian Meister schrieb:
How do you route in-dialog messages? LB and proxy/registrar should use record-route on initial request to stay in the proxy-chain. LB and proxy/registrar should route in-dialog requests with loose_route() and t_relay().
Also, on the LB you have to do the NAT traversal for the clients: i.e. fix_nated_contact() on messages from the client. If the LB is multihomed and uses double-record-routing I think you could the same mechanism like path (adding "received" to the record-route header) too.
I already found my problem. It was as you mentioned a NAT problem. In the preloaded-route (which is added by the proxy for path support) the nat-flag is not set. In the response I check for the existence of the nat flag for diciding to do fix_nated_contact. Since it does not exist, I have the wrong contact in the response.
I am checking now for both ";nat=yes" and "received=", because if there is a received header it is a natted device.
btw: many providers (and me) choose to apply NAT handling (fixing contact) in all cases - to simplify the config and security.
regards klaus
On 28.09.2009 10:49 Uhr, Florian Meister wrote:
btw: many providers (and me) choose to apply NAT handling (fixing contact) in all cases - to simplify the config and security.
I see. Does that have any negative impacts ?
bandwidth -- all audio is proxied via your server. That may introduce latency as well.
Cheers, Daniel
Florian Meister schrieb:
btw: many providers (and me) choose to apply NAT handling (fixing contact) in all cases - to simplify the config and security.
I see. Does that have any negative impacts ?
Depends ....
For SIP NAT traversal. Almost all SIP clients are symmetric (send/receive SIP on the same port) - thus by always use the "received" information instead of the provided "Contact" you should not have negative impacts. Exception: IIRC, I once saw Cisco SIP phones behind a Cisco PIX which were asymmetric (can't remember if it was SIP or RTP).
Also, applying NAT traversal in all cases, does not allows 3rd party registrations (which are usually not needed).
Regarding RTP NAT traversal. By activating the media relay for all calls you have: - you need more bandwith - you may need more RTP proxies (high call volume) - you might add more delay (this is probably a problem if the relay is in e.g. Europe and caller/callee are in US. If at least on of the parties is "near" the RTP proxy the additional delay should me negligible) + less customers will ask for help due to NAT problems (e.g. NAT detection does not work, stupid SIP clients ...) + some countries require lawful intercept, which must not be noticeable by the costumer. As the LI requires a media relay (to record audio) you do not have a choice and have to activate the media relay for all calls anyway.
regards klaus
Regards, Florian
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users
For SIP NAT traversal. Almost all SIP clients are symmetric (send/receive SIP on the same port) - thus by always use the "received" information instead of the provided "Contact" you should not have negative impacts. Exception: IIRC, I once saw Cisco SIP phones behind a Cisco PIX which were asymmetric (can't remember if it was SIP or RTP).
I see. So I'll do it the same.
- some countries require lawful intercept, which must not be
noticeable by the costumer. As the LI requires a media relay (to record audio) you do not have a choice and have to activate the media relay for all calls anyway.
I have exactly that problem, so I already proxying all rtp-traffic via rtpproxy.
btw. as you can see in this nice drawing, I have two PSTN GW (asterisk-server). Is there a possibility to tell asterisk to split up the incoming calls to both proxies and react when one proxy is unreachable ?
thanks,
florian
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
[LB] <---> [REG + Proxy] <---> [PSTN GW]
I guess you mean "two proxies"?
Failover in Asterisk is very easy. E.g. Asterisk can forward the call from PSTN to either proxy 1.1.1.1 or proxy 2.2.2.2.
sip.conf: [proxy1] type=peer host=1.1.1.1 qualify=yes # to detect if proxy is down [proxy1] type=peer host=2.2.2.2 qualify=yes # to detect if proxy is down
extensions.ael|conf: _0043. => { // try first proxy Dial(SIP/${EXTEN}@proxy1); // if this fails, try second Dial(SIP/${EXTEN}@proxy2); }
of course you can add some load-balancing too.
regards klaus
Florian Meister schrieb:
btw. as you can see in this nice drawing, I have two PSTN GW (asterisk-server). Is there a possibility to tell asterisk to split up the incoming calls to both proxies and react when one proxy is unreachable ?
thanks,
florian
[UAC] <---> (NAT) <---> [LB] <---> [REG + Proxy] <---> [PSTN GW]
[LB] <---> [REG + Proxy] <---> [PSTN GW]
_______________________________________________ Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users