<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><a href="http://www.opensips.org/html/lcr.html#id2522451">http://www.opensips.org/html/lcr.html#id2522451</a><div><br></div><div>Specifically, you'll want to use either the load_gws() or load_gws_from_grp(group_id) functions to pick a gateway out of a pool that's been setup in the database. You'll want to have a failure route setup so that if OpenSIPS is unable to complete the call with that gateway, it pulls another gateway to try.&nbsp;</div><div><br></div><div>A combination of those functions, AVPs, and some creative thinking and you could build a system that automatically took a gateway out of the gateway table and started testing it if there was an issue (these would be extremely advanced configs of course).</div><div><br></div><div>In any case, you'll want something along these lines (not a perfect sample) . .</div><div><br></div><div>route[1] {</div><div>&nbsp;&nbsp;## Outbound Route</div><div>&nbsp;&nbsp;if(!load_gws_from_grp("400")) {</div><div><div>&nbsp;&nbsp; &nbsp; &nbsp;## Error loading gateways</div><div>&nbsp;&nbsp; &nbsp; &nbsp;sl_send_reply("503", "Termination Currently Unavailable");</div><div>&nbsp;&nbsp; &nbsp; &nbsp;exit;</div><div>&nbsp;&nbsp;}</div><div><br></div></div><div>&nbsp;&nbsp;t_on_failure("1");</div><div>&nbsp;&nbsp;&nbsp;&nbsp;if(!t_relay("0x05")) {</div><div>&nbsp;&nbsp; &nbsp;sl_reply_error();</div><div>&nbsp;&nbsp;}</div><div>&nbsp;&nbsp;</div><div>}</div><div><br></div><div><br></div><div><div>failure_route[1] {</div><div>&nbsp;&nbsp;## Gateway failure route</div><div><div>&nbsp;&nbsp;if(!t_check_status("408|500|503")) {</div><div>&nbsp;&nbsp; &nbsp;## No failover routing needed</div><div>&nbsp;&nbsp; &nbsp;exit;</div><div>&nbsp;&nbsp;}</div></div><div>&nbsp;&nbsp;if(!next_gw()) {</div><div>&nbsp;&nbsp; &nbsp;## Failed to select next gateway</div><div>&nbsp;&nbsp; exit;</div><div>&nbsp;&nbsp;}</div><div><br></div><div>&nbsp;&nbsp;t_on_failure("1");</div><div><br></div><div>&nbsp;&nbsp;route(1);</div><div>}</div><div><br></div><div><br></div><div>The general idea being that once your config script has routed the call, if it fails it will go to the failure route #1. The failure route # 1 will attempt to select another gateway out of the pool and re-route the call.</div><div><br></div><div>Although outdated and unusable with the latest version of OpenSIPS, you may want to check this site out for a idea of how the logic works by creating a config with the LCR module options.</div><div><br></div><div>http://www.sipwise.com/index.php/products?start=3</div><div><br></div><div>Hope this helps.</div><div><br></div><div>Cheers,</div><div><br></div><div>&nbsp;- Darren</div><div><br></div><div><br></div></div><div>_____________________________</div><div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div><br></div><div>Darren Sessions</div><div>dmsessions@gmail.com</div><div>http://www.darrensessions.com</div><div><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="line-height: 14px; white-space: pre-wrap; ">_____________________________</span></font></div><div><br></div></span></div></span></div></span></div></span></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"> </div><br><div><div>On Oct 4, 2008, at 7:53 PM, John D wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi Darren, <br><br>I'd like to use whichever works. I don't have a particular reason for using dispatcher other than running across the module on Google. Are either load_gw or dispatcher clever enough to use a SIP proxy that's available (aka failover in case one node dies) and is it clever enough to know which SIP proxy has less of a load than the other, or does it just round robin?<br> <br>Thanks.<br><br><div class="gmail_quote">On Sat, Oct 4, 2008 at 9:48 PM, Darren Sessions <span dir="ltr">&lt;<a href="mailto:dmsessions@gmail.com">dmsessions@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div style="">If you're just load balancing two Asterisk servers, why not use the load_gw function?<br><div> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div style=""> <span style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><div> <br><br></div><div>_____________________________</div><div><br></div><div>Darren Sessions</div><div><a href="mailto:dmsessions@gmail.com" target="_blank">dmsessions@gmail.com</a></div><div><a href="http://www.darrensessions.com" target="_blank">http://www.darrensessions.com</a></div> <div><font face="Arial"><span style="line-height: 14px; white-space: pre-wrap;">_____________________________</span></font></div><div><br></div></span></div></span></div></span></div></span></div></span><br></div></span><br> </div></span><br> </div><br><div><div><div></div><div class="Wj3C7c"><div>On Oct 4, 2008, at 7:41 PM, John D wrote:</div><br></div></div><blockquote type="cite"><div><div></div><div class="Wj3C7c"><div dir="ltr">All,<br><br> I'm trying to find some half-decent documentation to get OpenSIPS working with the dispatcher module for simply load balancing two Asterisk servers. Most links on <a href="http://voip-info.org" target="_blank">voip-info.org</a> and even some on <a href="http://opensips.org" target="_blank">opensips.org</a> appear dated or 404. I was hoping to try the mail list to see if anyone could kindly suggest the best resource for currently setting up the above (and most importantly how to work with the dispatcher module). <br> <br>Thanks!<br></div></div></div> _______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br> </blockquote></div><br></div><br>_______________________________________________<br> Users mailing list<br> <a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br> <br></blockquote></div><br></div></blockquote></div><br></div></body></html>