RE: [Asterisk-Users] ASTCC Rate Calculation
> >>eval { $cost = int($adjcost * $adjtime / 60) }; > >>#cost = 253 > >> > >> > > > >Corrected, this would be 250. > > > >Viewed another way, using a 6 second increment, 147 seconds > represents > >25 such increments (actually 24.5, but we get all of the last > >increment, so it's 25). > > > >25 * 10 (the cost of one 6-second increment) = 250. > > > > > Yes, but we need to allow for 30,6 6,1 60,30 billing. I > think the > easiest/best way to handle this is the connect charges as ASTCC > presently supports them. I agree that ASTCC is, at present, wholly deficient in managing y/x billing schemes (anywhere y != x). I'd rather NOT use the connect fee to do this. If we're going to fix it, let's fix it right. I don't have time to hammer it out right now, but it seems to me that as long as y is evenly divisible by x (resulting in an integer value), it should be pretty simple to come up with an algorithm that will properly handle things like 30/6, 60/30, 6/1, etc. -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.323 / Virus Database: 267.7.8/22 - Release Date: 06/17/2005 ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] ASTCC Rate Calculation
Rusty Shackleford wrote: On Sat, June 18, 2005 2:34 pm, Darren Wiebe said: Okay, I'll post both pieces of code. What I was seeing is that calls where being billed more than I thought they should be. Lets use an example with the following info: Call Length: 147 Seconds Increments: 6 Seconds Connect Charge: 100 Included Seconds: 30 Cost per minute: 100 1. Present Code: eval { my $adjtime = int(($answeredtime + $increment - 1) / $increment) * $increment }; #adjtime = 152 This might be where your error is creeping in. $adjtime SHOULD equal 150. Remember, the int() function removes the value to the right of the decimal point - so int(($answerdtime + $increment -1) / $increment) = 25 and not 25.3~, as your example appears to show. This makes $adjtime actually 150, not 152. You are right, I missed the one bracket. eval { $cost = int($adjcost * $adjtime / 60) }; #cost = 253 Corrected, this would be 250. Viewed another way, using a 6 second increment, 147 seconds represents 25 such increments (actually 24.5, but we get all of the last increment, so it's 25). 25 * 10 (the cost of one 6-second increment) = 250. Yes, but we need to allow for 30,6 6,1 60,30 billing. I think the easiest/best way to handle this is the connect charges as ASTCC presently supports them. $cost += $adjconn; #Total Cost = 353 2. My Proposed Code: $total_seconds = ($answeredtime - $numdata->{includedseconds})/$increment; #Total_Seconds(This variable is not very well named) = 19.5 $bill_increments = ceil($total_seconds); #We need to bill for 20 6 second increments. $billseconds = $bill_increments * $increment; #This translates to 120 seconds. Which cheats us out of 27 seconds worth of revenue (actually 30 seconds, since that 27 seconds represents five 6-second increments). I don't think it does. The 30 seconds come out because that is the amount included in the connect charge. The connect charge is added back in here: $cost = ($billseconds / 60) * $adjcost + $adjconn; Darren Wiebe ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] ASTCC Rate Calculation
On Sat, June 18, 2005 2:34 pm, Darren Wiebe said: > Okay, I'll post both pieces of code. What I was seeing is that calls > where being billed more than I thought they should be. Lets use an > example with the following info: > > Call Length: 147 Seconds > Increments: 6 Seconds > Connect Charge: 100 > Included Seconds: 30 > Cost per minute: 100 > > > 1. Present Code: > eval { my $adjtime = int(($answeredtime + $increment - 1) / $increment) > * $increment }; > #adjtime = 152 This might be where your error is creeping in. $adjtime SHOULD equal 150. Remember, the int() function removes the value to the right of the decimal point - so int(($answerdtime + $increment -1) / $increment) = 25 and not 25.3~, as your example appears to show. This makes $adjtime actually 150, not 152. > eval { $cost = int($adjcost * $adjtime / 60) }; > #cost = 253 Corrected, this would be 250. Viewed another way, using a 6 second increment, 147 seconds represents 25 such increments (actually 24.5, but we get all of the last increment, so it's 25). 25 * 10 (the cost of one 6-second increment) = 250. > $cost += $adjconn; > #Total Cost = 353 > > 2. My Proposed Code: > $total_seconds = ($answeredtime - $numdata->{includedseconds})/$increment; > #Total_Seconds(This variable is not very well named) = 19.5 > $bill_increments = ceil($total_seconds); > #We need to bill for 20 6 second increments. > $billseconds = $bill_increments * $increment; > #This translates to 120 seconds. Which cheats us out of 27 seconds worth of revenue (actually 30 seconds, since that 27 seconds represents five 6-second increments). ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] ASTCC Rate Calculation
Okay, I'll post both pieces of code. What I was seeing is that calls where being billed more than I thought they should be. Lets use an example with the following info: Call Length: 147 Seconds Increments: 6 Seconds Connect Charge: 100 Included Seconds: 30 Cost per minute: 100 1. Present Code: eval { my $adjtime = int(($answeredtime + $increment - 1) / $increment) * $increment }; #adjtime = 152 eval { $cost = int($adjcost * $adjtime / 60) }; #cost = 253 $cost += $adjconn; #Total Cost = 353 2. My Proposed Code: $total_seconds = ($answeredtime - $numdata->{includedseconds})/$increment; #Total_Seconds(This variable is not very well named) = 19.5 $bill_increments = ceil($total_seconds); #We need to bill for 20 6 second increments. $billseconds = $bill_increments * $increment; #This translates to 120 seconds. $cost = ($billseconds / 60) * $adjcost + $adjconn; Therefore the cost = 300 3. Proposed Correction to original Code The difference I see is that the first one is double billing for the included seconds. That would be easier fixed as follows: eval { my $adjtime = int((($answeredtime - $numdata->{includedseconds}) + $increment - 1) / $increment) * $increment }; Doing the math this way the cost on the call would come out @ 303 Which example is correct? Which code is easier to follow? :-) Darren Wiebe [EMAIL PROTECTED] Rusty Shackleford wrote: On Fri, June 17, 2005 5:19 pm, Darren Wiebe said: Good Day Has anybody here looked closely at the call cost calculation in ASTCC? Can you duplicate the way the cost of a call is calculated? I believe that there is an error in the code. I have fixed it, I think and submitted a patch but we need user comments. I would appreciate if anybody involved would slip over to chech out this link on the bugtracker and provide feedback. http://bugs.digium.com/view.php?id=4480 I may well be wrong but I believe the issue needs visiting. Somebody was asking me how it calculates costs as they thought they knew what a call should cost. I said "I'll show you". Mistake, I could not come up with an answer that made sense. Darren, I took a quick look at the patch. I'm not certain, but it appears that you've taken out the formula that factors in the billing increment. This forumla, inything other than a 1 second incement, will always "add" time to the call for any number of seconds not equally divisible by the billing increment integer, resulting in a slightly higher cost than might be expected at first glance. This is the way it is supposed to work. As I said, I only glanced at it briefly. Could you describe your changes and the error you were seeing? ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] ASTCC Rate Calculation
On Fri, June 17, 2005 5:19 pm, Darren Wiebe said: > Good Day > > Has anybody here looked closely at the call cost calculation in ASTCC? > Can you duplicate the way the cost of a call is calculated? I believe > that there is an error in the code. I have fixed it, I think and > submitted a patch but we need user comments. I would appreciate if > anybody involved would slip over to chech out this link on the > bugtracker and provide feedback. http://bugs.digium.com/view.php?id=4480 > I may well be wrong but I believe the issue needs visiting. Somebody > was asking me how it calculates costs as they thought they knew what a > call should cost. I said "I'll show you". Mistake, I could not come up > with an answer that made sense. > Darren, I took a quick look at the patch. I'm not certain, but it appears that you've taken out the formula that factors in the billing increment. This forumla, inything other than a 1 second incement, will always "add" time to the call for any number of seconds not equally divisible by the billing increment integer, resulting in a slightly higher cost than might be expected at first glance. This is the way it is supposed to work. As I said, I only glanced at it briefly. Could you describe your changes and the error you were seeing? ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] ASTCC Rate Calculation
Ronald Wiplinger wrote: Darren Wiebe wrote: Good Day Has anybody here looked closely at the call cost calculation in ASTCC? Can you duplicate the way the cost of a call is calculated? I believe that there is an error in the code. I have fixed it, I think and submitted a patch but we need user comments. I would appreciate if anybody involved would slip over to chech out this link on the bugtracker and provide feedback. http://bugs.digium.com/view.php?id=4480 I may well be wrong but I believe the issue needs visiting. Somebody was asking me how it calculates costs as they thought they knew what a call should cost. I said "I'll show you". Mistake, I could not come up with an answer that made sense. Sorry, I posted the wrong link. http://bugs.digium.com/view.php?id=4479 the "update database" for users is removed as it is not needed and has been moved into an update datbase button on the main configure page. You should open a bug report for your tariff patch. Darren Wiebe [EMAIL PROTECTED] Darren, looking at the page you will find two patches. The description is very short. Which patch do you want us to instal? If one is wrong, would you please delete it. What should be the purpose of the patch? "Calc charges" does not give me a clear picture of it. Looking at the patch (picked one) I see that the entire "update database" is deleted. How should I than alter the tables? Another question regarding my tarriff patch, ... How to get this into CVS? bye Ronald Please let me know, Darren Wiebe ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] ASTCC Rate Calculation
Darren Wiebe wrote: Good Day Has anybody here looked closely at the call cost calculation in ASTCC? Can you duplicate the way the cost of a call is calculated? I believe that there is an error in the code. I have fixed it, I think and submitted a patch but we need user comments. I would appreciate if anybody involved would slip over to chech out this link on the bugtracker and provide feedback. http://bugs.digium.com/view.php?id=4480 I may well be wrong but I believe the issue needs visiting. Somebody was asking me how it calculates costs as they thought they knew what a call should cost. I said "I'll show you". Mistake, I could not come up with an answer that made sense. Darren, looking at the page you will find two patches. The description is very short. Which patch do you want us to instal? If one is wrong, would you please delete it. What should be the purpose of the patch? "Calc charges" does not give me a clear picture of it. Looking at the patch (picked one) I see that the entire "update database" is deleted. How should I than alter the tables? Another question regarding my tarriff patch, ... How to get this into CVS? bye Ronald Please let me know, Darren Wiebe ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- Ronald Wiplinger (CEO of ELMIT) http://www.elmit.com+886 (0) 939--77-55-16 or FWD 511208 - I'm a SpamCon Foundation Member, #694, Verify it at http://www.spamcon.org PS: Spam prevention! Our system is protected with a spam prevention program. If you send us an e-mail, our system will send you a confirmation message back. Just reply to this confirmation message please. After receiving this confirmation message, our system will send the hold message (one) and all future messages (after the received confirmation message) to me without asking you again. ___ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users