<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style>
</head>
<body class='hmmessage'><div dir='ltr'>
Dear AJS,<div><br></div><div>Thank you for your response with good idea. Unfortunately I am not good at programming. Can you please write this AGI script for me. Please help if you can.</div><div><br></div><div><p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">Best
Regards,</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D"><o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">-------------------------------&nbsp;<o:p></o:p></span></p>

<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;">Abid
Saleem</span></b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D"><o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">Technical Manager NGN<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#FE9700">Terminus Technologies</span><span style="font-size:10.0pt;
font-family:&quot;Courier New&quot;;color:#1F497D"><o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">&nbsp;<o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D"><!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600"
 o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f"
 stroked="f">
 <v:stroke joinstyle="miter"/>
 <v:formulas>
  <v:f eqn="if lineDrawn pixelLineWidth 0"/>
  <v:f eqn="sum @0 1 0"/>
  <v:f eqn="sum 0 0 @1"/>
  <v:f eqn="prod @2 1 2"/>
  <v:f eqn="prod @3 21600 pixelWidth"/>
  <v:f eqn="prod @3 21600 pixelHeight"/>
  <v:f eqn="sum @0 0 1"/>
  <v:f eqn="prod @6 1 2"/>
  <v:f eqn="prod @7 21600 pixelWidth"/>
  <v:f eqn="sum @8 21600 0"/>
  <v:f eqn="prod @7 21600 pixelHeight"/>
  <v:f eqn="sum @10 21600 0"/>
 </v:formulas>
 <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
 <o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" alt="TerminusTechLogo"
 style='width:120pt;height:30.75pt'>
 <v:imagedata src="file:///C:\Users\ABIDSA~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg"
  o:href="cid:image001.jpg@01CC3812.0F1960F0"/>
</v:shape><![endif]--><!--[if !vml]--><img width="160" height="41" src="file:///C:\Users\ABIDSA~1\AppData\Local\Temp\msohtmlclip1\01\clip_image001.jpg" alt="TerminusTechLogo" v:shapes="_x0000_i1025"><!--[endif]--><o:p></o:p></span></p>

<p class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">&nbsp;<o:p></o:p></span></p>

<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">Mobile</span></b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">: &nbsp;+92&nbsp;303&nbsp;7777 648<o:p></o:p></span></p>

<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">Email</span></b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">:</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#999999"> </span><u><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D"><a href="mailto:abid@terminusbilling.com">abid@terminusbilling.com</a>
</span></u><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;color:#1F497D"><o:p></o:p></span></p>

<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">MSN</span></b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D">:</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#999999"> </span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;
color:#1F497D"><a href="mailto:abid_saleem10@hotmail.com">abid_saleem10@hotmail.com</a>&nbsp;&nbsp;
<o:p></o:p></span></p>

<b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;color:#1F497D;mso-ansi-language:
EN-US;mso-fareast-language:EN-US;mso-bidi-language:AR-SA">Web Site:</span></b><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;color:#999999;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA"> </span><u><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:Calibri;
mso-fareast-theme-font:minor-latin;color:#1F497D;mso-ansi-language:EN-US;
mso-fareast-language:EN-US;mso-bidi-language:AR-SA"><a href="http://www.terminustech.com/">www.terminustech.com</a></span></u><br><br><div>&gt; From: asterisk_list@earthshod.co.uk<br>&gt; To: asterisk-users@lists.digium.com<br>&gt; Date: Wed, 29 Jun 2011 16:07:25 +0100<br>&gt; Subject: Re: [asterisk-users] Load Balance Trunks<br>&gt; <br>&gt; On Wednesday 29 Jun 2011, Abid Saleem wrote:<br>&gt; &gt; Hi All,<br>&gt; &gt; I have 100 Trunks from my Provider. My Provider is restricting me to make<br>&gt; &gt; only 120 minutes Call duration / trunk / day. So I want to load balance my<br>&gt; &gt; calls to these 100 trunks. Please advise in this regard ASAP. Thanks in<br>&gt; &gt; advance. Regards-----------Abid SaleemTechnical Manager NGNTerminus<br>&gt; &gt; Technologies<br>&gt; <br>&gt; What you will have to do is, set up a database keeping track of how much time <br>&gt; has been used on each trunk; and create two AGI scripts.  One, which you run <br>&gt; immediately before your Dial() statement, sets a channel variable indicating <br>&gt; which trunk to use.  (Inside a loop, pick a trunk at random; and if there are <br>&gt; minutes to spare on that trunk, and it's not in use, exit the loop.  Then set <br>&gt; a channel variable, and mark the trunk as in use.)  Another, which you run in <br>&gt; your h extensions, updates the database; subtracting the duration of the call <br>&gt; just finished from the time allotted to that trunk, and marking it available.<br>&gt; <br>&gt; If you were pathologically dishonest, this technique probably would also work <br>&gt; for leeching other people's bandwidth in doses small enough to go <br>&gt; unnoticed .....  ;)<br>&gt; <br>&gt; -- <br>&gt; AJS<br>&gt; <br>&gt; Answers come *after* questions.<br>&gt; <br>&gt; --<br>&gt; _____________________________________________________________________<br>&gt; -- Bandwidth and Colocation Provided by http://www.api-digital.com --<br>&gt; New to Asterisk? Join us for a live introductory webinar every Thurs:<br>&gt;                http://www.asterisk.org/hello<br>&gt; <br>&gt; asterisk-users mailing list<br>&gt; To UNSUBSCRIBE or update options visit:<br>&gt;    http://lists.digium.com/mailman/listinfo/asterisk-users<br></div></div>                                               </div></body>
</html>