[snipped very confusing top and bottom posting mix] On Thu, 21 Oct 2010, Sherwood McGowan wrote:
> Dhaval, > > You're right, I forgot one thing. The "frozen" table's id column should not > be an autoincrement, it should be set by the insert statement, using the > original method I decsribed for creating a unique integer from the callerid > number and the current EPOCH. That way, you can be sure that multiple > concurrent calls that have frozen funds will only retrieve the record they > created. (Oh and, once you thaw the frozen funds, delete the appropriate > record in the frozen table) > > I'm not sure why you think this will only work for a single call at a time. > Each time a call occurs that is related to an account will cause more money > to be "frozen" from that account, thereby causing future calls to have less > available balance and therefore less time for a call limit. This works for > ANY number of concurrent calls on an account, and every one of those calls > freezes funds based on the rate at which THAT call's amount to freeze was > calculated against. > > EACH call determines IT'S rate, which is then used to determine the amount > to freeze from the account ON THAT CALL. Additionally, since the rate is > specific to each call, the limiting of the length of THAT call, your issue > of limiting is also a non-issue. > I also have worked on the logic for this scenario, and I gave up. Our calling card system now locks a balance and forces the account to one simultaneous call at a time. We report the maximum length of a call to the customer just before the ringing starts, and as someone else stated - to cut it off prematurely is very confusing to the customer (and one of the number one complaints against calling cards - if you sell in Florida it could actually get you in serious trouble). The problem with each call freezing a portion of the balance is that no one call has access to the whole balance, and that was determined (in our case) to be unacceptable, and is definitely unacceptable to the calling card customer. But I don't think we are talking about calling cards. I am guessing that Dhaval is trying to create a termination company, and has customers that maintain a balance with him that want to be able to place multiple simultaneous calls. A common problem. We often end up with negative balances with our upstreams for this very reason - we may be near the bottom of our balance and several calls in progress terminate and bring us below zero. I am sure this is what he is trying to avoid, as the industry is full of people that will simply walk away from a negative balance. Dhaval - your wish, I think, is to manage exactly in real time to decrease the balance as the calls progress. In that way all calls in progress would be cutoff simultaneously as the balance hit zero. That kind of scenario would be very complicated with asterisk. Some external program would have to keep track of the balance and the calls currently in progress, and cut them off at the appropriate time. I would be very interested if anyone has attempted this. I envision something that EVERY SECOND deducts from a balance for every call in progress, at the current rate for each call. Not impossible for sure... Cheers, j -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users