<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hello,</p>
<p>if you see 401 being returned by Kamailio, then the config file
execution ends in calling auth_challenge() or a similar
*_challenge() function from auth* modules. That means you do not
match the traffic to use dispatcher for routing. You can set
debug=3 to view more debug messages printed by kamaialio or use
debugger module with cfgtrace enabled in order to see what
configuration file actions are executed and see if you can
identify why execution is not going where you expect to go.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div class="moz-cite-prefix">On 20.02.22 06:28, warawich wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOsf_W9cPPQmCoepiRNRWbsdHTsesA1izCQXtNZXpnuJQx_26A@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Hello,</div>
<div><br>
</div>
<div>I would like to do a load balance between Asterisk SIP
trunks. You can see a diagram from this link: <a
href="https://drive.google.com/file/d/1Qy66L5rQCfxysYQpSd2-ek_8-by0T8PR/view?usp=sharing"
moz-do-not-send="true" class="moz-txt-link-freetext">https://drive.google.com/file/d/1Qy66L5rQCfxysYQpSd2-ek_8-by0T8PR/view?usp=sharing</a><br>
<br>
SIP Packets capture log: <a
href="https://drive.google.com/file/d/1CHGUOwoRDAC93MMBtyfa8gBISKIVC-ng/view?usp=sharing"
moz-do-not-send="true" class="moz-txt-link-freetext">https://drive.google.com/file/d/1CHGUOwoRDAC93MMBtyfa8gBISKIVC-ng/view?usp=sharing</a></div>
<div><br>
</div>
<div><br>
</div>
<div>Details<br>
1. Asterisk1 makes SIP trunk connection with Kamailio.<br>
2. Kamailio makes SIP trunk connection with Asterisk2 and
Asterisk3</div>
<div>3. Caller register SIP phone with Asterisk1 <br>
Caller extension = 8002<br>
4. Asterisk2 makes a blind transfer to Kamailio. (Call to
8009 then transfer to ARI APP)<br>
exten = 8009,1,Transfer(SIP/3802@<kamailio public
IP>)<br>
</div>
<div>5. ARI app extension is 3802</div>
<div><br>
</div>
<div> </div>
<div>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 <b>SIP/2.0 401 Unauthorized</b> in
sip packets capture log.<br>
<br>
Kamailio version: 5.5.2<br>
Kamailio.cfg<br>
<br>
modparam("dispatcher", "list_file",
"/etc/kamailio/dispatcher.list")<br>
modparam("dispatcher", "flags", 3)<br>
modparam("dispatcher", "xavp_dst", "_dsdst_")<br>
modparam("dispatcher", "xavp_ctx", "_dsctx_")<br>
<br>
# Dispatch requests<br>
route[DISPATCH] {<br>
# round robin dispatching on gateways group '1'<br>
if(!ds_select_dst("1", "4")) {<br>
send_reply("404", "No destination");<br>
exit;<br>
}<br>
xdbg("--- SCRIPT: going to <$ru> via <$du>
(attrs: $xavp(_dsdst_=>attrs))\n");<br>
t_on_failure("RTF_DISPATCH");<br>
route(RELAY);<br>
exit;<br>
}<br>
<br>
# Try next destionations in failure route<br>
failure_route[RTF_DISPATCH] {<br>
if (t_is_canceled()) {<br>
exit;<br>
}<br>
# next DST - only for 500 or local timeout<br>
if (t_check_status("500")<br>
or (t_branch_timeout() and
!t_branch_replied())) {<br>
if(ds_next_dst()) {<br>
xdbg("--- SCRIPT: retrying to
<$ru> via <$du> (attrs:
$xavp(_dsdst_=>attrs))\n");<br>
t_on_failure("RTF_DISPATCH");<br>
route(RELAY);<br>
exit;<br>
}<br>
}<br>
}<br>
<br>
dispatcher.list<br>
# setid(int) destination(sip uri) flags(int,opt)
priority(int,opt) attrs(str,opt)<br>
1 sip:<a href="http://10.148.0.31:5123" moz-do-not-send="true">10.148.0.31:5123</a><br>
1 sip:<a href="http://10.148.0.44:5123" moz-do-not-send="true">10.148.0.44:5123</a><br>
<br>
Thanks,</div>
<div>Warawich<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* <a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
* <a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
* <a class="moz-txt-link-freetext" href="https://www.asipto.com/sw/kamailio-advanced-training-online/">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
</body>
</html>