<div dir="ltr">Hi All,<div><br></div><div>I think I got the answer from reading the dispatcher.c source code: <a href="https://github.com/kamailio/kamailio/blob/master/modules/dispatcher/dispatch.c">https://github.com/kamailio/kamailio/blob/master/modules/dispatcher/dispatch.c</a><br>Line: 577</div><div><br></div><div>Says:</div><div></div><i>/* if the array was not completely filled (i.e., the sum of weights is<br>* less than 100), then use last address to fill the rest */<br></i><br>So clearly I was initializing two destinations with weight=20 and hence code was doing what it is supposed to do, send everything to the last address. <div><br></div><div>Now I've modified the two destinations weight = 50 and now REGISTRATIONS get load-balanced as I desired.</div><div><br></div><div>Thing to remember for future reference, For algo 9 always sum up weights for destinations to equal 100. <br><br><br>Thanks again for reading, and replying Brooks. <br><br>Regards,<br></div><div>Sammy</div><div><br></div><div><br></div><div><br></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 24, 2016 at 2:08 PM, SamyGo <span dir="ltr"><<a href="mailto:govoiper@gmail.com" target="_blank">govoiper@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Brooks, <div><br><div>Well no I'm using algo 9, with weights assigned to each IP in the set. </div><div><br>The reason why I suspect that is because the load set and unset load related functions are mentioned to work only with INVITE. <br>With the weights defined its only logical to assume that dispatcher will count the stuff thrown to a particular destination. Question is if Kamailio counts Registrations as stuff(<i>load</i>) or not..</div><div><br></div><div>Now here is my dispatcher set<br><br></div><div><div><font face="monospace, monospace">SET:: 1</font></div><div><font face="monospace, monospace">        URI:: sip:<a href="http://1.2.33.4:5060" target="_blank">1.2.33.4:5060</a> flags=AP priority=1 attrs=weight=10,registrations=500</font></div><div><font face="monospace, monospace">        URI:: sip:<a href="http://2.3.4.9:5060" target="_blank">2.3.4.9:5060</a> flags=AP priority=1 attrs=weight=10,registrations=500<br></font><br></div><div>Here is my code snippet where registrations are dispatched:<br><font face="monospace, monospace"><br><div>if ( !ds_select_dst("1","9") ) {</div><div>         send_reply("500","Service full");</div><div>         exit;<br></div><div>}</div></font><div><font face="monospace, monospace">xlog("L_NOTICE", "[$fU@$si:$sp]{$rm@$rU}  DISPATCHER: Selected PBX IP:$du Capacity Attr:$avp(pbx_attr) Total PBXs: $avp(dst_group) are $avp(dst_count)-\n");<br><br></font></div></div></div><div><br></div><div>Thanks for taking out time to understand and reply.</div><div><br></div><div>Regards,</div><div>Sammy</div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Thu, Mar 24, 2016 at 1:31 PM, Brooks Bridges <span dir="ltr"><<a href="mailto:bbridges@o1.com" target="_blank">bbridges@o1.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">





<div lang="EN-US" link="blue" vlink="purple">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Your reference to “dispatcher is not considering registrations as load at all and only counts INVITES as load.” leads me to believe that you are trying to use
 algorithm 10 since that’s the only mechanism that cares about call loading.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Working from that assumption, the documentation clearly states “This algorithm can be used only for dispatching INVITE requests as it is the only SIP method
 creating a SIP call.”<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><a href="http://kamailio.org/docs/modules/stable/modules/dispatcher.html#dispatcher.f.ds_select_dst" target="_blank">http://kamailio.org/docs/modules/stable/modules/dispatcher.html#dispatcher.f.ds_select_dst</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Century Gothic","sans-serif";color:black">Brooks Bridges |
</span></b><span style="font-size:8.0pt;font-family:"Century Gothic","sans-serif";color:black">Sr. Voice Services Engineer<u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:8.0pt;font-family:"Century Gothic","sans-serif";color:maroon">O<sup>1</sup> Communications</span></b><span style="font-size:8.0pt;font-family:"Century Gothic","sans-serif";color:blue"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:gray">5190 Golden Foothill Pkwy
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:gray">El Dorado Hills, CA 95762</span><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:blue"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:maroon">office:</span></b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:blue">
</span><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:black">916.235.2097 |</span><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:blue">
</span><b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:maroon">main:</span></b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:black"> 888.444.1111, Option 2</span><span style="color:blue"><u></u><u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:maroon">email:</span></b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:blue">
<a href="mailto:bbridges@o1.com" target="_blank">bbridges@o1.com</a> </span><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:black">| </span><b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:maroon">web:</span></b><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:blue">
</span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><a href="http://www.o1.com/" target="_blank"><span style="font-size:7.0pt;font-family:"Century Gothic","sans-serif";color:black">www.o1.com</span></a></span><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:blue"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> sr-users [mailto:<a href="mailto:sr-users-bounces@lists.sip-router.org" target="_blank">sr-users-bounces@lists.sip-router.org</a>]
<b>On Behalf Of </b>SamyGo<br>
<b>Sent:</b> Thursday, March 24, 2016 10:17 AM<br>
<b>To:</b> SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List<br>
<b>Subject:</b> [SR-Users] Dispatching Registrations to Weight based servers<u></u><u></u></span></p><div><div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">Hi All,<u></u><u></u></p>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">I'm having a wee little bit of difficulty in trying to load-balance registrations to multiple servers based on their weights. <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Kind of similar scenario as discussed in this thread: <a href="http://lists.sip-router.org/pipermail/sr-users/2014-December/086235.html" target="_blank">http://lists.sip-router.org/pipermail/sr-users/2014-December/086235.html</a><br>
<br>
The problem I'm facing is that dispatcher is always choosing the first destination from the group.
<br>
<br>
I do suspect that dispatcher is not considering registrations as load at all and only counts INVITES as load.
<br>
<br>
If above is correct then is there a way to use dispatcher to count registrations as load ?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Thanks,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in">Sammy<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-right:0in;margin-bottom:12.0pt;margin-left:.5in">
<u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><u></u> <u></u></p>
</div>
</div>
</div></div></div>
</div>

<br></div></div>_______________________________________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>