DHAVAL INDRODIYA
2010-Oct-21 05:24 UTC
[asterisk-users] Asterisk Realtime Billing Question???
Hello All, after so long time i posted a new question regarding billing, hope anyone have some solution. I have situation in that i want to do billing of more than 1 call in real time below are scenario and explanation. Scenario: A customer called my DID number and after that from here i dial few number let say 5 number. once number are placed into DIAL i will put this customer into conference [MEETME] , once a Members are picked up call they will also patched into conference and talking is started, every thing working fine with DIAL-PLAN and DB look up. Now, i want to do billing on customer dialed my DID, and from that actually it DIALED 5 numbers, how can i DO real time billing into this situation, like numbers can be different It can be ISD,STD,Local and also free . if customer having initial balance of $100 then how can i check balance every time.in a situation once balance is nil then i want to disconnect calls . is any one facing this type of situation. give me some idea , regards Dhaval -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101021/755d3bb0/attachment.htm
Zeeshan Zakaria
2010-Oct-21 06:13 UTC
[asterisk-users] Asterisk Realtime Billing Question???
Billing is a complex matter, however the CDR contains all the necessary information. You need to carefully see how calls are recorded in the CDR when meetme finishes, and how all the legs were connected. Usually accountcode, dstchannel and channel columns have the required info which tells how the calls were connected. Once you know how the calls were connected, get each calls duration and destination and multiply them with the destination calling cost. You can program this logic in PHP and use as a AGI script in the hangup context of your dialplan. Its not quick and easy task to do, but there is no quick and easy way for this purpose. Similarly to be able to not proceed with the call if account balance is zero, you need to check account balance before calling the meetme application. Zeeshan A Zakaria -- www.ilovetovoip.com On 2010-10-21 1:32 AM, "DHAVAL INDRODIYA" <dhaval.it01034 at gmail.com> wrote: Hello All, after so long time i posted a new question regarding billing, hope anyone have some solution. I have situation in that i want to do billing of more than 1 call in real time below are scenario and explanation. Scenario: A customer called my DID number and after that from here i dial few number let say 5 number. once number are placed into DIAL i will put this customer into conference [MEETME] , once a Members are picked up call they will also patched into conference and talking is started, every thing working fine with DIAL-PLAN and DB look up. Now, i want to do billing on customer dialed my DID, and from that actually it DIALED 5 numbers, how can i DO real time billing into this situation, like numbers can be different It can be ISD,STD,Local and also free . if customer having initial balance of $100 then how can i check balance every time.in a situation once balance is nil then i want to disconnect calls . is any one facing this type of situation. give me some idea , regards Dhaval -- _____________________________________________________________________ -- 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101021/af8594cd/attachment.htm
Sherwood McGowan
2010-Oct-21 06:14 UTC
[asterisk-users] Asterisk Realtime Billing Question???
On Thu, Oct 21, 2010 at 12:24 AM, DHAVAL INDRODIYA <dhaval.it01034 at gmail.com> wrote:> Hello All, > > after so long time i posted a new question regarding billing, hope anyone > have some solution. > > I have situation in that i want to do billing of more than 1 call in real > time below are scenario and explanation. > > > Scenario: > A customer called my DID number and after that from here i dial few number > let say 5 number. once number are placed into DIAL > i will put this customer into conference [MEETME] , once a Members are > picked up call they will also patched into conference and > talking is started, every thing working fine with DIAL-PLAN and DB look up. > > > Now, i want to do billing on customer dialed my DID, and from that actually > it DIALED 5 numbers, how can i DO real time billing > into this situation, like numbers can be different It can be ISD,STD,Local > and also free . > > if customer having initial balance of $100 then how can i check balance > every time.in a situation once balance is nil then i want to disconnect > calls . is any one facing this type of situation. > > give me some idea , > > regards > Dhaval > > > -- > _____________________________________________________________________ > -- 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 >Dhaval, This sounds very much like a system I'm working on for a client right now. I'm not permitted to disclose much about it due to the NDA i signed, but I'll risk giving you a point in the right direction. First, you should create a table in your database that has a column called callid, and other columns that you will have to decide upon. This table will be called something like '*call_references*'. Oh, and you'll want to define callid as the primary key for records in that table, but DO NOT make it an autoincrement, you're going to populate it with a value that is described in the next step. Second, at the beginning of the original call you mentioned, define a variable that will be unique to that call. I personally have done this by stripping all non-digits from the caller's callerid (using Set(newcid=${FILTER(0123456789,${CALLERID(number)})} ), and then adding the to ${EPOCH}. I did it this way: ${MATH(${newcid}+${EPOCH})}. Next (this is where I have to start being a bit vague), you're going to perform an INSERT query, creating a new call_references record (using that variable I just showed you how to construct as callid's value). Now, when you defined that variable, you should have preceded the variable name with two underscores ( __ ), which will tell Asterisk that channels spawned by the current channel will inherit that variable and it's value. Voila, you now have a method for storing realtime data such as billing information between MULTIPLE calls. I wish I could tell you more, but I can't violate my client's Non-Disclosure Agreement. Hope this helps you out! Sherwood McGowan -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20101021/5300ea1c/attachment.htm
Jeff LaCoursiere
2010-Oct-21 16:00 UTC
[asterisk-users] Asterisk Realtime Billing Question???
[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