Hello Daniel,
Thank you kindly for your advice. Sorry,I'm very new to Kamailio and still
have no idea what to do.
Here is kamailio config of authentication section
##########################################
if (is_method("REGISTER") || from_uri==myself) {
# authenticate requests
if (!auth_check("$fd", "subscriber", "1"))
{
auth_challenge("$fd", "0");
exit;
}
# user authenticated - remove auth header
if(!is_method("REGISTER|PUBLISH"))
consume_credentials();
}
# if caller is not local subscriber, then check if it calls
# a local destination, otherwise deny, not an open relay here
if (from_uri!=myself && uri!=myself) {
sl_send_reply("403","Not relaying");
exit;
}
############################################
As I checked from sngrep, SIP invites go to both destinations Asterisk 2
and Asterisk 3 and then return error 401 authen. I'm not sure if it would
go to the only one SIP destination or not?
Sngrep SIP flow:
Thanks,
Warawich
On Mon, Feb 21, 2022 at 7:48 PM Daniel-Constantin Mierla <miconda(a)gmail.com>
wrote:
Hello,
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.
Cheers,
Daniel
On 20.02.22 06:28, warawich wrote:
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=…
SIP Packets capture log:
https://drive.google.com/file/d/1CHGUOwoRDAC93MMBtyfa8gBISKIVC-ng/view?usp=…
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
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* sr-users(a)lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
*
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla --
www.asipto.comwww.twitter.com/miconda --
www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
Feb 21-24, 2022 (America Timezone)
*
https://www.asipto.com/sw/kamailio-advanced-training-online/