Hello,
I would like to do a load balance between Asterisk SIP trunks. You can see a diagram from this link: https://drive.google.com/file/d/1Qy66L5rQCfxysYQpSd2-ek_8-by0T8PR/view?usp=s...
SIP Packets capture log: https://drive.google.com/file/d/1CHGUOwoRDAC93MMBtyfa8gBISKIVC-ng/view?usp=s...
Details 1. Asterisk1 makes SIP trunk connection with Kamailio. 2. Kamailio makes SIP trunk connection with Asterisk2 and Asterisk3 3. Caller register SIP phone with Asterisk1 Caller extension = 8002 4. Asterisk2 makes a blind transfer to Kamailio. (Call to 8009 then transfer to ARI APP) exten = 8009,1,Transfer(SIP/3802@<kamailio public IP>) 5. ARI app extension is 3802
My problem is that Kamailio LB only works when I try to connect with Asterisk1 and Asterisk2 or Asterisk1 and Asterisk3. If I have two Asterisks in dispatcher.list, it doesn't work and it appears *SIP/2.0 401 Unauthorized* in sip packets capture log.
Kamailio version: 5.5.2 Kamailio.cfg
modparam("dispatcher", "list_file", "/etc/kamailio/dispatcher.list") modparam("dispatcher", "flags", 3) modparam("dispatcher", "xavp_dst", "_dsdst_") modparam("dispatcher", "xavp_ctx", "_dsctx_")
# Dispatch requests route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xdbg("--- SCRIPT: going to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs))\n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; }
# Try next destionations in failure route failure_route[RTF_DISPATCH] { if (t_is_canceled()) { exit; } # next DST - only for 500 or local timeout if (t_check_status("500") or (t_branch_timeout() and !t_branch_replied())) { if(ds_next_dst()) { xdbg("--- SCRIPT: retrying to <$ru> via <$du> (attrs: $xavp(_dsdst_=>attrs))\n"); t_on_failure("RTF_DISPATCH"); route(RELAY); exit; } } }
dispatcher.list # setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attrs(str,opt) 1 sip:10.148.0.31:5123 1 sip:10.148.0.44:5123
Thanks, Warawich