<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Are you looking for something like this?<br>
<br>
Note: This will continuously go between the two trunks until the
caller hangs up, can be fixed by adding loop counter.<tt><br>
<br>
;<br>
; extensions.conf<br>
;<br>
</tt><tt>[LOADBALANCE]</tt><tt><br>
</tt><tt>exten => _X.,1,NoOp(Connect to least used trunk)</tt><tt><br>
; - show active count<br>
</tt><tt>exten => _X.,n,NoOp(Calls:
${GROUP_COUNT(TRUNK01CNT)}/${GROUP_COUNT(TRUNK02CNT)} of
${MATH(${GROUP_COUNT(TRUNK01CNT)}+${GROUP_COUNT(TRUNK02CNT)},int)})</tt><tt><br>
; - goto least used trunk<br>
</tt><tt>exten => _X.,n,GotoIf($[${GROUP_COUNT(TRUNK01CNT)} <
${GROUP_COUNT(TRUNK02CNT)}]?TRUNK02,${EXTEN},1:TRUNK01,${EXTEN},1)</tt><tt><br>
</tt><tt>;</tt><tt><br>
;<br>
</tt><tt>[TRUNK01]</tt><tt><br>
</tt><tt>exten => _X.,1,NoOp(Using Trunk 01)<br>
; - set trunk used counter<br>
</tt><tt></tt><tt>exten => _X.,n,Set(GROUP()=TRUNK01CNT)</tt><tt><br>
; - dial trunk<br>
</tt><tt>exten => _X.,n,Dial(IAX/T01/${EXTEN})</tt><tt><br>
</tt><tt>; - add loop counter to stop infinite loop</tt><tt><br>
</tt><tt>exten => _X.,n,NoOp(Use next </tt><tt>TRUNK02</tt><tt>
is conge</tt><tt>stion or chanunavial</tt><tt>)</tt><tt><br>
; - next trunk if CONGESTION<br>
</tt><tt>
</tt><tt>exten =>
_X.,n,GotoIf($["${DIALSTATUS}"="CONGESTION"]?TRUNK02,${EXTEN},1)</tt><tt><br>
; - next trunk if CHANUNAVAIL<br>
</tt><tt>exten =>
_X.,n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?TRUNK02,${EXTEN},1)</tt><tt><br>
</tt><tt>exten => _X.,n,Hangup()</tt><tt><br>
</tt><tt>;</tt><tt><br>
;<br>
</tt><tt>[TRUNK02]</tt><tt><br>
; - same as above<br>
</tt><tt>exten => _X.,1,NoOp(Using Trunk 02)</tt><tt><br>
</tt><tt>exten => _X.,n,Set(GROUP()=TRUNK02CNT)</tt><tt><br>
</tt><tt>exten => _X.,n,Dial(IAX/T02/${EXTEN})</tt><tt><br>
</tt><tt>exten => _X.,n,NoOp(Use next </tt><tt>TRUNK0</tt><tt>1</tt><tt>
is congestion or chanunavial)</tt><tt><br>
</tt><tt>
</tt><tt>exten =>
_X.,n,GotoIf($["${DIALSTATUS}"="CONGESTION"]?TRUNK01,${EXTEN},1)</tt><tt><br>
</tt><tt>exten =>
_X.,n,GotoIf($["${DIALSTATUS}"="CHANUNAVAIL"]?TRUNK01,${EXTEN},1)</tt><tt><br>
</tt><tt>exten => _X.,n,Hangup()</tt><tt><br>
</tt><tt>;</tt><tt><br>
</tt><tt>; - end</tt><br>
<br>
<div class="moz-cite-prefix">On 12/14/13, 4:41 PM, Muhammad Usman
wrote:<br>
</div>
<blockquote
cite="mid:CA+=kMh5-hwg+kGscKtTY+E7d6WL0j-Sd2U90R=oJFc0e1eW05A@mail.gmail.com"
type="cite">
<div dir="ltr">Friends let me define the scenario please;<br>
Scenario:<br>
2 asterisk servers (A & B) are connected using 05 IAX2
trunks between them. The machine A is running asterisk &
Openvpn server in TUN mode (5 instances with difference IP
addresses for clients). The machine B is running asterisk with
05 OpenVPN clients using 05 bandwidths. The IAX trunks are
established between each pair of P-2-P ip address of machine A
(The OPENVPN Server) & machine B (The Openvpn client).<br>
Requirement:<br>
Required dial plan configuration at machine A for incoming calls
from VoIP Switch/VOS which can forward the calls to IAX2 trunks
in round robin fashion like Load Balancing. If any trunk goes
down it starts forwarding the traffic to other available trunks
& when it gets UP the dialplan should perform as desired.
Like L.B & Fail-over scenarios.<br>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Fri, Dec 13, 2013 at 8:52 PM, Hans
Witvliet <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:asterisk@a-domani.nl" target="_blank">asterisk@a-domani.nl</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Fri, 2013-12-13 at 06:20 -0600, Don Kelly
wrote:<br>
> On Fri, 2013-12-13 at 12:48 +0500, Muhammad Usman
wrote:<br>
> > Hi - I have 2 Asterisk servers connected using
05 IAX2 trunks. I want<br>
> > to load balance incoming calls over IAX2 trunks.
If any trunk goes<br>
> > down the calls traffic will be shared with other
available trunks.<br>
> > When it gets Up the script is supposed to
perform as desired i.e in<br>
> > load balance mode.<br>
><br>
> > Thanks in advance.<br>
> ><br>
><br>
> Hans said:<br>
<br>
><br>
</div>
<div class="im">> Perhaps it is possible to do the L.B.
at the O.S. or network level, and let<br>
> all trunks appear to asterisk to one single trunk.<br>
><br>
> Don asks:<br>
><br>
> What's the value of load balancing multiple IAX
trunks between the same<br>
> system pair? What resources are being balanced?<br>
><br>
</div>
++++++++++<br>
<br>
Perhaps the O.P. can explain about his intentions...<br>
<br>
In some situations it makes sense though:<br>
If you have to connect two servers, and use different kind
of<br>
infrastructure / multiple providers...<br>
<span class="HOEnZb"><font color="#888888"><br>
hw<br>
</font></span>
<div class="HOEnZb">
<div class="h5"><br>
<br>
--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a
moz-do-not-send="true"
href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a>
--<br>
New to Asterisk? Join us for a live introductory webinar
every Thurs:<br>
<a moz-do-not-send="true"
href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a moz-do-not-send="true"
href="http://lists.digium.com/mailman/listinfo/asterisk-users"
target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
Regards:<br>
(Muhammad υѕмαη )
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
</body>
</html>