<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal>I need to add multiple internet lines to my asterisk setup
[as my internet connects are slow (DSL distance problem) and I don't want to
pay for a lease line] with load balancing between the lines - googling and
there’s no easy/cheap way to do this. Redundancy\failover seems
just as hard. So I had some ideas and just wanted to share them, maybe
some people will like them and there get work upon and find their way into
asterisk, just be binned or maybe asterisk can do this already [if it can
sorry]. But here goes:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>To the iax2.conf I would add:<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal> priority (what
order to use the context in)<o:p></o:p></p>
<p class=MsoNormal> calls_out (number
of call going out allow on this context - before the next group context is
used)<o:p></o:p></p>
<p class=MsoNormal> calls_total (total
number of calls in and out allow on this context - before the next group
context is used)<o:p></o:p></p>
<p class=MsoNormal> loadbalance (true
or false - do i distribute the calls evenly between the group)<o:p></o:p></p>
<p class=MsoNormal> gateway (what
IP address to send the calls out on)<o:p></o:p></p>
<p class=MsoNormal> externip (needed
if behind a NAT)<o:p></o:p></p>
<p class=MsoNormal> localnet (needed
if behind a NAT)<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal>then you could dial using:<o:p></o:p></p>
<p class=MsoNormal> Dial(IAX2/GROUP:{first
part of context to match}/22122) <o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal>e.g.:<o:p></o:p></p>
<p class=MsoNormal> [outbound
- voip minutes]<o:p></o:p></p>
<p class=MsoNormal> priority
= 1<o:p></o:p></p>
<p class=MsoNormal> loadbalance
= yes<o:p></o:p></p>
<p class=MsoNormal> gateway
= 192.168.16.5<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal> [outbound
- telstar]<o:p></o:p></p>
<p class=MsoNormal> priority
= 2<o:p></o:p></p>
<p class=MsoNormal> loadbalance
= yes<o:p></o:p></p>
<p class=MsoNormal> gateway
= 192.168.16.6<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal> [outbound
- voip hip]<o:p></o:p></p>
<p class=MsoNormal> priority
= 3<o:p></o:p></p>
<p class=MsoNormal> loadbalance
= yes<o:p></o:p></p>
<p class=MsoNormal> gateway
= 192.168.16.7<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal>then dial using:<o:p></o:p></p>
<p class=MsoNormal> Dial(IAX2/GROUP:outbound/22122)<o:p></o:p></p>
<p class=MsoNormal> <o:p></o:p></p>
<p class=MsoNormal>chan_iax2 would work out that I wanted to use a group and
use any context that started outbound so any of the 3 contexts above would be
valid routes. The routes would be ordered by priority, so chan_iax2 would
use voip minutes first, telstar second and voip hip third. Because
I’m using the loadbalance option it will spread the traffic evenly across
the 3 connections. So if voip minutes current has 2 calls on, telstar has
1 call on and voip hip has 5 calls on. A new call would go out on telstar
as this has the least amount of calls.<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>this could be expanded upon to do failover by adding a
checkroute to each context above asterisk can every X minutes check that the
route is still valid and if it isn't mark it so it isn't used.<o:p></o:p></p>
<p class=MsoNormal>If a call was current in progress and the connection went
down, if all 3 contexts were using the same TISP you could reroute the call
(using the unique channel id) over another outbound context to the same TISP
match up the unique call id and the call wouldn't be dropped - this would be
easy to do for the IAX than the SIP protocol because its owned by
asterisk. The problem with doing this for the sip protocol is that
it’s a standard and would require a RFC (Request for Comments).<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal>To make this easier to develop you could you could add it to
IAX3 - so you could ship asterisk and allow the user to use IAX2 or the new
EXPERIMENTAL IAX3 (like you do with the new faster dial plan pattern matching
routine that you need to turn on in extension.conf)<o:p></o:p></p>
<p class=MsoNormal><o:p> </o:p></p>
<p class=MsoNormal><span style='font-size:13.5pt;font-family:"Verdana","sans-serif";
color:green'>Stephen Coles</span><span style='font-size:12.0pt;font-family:
"Times New Roman","serif"'><br>
</span><span style='font-size:10.0pt;font-family:"Verdana","sans-serif";
color:darkgreen'> IT Services<br>
Wellpak(UK) Ltd</span><span style='font-size:12.0pt;font-family:"Times New Roman","serif"'>
<o:p></o:p></span></p>
</div>
</body>
</html>