[SR-Users] Dispatcher Load Balance with SIP Trunk

Daniel-Constantin Mierla miconda at gmail.com
Mon Feb 21 13:48:45 CET 2022


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=sharing
>
> SIP Packets capture
> log: https://drive.google.com/file/d/1CHGUOwoRDAC93MMBtyfa8gBISKIVC-ng/view?usp=sharing
>
>
> 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 <http://10.148.0.31:5123>
> 1 sip:10.148.0.44:5123 <http://10.148.0.44:5123>
>
> Thanks,
> Warawich
>
>
>
>
>
>
>
>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at 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.com
www.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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220221/4181dd67/attachment.htm>


More information about the sr-users mailing list