Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Sat Apr 20, 2024 12:53 am
Hosted Voice Broadcast


All times are UTC




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: LCR issue solved, please check my results
PostPosted: Fri Apr 30, 2010 4:10 pm 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
Hi,
It is known that A2B have an issue with the LCR since it uses the longest prefix in the ratecard despite its route cost. Well I want to contribute to the project and also that other members confirm my findings or tell me Chris that's wrong.....

Here is what I did:
I changed the file /var/lib/asterisk/agi-bin/lib/Class.RateEngine.php (the path may be different on your asterisk installation) and I commented these lines:

Code:
    //1) REMOVE THOSE THAT HAVE A SMALLER DIALPREFIX
      //$max_len_prefix = strlen($result[0][7]);
      //for ($i=1;$i<count($result);$i++) {
      //      if ( strlen($result[$i][7]) < $max_len_prefix) break;
      //}
      //$result = array_slice ($result, 0, $i);


First question to Areski and Joe, which are the consequences on other parts of A2B this change? as I can see there are none, correct me if I'm wrong.

Next, my testing sheet as attached image:

Prefix: the prefix on the ratecard.
Cost: the value per minute to the customer
Expected: checked with 'x' since it is the lowest value on the three ratecard.
Result: checked if the call DID use the lowest value route.
Ratecard: With three Providers A, B and C, and with different cost (H)igh, (M)edium and (L)ow.

The number that I dialed was always 15808725xxx, so I forced A2B to use the longest dialprefix, but it always used the lowest cost route.

It seems to be working just fine.

Another question... I have all these files with the same name... have two on the web side... I guess I have to make the same change there, isn't it?
/var/www/html/a2customer/lib/Class.RateEngine.php
/var/www/html/a2billing/common/lib/Class.RateEngine.php
/var/lib/asterisk/agi-bin/lib/Class.RateEngine.php


Please, do not make those changes on your production environments! please use testing A2B boxes.

So, make your own testing and tell me is it fixed? or did I scr*w it up?

Kind regards
Christian


Attachments:
File comment: Testing sheet
Captura.PNG
Captura.PNG [ 24.58 KiB | Viewed 14693 times ]
Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Sat May 01, 2010 10:46 pm 
Offline

Joined: Tue Aug 19, 2008 3:49 pm
Posts: 184
Hi,

This is crazy easy if it works :)

Have you done more testing?

Kind Regards,

Les


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Sun May 02, 2010 4:45 am 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
Hi,
Well, I have attached my test sheet with the results and the number dialed.

I invite you guys to help ourselves and the A2B team to make a better A2B software with this little but deep change on the code, please test with your platforms there may be unexpected behavior and we have to be sure that this change really works.

kind regards
Christian


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Mon May 03, 2010 10:05 pm 
Offline

Joined: Mon Apr 21, 2008 1:58 pm
Posts: 16
u "fix" is crazy

example:
number 123456789
prefix, cost
12345,1,trunk1
123, 1,trunk2
1234,1,trunk1

dialling can be trunk1,trunk2,trunk1 or even trunk1 trunk1 trunk2


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Mon May 03, 2010 10:22 pm 
Offline

Joined: Mon Apr 21, 2008 1:58 pm
Posts: 16
also other example:
USA, 1 is all usa cost, usually cheeper then 1800.
so

1800, 0.2,trunk1
1,0.05,trunk2

result on ur "fix"? yes, realy wil be trunk2,trunk1.


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Tue May 04, 2010 2:28 am 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
meral wrote:
u "fix" is crazy

example:
number 123456789
prefix, cost
12345,1,trunk1
123, 1,trunk2
1234,1,trunk1

dialling can be trunk1,trunk2,trunk1 or even trunk1 trunk1 trunk2


Yes, since they all have the same cost... it does not matter the trunk used.
I think it is a good behavior.

Kind regards.


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Tue May 04, 2010 2:31 am 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
meral wrote:
also other example:
USA, 1 is all usa cost, usually cheeper then 1800.
so

1800, 0.2,trunk1
1,0.05,trunk2

result on ur "fix"? yes, realy wil be trunk2,trunk1.


If your customer dials 1800xxxxxx it will use trunk2 since it is cheaper that trunk1.

Which is a correct behavior, it must use the lowest cost route... always.

Kind regards
Christian


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Tue May 04, 2010 2:36 pm 
Offline

Joined: Tue Aug 19, 2008 3:49 pm
Posts: 184
Hi,

Using different provider/trunk your data looks correct.

What happens if you have the same provider/trunk with different rates?

Example:

Provider A

Prefix Rate
1 0.01
123 0.05
123456 0.20

Number dialed is 1234567890

Based on your mod the prefix/rate picked would be 1,0.01.

However, the provider/trunk just sees the complete number and may charge you 0.20 because 123456 is the best match based on the LCR system.

Does this sound possible to you?

Kind Regards,

