Hi everyone,
I am a beginner in using Kamailio. I am currently building a load balancer for multiple SIP Servers, all of them are Kamailio. The Load balancer can help end-users REGISTER and INVITE normally, but has problems with ACK and BYE.
Messages 180 Ringing and 200 OK sent successfully to the Caller, but the ACK failed, is transmitted to the SIP Server then stop here, doesn’t go back to Load balancing. (Caller's BYE -> LB -> Proxy then stop here). Because doesn’t receive ACK, the Called continuously sent 200 call OK to Caller (sent successfully) and wait for confirmation ACK (after arrival to the SIP Server, ACK doesn’t come back to Load Balancing). Because the Called party doesn’t receive ACK, the call will be automatically disconnected after 30 seconds.
With BYE have rather, if the Caller hangs up first, BYE is transferred over SIP Server and returned to Load balancer, but Load Balancing can’t sent it to the Called (Caller's BYE -> LB -> Proxy -> LB then do not go to the side of called). Caller had picked off the phone, but the Caller is not received BYE and after 30 seconds the call will automatically disconnect (by ACK errors). If the called party hangs up first, HUNG UP button of the called even useless, and I don’t see any packet of the Called party’s BYE message in Wireshark.
I use X-Lite and EyeBeam for two end users, the configuration of the SIP Server is the default configuration of Kamailio.
DISPATHCHER.LIST:
I have 3 Kamailio SIP Proxies, all of them OK, share one DB located in Proxy 2. But for capturing packets more convenient, I turn off the Proxy 2 and 3.
# group sip addresses of your * units
# Kamailio SIP Proxies/Registrars
Previously I used the Stateless Load Balancing configuration by default, but could not INVITE:
# -- dispatcher params --
modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list")
modparam("dispatcher", "force_dst", 1)
route{
if ( !mf_process_maxfwd_header("10") )
{
sl_send_reply("483","To Many Hops");
drop();
};
ds_select_dst("1", "0");
record_route();
forward();
# t_relay();
}
Then I changed the following, sent INVITE and setup call successfully, but met ACK and BYE error above.
if ( is_method("INVITE")) {
# Not Dispatch INVITE from SIP Proxies
if ( ds_is_from_list("1") ) {
t_relay();
} else if ( !ds_is_from_list("1") ) {
route(DISPATCH);
}
} else {
# If not INVITE
route(DISPATCH);
}
}
route[DISPATCH] {
# dispatch destinations
ds_select_dst("1", "0");
record_route();
t_relay();
#forward();
}
Please tell me How to modify in the configuration of Proxy and Load Balancing?
Thank so much for helping!
Best Regard
Nguyen Anh Tuan,
--------------------------------------------------------------------
The latest 200 OK from Called after Ringing : LB->Caller
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-a7349502ae55cf46-1--d87543-;rport=9040
Record-Route: <sip:192.168.3.11;lr;nat=yes>
Record-Route: <sip:192.168.3.10;lr=on>
Contact: <sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 2 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
Content-Type: application/sdp
User-Agent: eyeBeam release 1102q stamp 51814
Content-Length: 435
Caller’s ACK (1001@192.168.3.88) to Load Balancer (192.168.3.10):
Via: SIP/2.0/UDP 172.24.104.159:9040;branch=z9hG4bK-d87543-6f1c8659392a0773-1--d87543-;rport
Max-Forwards: 70
Route: <sip:192.168.3.10;lr>
Route: <sip:192.168.3.11;lr;nat=yes>
Contact: <sip:1001@192.168.3.88:9040>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 2 ACK
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@registrar.sip.vn",response="ec2a4c8832bc7bf7665811c26ec9b292",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Content-Length: 0
ACK 192.168.3.10:5060 (Load Balance) to 192.168.3.11:5060 (Proxy) then STOP HERE (Not transfer further)
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKcydzigwkX
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKcydzigwkX
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-6f1c8659392a0773-1--d87543-;rport=9040
Max-Forwards: 68
Contact: <sip:1001@192.168.3.88:9040>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 2 ACK
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@registrar.sip.vn",response="ec2a4c8832bc7bf7665811c26ec9b292",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Content-Length: 0
Caller’s BYE (1001@192.168.3.88) to Load Balance (192.168.3.10)
Via: SIP/2.0/UDP 172.24.104.159:9040;branch=z9hG4bK-d87543-616e232f86191a37-1--d87543-;rport
Max-Forwards: 70
Route: <sip:192.168.3.10;lr>
Route: <sip:192.168.3.11;lr;nat=yes>
Contact: <sip:1001@192.168.3.88:9040>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 3 BYE
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132",response="c738898739dc49c02676e04a28761971",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0
BYE was transferred from Load Balance(192.168.3.10) to Proxy (192.168.3.11), repeated THREE TIMES, possibly due to an error loop (Route(DISPATCH)?)
Record-Route: <sip:192.168.3.10;lr=on>
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.03f49894.1
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-616e232f86191a37-1--d87543-;rport=9040
Max-Forwards: 69
Route: <sip:192.168.3.10;lr>
Contact: <sip:1001@192.168.3.88:9040>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 3 BYE
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132",response="c738898739dc49c02676e04a28761971",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.13f49894.0
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.03f49894.0
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-616e232f86191a37-1--d87543-;rport=9040
Max-Forwards: 68
Contact: <sip:1001@192.168.3.88:9040>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 3 BYE
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132",response="c738898739dc49c02676e04a28761971",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0
Record-Route: <sip:192.168.3.10;lr=on>
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.13f49894.1
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.03f49894.0
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-616e232f86191a37-1--d87543-;rport=9040
Max-Forwards: 68
Contact: <sip:1001@192.168.3.88:9040>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 3 BYE
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132",response="c738898739dc49c02676e04a28761971",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0
Send back BYE from SIP Proxy (192.168.3.11) to Load Balance (192.168.3.10)
Record-Route: <sip:192.168.3.10;lr=on>
Via: SIP/2.0/UDP 192.168.3.11;branch=z9hG4bKc5be.0070e643.0
Via: SIP/2.0/UDP 192.168.3.10;rport=5060;branch=z9hG4bKc5be.03f49894.1
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-616e232f86191a37-1--d87543-;rport=9040
Max-Forwards: 68
Contact: <sip:1001@192.168.3.10:5060>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 3 BYE
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132",response="c738898739dc49c02676e04a28761971",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0
BYE LOOPs Back from Load Balance(192.168.3.10) to Proxy (192.168.3.11), possibly due to an error loop (Route(DISPATCH)?)
Record-Route: <sip:192.168.3.10;lr=on>
Record-Route: <sip:192.168.3.10;lr=on>
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.33f49894.0
Via: SIP/2.0/UDP 192.168.3.10;branch=z9hG4bKc5be.23f49894.0
Via: SIP/2.0/UDP 192.168.3.11;branch=z9hG4bKc5be.0070e643.0
Via: SIP/2.0/UDP 192.168.3.10;rport=5060;branch=z9hG4bKc5be.03f49894.1
Via: SIP/2.0/UDP 172.24.104.159:9040;received=192.168.3.88;branch=z9hG4bK-d87543-616e232f86191a37-1--d87543-;rport=9040
Max-Forwards: 66
Contact: <sip:1001@192.168.3.10:5060>
To: "1004"<sip:1004@registrar.sip.vn>;tag=8e782d60
From: "1001 registrar.sip.vn"<sip:1001@registrar.sip.vn>;tag=7c72f24e
Call-ID: 1926bb7b58289f2fODg1OTZlZGE5MTAxN2JhOWJjNTZmOGQ1OTljOTJiNjc.
CSeq: 3 BYE
Proxy-Authorization: Digest username="1001",realm="registrar.sip.vn",nonce="T4uyKE+LsPwWJBt3JseE7OVdd58P32lS",uri="sip:1004@192.168.3.10:5060;rinstance=040c24111dc72132",response="c738898739dc49c02676e04a28761971",algorithm=MD5
User-Agent: eyeBeam release 1003s stamp 31159
Reason: SIP;description="User Hung Up"
Content-Length: 0