<div dir="ltr"><div><div><div>Hi,<br><br></div>Here is a simpler easiler solution for your case.</div><div><br></div><div>Prerequisits:</div><div>1. Media gateways should register for somewhat longer period of time, e.g. 3600 seconds (shorter intervals would work too but longer is better).</div><div>2. All media gateways should register to kamailio through same kamailio listen socket (if they register through different kamailio sockets then it would add further complication since then you have to manage forced socket too in dispatcher module).<br></div><div><br></div><div><br></div><div>Method:<br></div>1. Enable dispatcher module with db backend.</div><div><a href="https://kamailio.org/docs/modules/5.0.x/modules/dispatcher.html#dispatcher.p.db_url">https://kamailio.org/docs/modules/5.0.x/modules/dispatcher.html#dispatcher.p.db_url</a></div><div><br></div>2. Enable received_avp in registrar module, (you can work without it but then you need to create and manage received avp yourself).<br><a href="https://kamailio.org/docs/modules/5.0.x/modules/registrar.html#registrar.p.received_avp">https://kamailio.org/docs/modules/5.0.x/modules/registrar.html#registrar.p.received_avp</a><br><div><div><div><br></div><div>3. When any media gateway registers with kamailio successfully. You should have received_avp filled up. Use SQLOps module to insert this in dispatcher module.<br></div><div><br></div><div>4. Reload dispatcher db,<br></div><div><a href="https://kamailio.org/docs/modules/5.0.x/modules/dispatcher.html#dispatcher.f.ds_reload">https://kamailio.org/docs/modules/5.0.x/modules/dispatcher.html#dispatcher.f.ds_reload</a><br></div><div><br></div><div>Now you have a working load balancing setup for your MGs valid till their sip register expiry. You can choose whatever load balancing algorithm you like.</div><div><br></div><div>5. For media gateway re-register, step 4 & 5 are not required.<br></div><div><br></div><div>6. When any media gateway un-registers or registration expires, remove the entry in dispatcher table and reload.</div><div><a href="https://kamailio.org/docs/modules/5.0.x/modules/registrar.html#idp23888404">https://kamailio.org/docs/modules/5.0.x/modules/registrar.html#idp23888404</a><br></div><div><br></div><div><br></div><div>Hope this helps.<br></div><div><br></div><div><br></div><div>Thank you.<br></div><div><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 23, 2017 at 5:57 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. <div>So thats what I've done already before posting this question; even if I've to do loadbalancing I can use the "fetch_registered_contacts" function, loop over the online gateways on that 1 RURI and "append_branches()" with sorted "q" values... </div><div><br></div><div>That all depends on the accurate measurement of the number of active calls, since requirement is to perform load-balancing based on call loads. Simple load-balancing can be achieved already by manipulating "q" values....again too complicated to work accurately 100% of the time. </div><div><br></div><div>I'm trying to figure out way to totally avoid this use-case at all.</div><div><br></div><div>Regards,</div><div>Sammy</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 23, 2017 at 11:36 AM, Daniel Tryba <span dir="ltr"><<a href="mailto:d.tryba@pocos.nl" target="_blank">d.tryba@pocos.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>On Thu, Nov 23, 2017 at 12:14:36AM -0500, SamyGo wrote:<br>
> I've a scenario where multiple mediaservers will be registered to Kamailio<br>
> and for any incoming call from Upstream provider I've to perform<br>
> load-balancing to the actively registered media-servers.<br>
><br>
> dispatcher module does load-balancing for IP endpoints, is there any other<br>
> module where I can perform load-balancing on registered<br>
> clients(media-servers)?<br>
<br>
</span>If you have those mediaserver register with the same username you could<br>
simply use lookup and  serial forking to loadbalance. No idea how to<br>
randomize the results from lookup though.<br>
<br>
<br>
______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi<wbr>-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<br></blockquote></div><br></div>