Hi all I think this could be en old question. I would like to do a realtime billing prepaid system, mainly using asterisk. I have found few things; I can not get CDR function into agi because asterisk set them once the call is absolutely finish (at least main values for the main porpouse, billsec,duration, etc..) There is a patch that allow you to use CDR function in hangup extension, but it seems to have some troubles, haven't it?? Finally, another solution I have found reading somewhere could be use triggers in the database when there is and CDR insert. A cron job could do something similar. Now, the question, can I access somehow in a deadagi, or whatever the CDR function in order to update the credit when the call has just finished. Thank you very much
random cluster wrote:> Now, the question, can I access somehow in a deadagi, or >whatever the CDR function >in order to update the credit when the call has just finished. > > >Yes, certainly, through deadagi. I just have one question though, why reinvent the wheel? There are prepaid systems that work with asterisk. -- JP Carballo http://www.netfone2x.com Bringing the world closer. It might look like I'm doing nothing, but at the cellular level, I'm really quite busy.
asterisk-users-bounces@lists.digium.com wrote:> In article <IFECLJEGMECKABGMJMPCOEJKEMAA.senad@bicom.us>, > Senad Jordanovic <senad@bicom.us> wrote: >> The way we solved this is: >> >> 1/ Each account has incoming/outgoing channels >> 2/ Once call is started then the total balance is divided by number >> of outgoing channels for that account. This sets the time limit. >> 3/ If more calls are made then each new call has same absolute >> timeout. >> >> Above is not perfect, since we are limiting each call to less talk >> time then total balance allows, hence why we are currently >> looking into possibility in changing the value of absolute timeout >> in memory for each of the calls. > > The other situation to take account of is when the caller somehow adds > to his prepaid balance while he has one or more calls in progress, in > order to avoid being cut off during the call.Noted!!! Thanks :) Senad
You keep eluding to the answer yourself. Asterisk Manager is the way to go. Check out http://search.cpan.org/~xantus/POE-Component-Client-Asterisk-Manager/. Relatively simple event based method for using Asterisk manager. What I would do is register a handler to track new calls, and calls ending. Every time you get a new call, add it to a hash with the customer_id as the key. Seperately register a callback that keeps re-calling itself at X second intervals. It would cycle through the hash of active calls decrementing remaining time for each, and then kick anyone with < 1 second remaining. I have a single script running 12 instances of POE::Component::Client::Asterisk::Manager (1 for each of 12 servers) under a single POE kernel to track > 2500 channels (comings and goings of MeetMe users) and it's had no problem keeping up. Just make sure that you avoid any long running loops as POE is not multi-threaded. For something like this, I think you'll find 1 instance of a single script much easier to track and debug than a whole bunch of instance of an AGI script. Josh McAllister -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Jon Farmer Sent: Wednesday, April 26, 2006 7:27 AM To: nick.hoffman@altcall.com Cc: asterisk-users@lists.digium.com Subject: Re: [Asterisk-Users] billing realtime Nick Hoffman wrote:> Hi Jon. If a customer has 10 minutes of call credit left and he makes2> concurrent calls, how do you know to cut off the 2 calls at the 5minute> mark rather than cut off both calls after 10 minutes?That is the problem I am asking about :-) -- Jon Farmer Telford, Shropshire, UK _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- Asterisk-Users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users