[asterisk-users] Limit total length of calls to a specifig SIP peer
Steve Edwards
asterisk.org at sedwards.com
Tue Jun 8 12:19:54 CDT 2010
On Tue, 8 Jun 2010, Laurent CARON wrote:
> I'm currently using a cheap SIP provider for outbound calls.
>
> I do have 6 channels to them.
>
> In their terms of service there is the following limit:
>
> The total duration of calls during one single day should not exceed 24
> hours or we do have the right to terminate the contract...blah blah
>
> What is the best way to use this provider as long as we are below let's
> say 22h in a single day ?
The ONLY way (how's that for humble) to do this in a reliable and robust
method is to use a real database. Personally, I like MySQL and I prefer to
do database work in an AGI in a compiled language like C.
Maintaining the accumulated duration in a global variable will fail if you
need to restart Asterisk at any time. A global variable will also "fail"
if you have more than 1 call finish at the same time.
Parsing log files is guaranteed to be a resource pig and still has race
conditions.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list