Les


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Tue May 11, 2010 3:13 pm 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
Hi Les,
Yes, If your provider has that behavior the proposed fix would not work, however I just checked 3 of my providers and no one has the ratecard provided, at least no one has the 1 for US, all have a long prefix.

I will place this fix on my production environment for a few hours and I will share the results.

Kind regards
Christian

LFCII wrote:
Hi,

Using different provider/trunk your data looks correct.

What happens if you have the same provider/trunk with different rates?

Example:

Provider A

Prefix Rate
1 0.01
123 0.05
123456 0.20

Number dialed is 1234567890

Based on your mod the prefix/rate picked would be 1,0.01.

However, the provider/trunk just sees the complete number and may charge you 0.20 because 123456 is the best match based on the LCR system.

Does this sound possible to you?

Kind Regards,

Les


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Tue May 11, 2010 9:08 pm 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
Hi,
I just tested this patch on my production environment and let me tell you there's nothing like live testing.

I just did not work, or it worked on A2B, but my providers do apply LCR on the call, and as LES mentioned they charge me a different cost per minute of what I bill to my customers.

So, I am billing the cheapest route and rating the call with the cheapest value, but my providers bills me based on the longest prefix of the dialed number.

So, no success on this patch, well, at least I tried... and I will keep trying :)

If you have any suggestions.... please let me know.

Kind regards
Christian



christancho wrote:
Hi Les,
Yes, If your provider has that behavior the proposed fix would not work, however I just checked 3 of my providers and no one has the ratecard provided, at least no one has the 1 for US, all have a long prefix.

I will place this fix on my production environment for a few hours and I will share the results.

Kind regards
Christian

LFCII wrote:
Hi,

Using different provider/trunk your data looks correct.

What happens if you have the same provider/trunk with different rates?

Example:

Provider A

Prefix Rate
1 0.01
123 0.05
123456 0.20

Number dialed is 1234567890

Based on your mod the prefix/rate picked would be 1,0.01.

However, the provider/trunk just sees the complete number and may charge you 0.20 because 123456 is the best match based on the LCR system.

Does this sound possible to you?

Kind Regards,

Les


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Wed May 12, 2010 12:25 am 
Offline

Joined: Tue Aug 19, 2008 3:49 pm
Posts: 184
Hi,

You are halfway there. Maybe try the following?

1. Sort to find the closet prefix match within each provider.

2. Sort to find the LCR between the providers sorted in step one.

3. Rinse and repeat until call is connected or all provider/trunk/rates have been tried.

Maybe

Kind Regards,

Les


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Thu May 13, 2010 4:50 pm 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
Hi,
Yes, the solution is kinda that way... this is what I did...

1. Do not remove the shortest routes.
2. Pick the longest route per provider, if you have 4 providers the result will be 4 routes with the longest prefix per provider.
3. According to the LCR type, sort them!
4. Testing.

Looks like it works now, and the provider rates me the correct cost, and I bill the cheapest and longest route to my customers... I will do more testing and I will share my results.

kind regards
Christian


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Thu May 13, 2010 8:10 pm 
Offline

Joined: Tue Aug 19, 2008 3:49 pm
Posts: 184
christancho wrote:
Hi,
Yes, the solution is kinda that way... this is what I did...

1. Do not remove the shortest routes.
2. Pick the longest route per provider, if you have 4 providers the result will be 4 routes with the longest prefix per provider.
3. According to the LCR type, sort them!
4. Testing.

Looks like it works now, and the provider rates me the correct cost, and I billing the cheapest and longest route to my customers... I will do more testing and I will share my results.

kind regards
Christian


Hi Christian,

Longest Prefix is what I was trying to say with "closet prefix".

When creating ratecards, are you using one provider/trunk per ratecard or are you having multiple providers/trunks in one ratecard?

Your sort might not give you the best results if you are doing the latter.

However, if it works okay using the former, one would just need to make sure the followed the one provider/trunk rule to be successful?

Kind Regards,

Les


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Fri May 14, 2010 1:35 am 
Offline

Joined: Tue Nov 25, 2008 8:49 pm
Posts: 42
Location: Canada
Hi Les,
I'm using one ratecard per provider/trunk... it is easier to manage than one ratecard with multiple providers.

I'm applying my changes to my production environment... let's see what happens.... I will share my results.

kind regards
Christian


Top
 Profile  
 
 Post subject: Re: LCR issue solved, please check my results
PostPosted: Fri May 14, 2010 2:30 am 
Offline

Joined: Tue Aug 19, 2008 3:49 pm
Posts: 184
Hi Christian,

So if provider A has Green, Blue, and Red rates you would set up three ratecards?

If provider B has Yellow, Brown, and Black rates you would set up three ratecards for a total of 6 ratecards?

You would then add these six ratecards to one call plan?

In theory, I would think, your logic should work. What if there is a tie?

Also, how good are you with PHP and Mysql?

Kind Regards,

Les


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group