<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 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","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-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></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-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>You can do this with a global variable and a dedicated context.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Sammy Govind<br><b>Sent:</b> Wednesday, November 16, 2011 12:25 PM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> Re: [asterisk-users] Limit monthly calls by context<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>I'd say try a2billing- thats abit of an overkill for just this functionality but you'll get lot or options to play with there.<o:p></o:p></p><div><p class=MsoNormal>On Wed, Nov 16, 2011 at 7:02 PM, <<a href="mailto:adamk@3a.hu">adamk@3a.hu</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Hello Hans,<o:p></o:p></p><div><p class=MsoNormal style='margin-bottom:12.0pt'><br><br>On 11-16-2011 14:46, Hans Goossen wrote:<o:p></o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>I guess some "billing" solution can do the trick, but I think it's too much for that little. I don't need any other feature.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>i would create a macro which calls an agi. The agi searches the CDR table (mine is in sql) and calculates if the call can go through. Then i'd call this macro from every extension in the dial plan just before the dial cmd.<o:p></o:p></p><div><blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in'><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><p class=MsoNormal style='margin-bottom:12.0pt'>I was thinking something like checking the CDR before make the call, I know it may permit some "extra" minutes to be used, but it really doesn't need to be that exact. A couple of extra minutes won't hurt.<o:p></o:p></p></blockquote><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal>It depends on the number of simultaneous calls from within the same context. The agi can return a number of seconds (calculated from sql) which the dial cmd can use as an absolute limit and after that amount of seconds it can hang up the call (see S or L flags).<br><br>regards<br>adam<o:p></o:p></p><div><div><p class=MsoNormal><br><br>--<br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a 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 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 href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><o:p></o:p></p></div></div></div><p class=MsoNormal><o:p> </o:p></p></div></body></html>