asterisk2billing.org
http://forum.asterisk2billing.org/

RateEngine modifications
http://forum.asterisk2billing.org/viewtopic.php?f=18&t=3939
Page 1 of 1

Author:  mch0lic [ Wed Jul 09, 2008 10:03 am ]
Post subject:  RateEngine modifications

H!

I have a task to rewrite rate_engine_findrates() function in Class.RateEngine.php file (I believe that this function handle these actions). The main problem is that there are a lot of trunks and their ratecard dial prefixes are diferent lenght, so, script takes only the longest one and dont add any alternative ratecard to the array of other trunks.

So, what I'm looking for:
1) someone who knows how to solve or already solved this problem. (at least person with some kind of experience in a2billing)
2) a2billing class diagram would be perfect.
3) any technical documentation for a2billing.
4) any other technical documentation which is related to this topic.

Thaks in advance,
Mindaugas

Ps: I'm not sure about all the actions in a2billing so if I'm wrong please correct my.

Author:  stavros [ Wed Jul 09, 2008 6:40 pm ]
Post subject: 

A good man named Sergey was one step ahead of you. When v1.4 is released it will almost certainly be included, but if you want it in v1.3 you'll have to apply his patch yourself.

Author:  mch0lic [ Thu Jul 10, 2008 5:23 am ]
Post subject: 

I think this is what I'm looking for. Thanks.

Author:  RobinA [ Fri Aug 01, 2008 6:38 am ]
Post subject:  A2B charges caller the lower rate

Hello All.

I think the problem I have found is a little different from what I'm seeing and the patch by sokhapkin may not solve this problem. Here we go.

I have a Callplan with 2 Ratecards attached. Ratecard "a" has a buy rate of 0.08 and a sell rate of 0.15. Ratecard "b" has a buy rate of 0.19 and a sell rate of 0.25. Both for the same destination. The ratecards use different trunks ("A" and "B" respectively)

When a customer makes a call, the Rate engine selects Ratecard "a" and tries to send the call out through trunk "A", which is great. The problem is, if trunk "A" is not available it would try trunk "B" which is also good.

The BAD part is that it does not change the rate charged to the customer. The customer is charged the lower rate from trunk "A", Ratecard "a" (0.15) when the call cost 0.19 and should be charged 0.25.

Thankfully, I'm still testing, but this could be very costly.

Any ideas on how to fix this?

Thanks,

RobinA.

Author:  varnar [ Fri Aug 01, 2008 6:26 pm ]
Post subject: 

Hello

In my situation is normal, the rate_engineering is working fine for me, and the situation that you have write hire is not happened.

what version are you use?

Author:  RobinA [ Fri Aug 01, 2008 8:28 pm ]
Post subject: 

Hello Varnar,

Thanks for your response. The version I'm using is 1.3.3 with PIAF 1.2 and FreePBX 2.4.0. All on top of Asterisk 1.4.20.1

I don't know enough PHP to go messing with the code. I haven't applied any of the patches out there either.


Thanks again,

RobinA

Author:  xrg [ Fri Aug 01, 2008 11:14 pm ]
Post subject: 

I believe those problems have already been spotted/mentioned at this forum, before Dec 2007..

In particular, having multiple sell rates doesn't seem right (business-wise) anyway:
You cannot charge the client different rates according to which trunk actually works. Say, if you are calling Canada, you must pay the "Canada" rate.

Author:  RobinA [ Sat Aug 02, 2008 12:31 am ]
Post subject: 

xrg,

I looked all over before posting this issue. I just couldn't find it anywhere. There are several posts about A2B choosing the wrong rate based on the length of the prefix. Anyhow, if it was already dealt with, I apologize. I would appreciate someone sending me that link.

Under most circumstances you would be correct. It wouldn't make good business sense to have multiple sell rates, but many companies offer gray routes at substantial discounts over white routes with a disclaimer. Therefore the customer is warned and would or should not expect the best quality or even the connection to be up 24 X 7. Therefore as a reseller, it is now a question of ethics. Do you sell a gray route at the price of a white route or do you give your customers the same option? Thus the reason for different sell rates.

Thanks for the response.

RobinA.

Author:  varnar [ Sat Aug 02, 2008 10:05 am ]
Post subject: 

Hello again
please change the following line in rateeng
$A2B -> debug( WRITELOG, $agi, __FILE__, __LINE__, "[USEDRATECARD=".$this->usedratecard."]");
to
$A2B -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "[USEDRATECARD=".$this->usedratecard."]");
then
$A2B -> debug( WRITELOG, $agi, __FILE__, __LINE__, "[CC_RATE_ENGINE_ALL_CALCULTIMEOUT: k=$k - res_calcultimeout:$res_calcultimeout]");
to
$A2B -> debug( VERBOSE | WRITELOG, $agi, __FILE__, __LINE__, "[CC_RATE_ENGINE_ALL_CALCULTIMEOUT: k=$k - res_calcultimeout:$res_calcultimeout]");


and then put this output to forum

and then, change name of your first (low price) trunk to some one another, that he cannt make call, and then the call must go via second trunk.

Author:  RobinA [ Sun Aug 03, 2008 6:09 pm ]
Post subject: 

varnar,

Sorry I got tied up yesterday. I ran the report but didn't get time to send it. However, it is attached.

I only had to change one line. The "USEDRATECARD" had the VERBOSE directive in it.

Thanks again for your help.

RobinA

Author:  varnar [ Sun Aug 03, 2008 6:40 pm ]
Post subject: 

Can you try this rateeng file, and send the logs with the same situation

Attachments:
Class.RateEngine.zip [10.9 KiB]
Downloaded 472 times

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/