Support A2Billing :

provided by Star2Billing S.L.

Support A2Billing :
It is currently Thu Mar 28, 2024 5:27 pm
VoIP Billing solution


All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: rate simulator in a2billing web not work
PostPosted: Sat Jun 23, 2007 12:57 pm 
Offline

Joined: Sat May 26, 2007 9:02 am
Posts: 14
Hi there!
Looks very strange but a2b's both admin's one and user's one "Rate simulator" doesnt work.
In case of admin's page it consume 2 parameters callednumber and id of ratecard.When I enter correct data and submit (was checked alternativly by taking corresponding QUERY from script and by running it in mysql client successfully) script does nothing. No expected or unexpected output but just returns to the form suggesting to enter phone number, ratecard again.
Corresponding URL is like:
GET /Public/CC_entity_sim_ratecard.php?called=01174959690606&id_cc_card=1 HTTP/1.1
The user's those instead returns error output "Error : Not enough credit to call !!!" and "The number, you have entered, is not correct!" thought there are good ballance and entered phone is correct. URL looks different in this case:
GET /simulator.php?called=01174959690606&image16.x=46&image16.y=16 HTTP/1.1
I'm in stuck. Do anybody have faced this? Any ideas? I'm not a php-programmer, but I will appreciate even patching advices :O)


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 23, 2007 1:45 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
This means that the simulator did not find any matching route and rate. I can assure you that the simulator works right out of the box.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 23, 2007 5:14 pm 
Offline

Joined: Sat May 26, 2007 9:02 am
Posts: 14
asiby wrote:
This means that the simulator did not find any matching route and rate. I can assure you that the simulator works right out of the box.

It sounds VERY strange... I can make calls to the corresponding route and rate_engine can find corresponding rate during a call. May be that is due to different queries used in web and in time of call processing? The query I found in A2BCustomer_UI/lib/Class.RateEngine.php is very complex. When I tried to process it in mysql-client latter said "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='" and refused to execute. I'd try to make it more simple but I was afraid I would miss some background nuance that author have foreseen.

Added after 1 hours 13 minutes:

asiby wrote:
This means that the simulator did not find any matching route and rate. I can assure you that the simulator works right out of the box.

Ok. I've digged inside script and found that when I try to find a rate to 01174956960606 (just f.e. because I now I can call there) simulator executes following query:
SELECT tariffgroupname, lcrtype, idtariffgroup, cc_tariffgroup_plan.idtariffplan, tariffname, destination, cc_ratecard.id, dialprefix, destination, buyrate, buyrateinitblock, buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge, stepchargea, chargea, timechargea, billingblocka, stepchargeb, chargeb, timechargeb, billingblockb, stepchargec, chargec, timechargec, billingblockc, cc_tariffplan.id_trunk AS tp_id_trunk, tp_trunk.trunkprefix AS tp_trunk, tp_trunk.providertech AS tp_providertech, tp_trunk.providerip AS tp_providerip, tp_trunk.removeprefix AS tp_removeprefix, cc_ratecard.id_trunk AS rc_id_trunk, rt_trunk.trunkprefix AS rc_trunkprefix, rt_trunk.providertech AS rc_providertech, rt_trunk.providerip AS rc_providerip, rt_trunk.removeprefix AS rc_removeprefix, musiconhold, tp_trunk.failover_trunk AS tp_failover_trunk, rt_trunk.failover_trunk AS rt_failover_trunk, tp_trunk.addparameter AS tp_addparameter_trunk, rt_trunk.addparameter AS rt_addparameter_trunk FROM cc_tariffgroup RIGHT JOIN cc_tariffgroup_plan ON (cc_tariffgroup.id=4) INNER JOIN cc_tariffplan ON (cc_tariffplan.id=cc_tariffgroup_plan.idtariffplan ) LEFT JOIN cc_ratecard ON (cc_ratecard.idtariffplan=cc_tariffplan.id) LEFT JOIN cc_trunk AS rt_trunk ON (cc_ratecard.id_trunk=rt_trunk.id_trunk) LEFT JOIN cc_trunk AS tp_trunk ON (cc_tariffplan.id_trunk=tp_trunk.id_trunk) where (dialprefix=SUBSTRING('01174959690606',1,length(dialprefix)) OR dialprefix='defaultprefix') AND startingdate<= CURRENT_TIMESTAMP AND (expirationdate > CURRENT_TIMESTAMP OR expirationdate IS NULL OR LENGTH(expirationdate)<5) AND startdate<= CURRENT_TIMESTAMP AND (stopdate > CURRENT_TIMESTAMP OR stopdate IS NULL OR LENGTH(stopdate)<5) AND (starttime <= 8247 AND endtime >=8247) AND idtariffgroup='4' AND (cc_tariffplan.dnidprefix LIKE '01174959690606%' OR cc_tariffplan.dnidprefix='all') ORDER BY LENGTH(dialprefix) DESC;
Exactly as above this query returns nothing. But when I cut of this query that condition:
AND (cc_tariffplan.dnidprefix LIKE '01174959690606%' OR cc_tariffplan.dnidprefix='all')
Query runs fine! Probably I'll try to comment this code out and check the web's result...

Added after 15 minutes:

andy0 wrote:
asiby wrote:
This means that the simulator did not find any matching route and rate. I can assure you that the simulator works right out of the box.

It sounds VERY strange... I can make calls to the corresponding route and rate_engine can find corresponding rate during a call. May be that is due to different queries used in web and in time of call processing? The query I found in A2BCustomer_UI/lib/Class.RateEngine.php is very complex. When I tried to process it in mysql-client latter said "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='" and refused to execute. I'd try to make it more simple but I was afraid I would miss some background nuance that author have foreseen.

Added after 1 hours 13 minutes:

asiby wrote:
This means that the simulator did not find any matching route and rate. I can assure you that the simulator works right out of the box.

Ok. I've digged inside script and found that when I try to find a rate to 01174956960606 (just f.e. because I now I can call there) simulator executes following query:
SELECT tariffgroupname, lcrtype, idtariffgroup, cc_tariffgroup_plan.idtariffplan, tariffname, destination, cc_ratecard.id, dialprefix, destination, buyrate, buyrateinitblock, buyrateincrement, rateinitial, initblock, billingblock, connectcharge, disconnectcharge, stepchargea, chargea, timechargea, billingblocka, stepchargeb, chargeb, timechargeb, billingblockb, stepchargec, chargec, timechargec, billingblockc, cc_tariffplan.id_trunk AS tp_id_trunk, tp_trunk.trunkprefix AS tp_trunk, tp_trunk.providertech AS tp_providertech, tp_trunk.providerip AS tp_providerip, tp_trunk.removeprefix AS tp_removeprefix, cc_ratecard.id_trunk AS rc_id_trunk, rt_trunk.trunkprefix AS rc_trunkprefix, rt_trunk.providertech AS rc_providertech, rt_trunk.providerip AS rc_providerip, rt_trunk.removeprefix AS rc_removeprefix, musiconhold, tp_trunk.failover_trunk AS tp_failover_trunk, rt_trunk.failover_trunk AS rt_failover_trunk, tp_trunk.addparameter AS tp_addparameter_trunk, rt_trunk.addparameter AS rt_addparameter_trunk FROM cc_tariffgroup RIGHT JOIN cc_tariffgroup_plan ON (cc_tariffgroup.id=4) INNER JOIN cc_tariffplan ON (cc_tariffplan.id=cc_tariffgroup_plan.idtariffplan ) LEFT JOIN cc_ratecard ON (cc_ratecard.idtariffplan=cc_tariffplan.id) LEFT JOIN cc_trunk AS rt_trunk ON (cc_ratecard.id_trunk=rt_trunk.id_trunk) LEFT JOIN cc_trunk AS tp_trunk ON (cc_tariffplan.id_trunk=tp_trunk.id_trunk) where (dialprefix=SUBSTRING('01174959690606',1,length(dialprefix)) OR dialprefix='defaultprefix') AND startingdate<= CURRENT_TIMESTAMP AND (expirationdate > CURRENT_TIMESTAMP OR expirationdate IS NULL OR LENGTH(expirationdate)<5) AND startdate<= CURRENT_TIMESTAMP AND (stopdate > CURRENT_TIMESTAMP OR stopdate IS NULL OR LENGTH(stopdate)<5) AND (starttime <= 8247 AND endtime >=8247) AND idtariffgroup='4' AND (cc_tariffplan.dnidprefix LIKE '01174959690606%' OR cc_tariffplan.dnidprefix='all') ORDER BY LENGTH(dialprefix) DESC;
Exactly as above this query returns nothing. But when I cut of this query that condition:
AND (cc_tariffplan.dnidprefix LIKE '01174959690606%' OR cc_tariffplan.dnidprefix='all')
Query runs fine! Probably I'll try to comment this code out and check the web's result...


Well. Now I have working web's simulator. Asiby, what functionality will suffer without "AND (cc_tariffplan.dnidprefix LIKE '01174959690606%' OR cc_tariffplan.dnidprefix='all')" in the rate_engine_findrates or whatever other places?

really I cannot see any reason in that construction "cc_tariffplan.dnidprefix LIKE '$mydnid%'" 'cos of $mydnid in most cases is telephone number given by user and it's very uprobably that someone's dnidprefix will have that length.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 24, 2007 12:59 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
Hmmm, strange indeed. Is it possible that you are not removing prefixes from your tariffplan or in the trunk settings? Because if the query is being executed with this value, I doubt that it will find anything because usually, we do not include 011 in our dialing prefixes when creating rates. So my suggestion is that you try to remove the 011 prefixes automatically. That could be the solution.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 24, 2007 8:05 am 
Offline

Joined: Sat May 26, 2007 9:02 am
Posts: 14
asiby wrote:
Hmmm, strange indeed. Is it possible that you are not removing prefixes from your tariffplan or in the trunk settings? Because if the query is being executed with this value, I doubt that it will find anything because usually, we do not include 011 in our dialing prefixes when creating rates. So my suggestion is that you try to remove the 011 prefixes automatically. That could be the solution.

Yes, I keep 011* routes with 011-prefix. The reason of doing that is A-Z routes terminators accept full route (i.e. with 011). I'll try to research how situation can be improved.
supermega10x


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 24, 2007 1:31 pm 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
I know, but even so, remove the prefix from the tariffplan, but let the trunk add the prefis to see if it will act differently.

Even if you do A to Z terminations, many provider that I have seen and used do not required that you keep that 011 prefix. They can successfully know where to route the call cause they know every single country code.

How did you set up you Rate Cards? What did you use for DNID Prefix?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 3:37 am 
Offline

Joined: Wed Mar 15, 2006 8:46 am
Posts: 109
Hi, Asiby

(For version 1.3)

I have same issue,
I can't get it work even on demo site.
Could you please help to make a working example on demo site (both of admin & user)?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 5:35 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
No problem. I am on it.

Added after 1 hours 1 minutes:

Done. Login to the admin demo site and try the card id #7 or card id #68805 to test the rate simulator for the following area codes:

1-705-NXX-XXXX
1-807-NXX-XXXX
1-647-NXX-XXXX
1-416-NXX-XXXX
1-613-NXX-XXXX
1-819-NXX-XXXX
233-NXX-XXXX or 011-233-NXX-XXXX



You can also log into the customer demo site and try the rate simulator for the same destinations.

The cards' informations are:

First Card
Card id# 7
Card# 7514726561
Card Alias: 12345
Card Password: 12345
----------------------------------
Second Card
Card id# 68805
Card# 2551769689
Card Alias: 853843243914936
Card Password: 0375348815
----------------------------------

Regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 6:05 am 
Offline

Joined: Wed Mar 15, 2006 8:46 am
Posts: 109
Ok, I got it,
I forgot to add my ratecard to my call plan.

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 03, 2007 6:22 am 
Offline
User avatar

Joined: Mon Apr 30, 2007 6:43 am
Posts: 1060
Location: Canada
You are very welcome. I am glad it helped.


Top
 Profile  
 
 Post subject: Fix without touching "much" code.
PostPosted: Sat Aug 11, 2007 2:13 am 
Offline

Joined: Sat Aug 11, 2007 1:59 am
Posts: 3
I also have created my prefixes as 00* and found that even when the calls get directed to the right rate the ratecard simulator wil not recognize those routes, so digging a little bit on the file CC_entity_sim_ratecard.php I found this bit of code. I believe that it says replace your 00 for 011, I just commented it out and simulator is working now.
I do not know if I am breaking anything else so Use at your own risk.


if ($called && $id_cc_card){


$calling=ereg_replace("^\+","011",$called);
$calling=ereg_replace("[^0-9]","",$calling);
$calling=ereg_replace("^01100","011",$calling);
// $calling=ereg_replace("^00","011",$calling);
$calling=ereg_replace("^0111","1",$calling);


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 02, 2007 9:13 am 
Offline

Joined: Tue Aug 07, 2007 6:46 pm
Posts: 19
Hi neonex,

I have also 00* dialling codes and your solution works for me!!!!

thanks,


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 14, 2008 9:27 am 
Offline
User avatar

Joined: Thu Jan 31, 2008 10:49 am
Posts: 23
Location: Amsterdam, Netherlands
Hi,

It worked for me also, I'm also using the 00 code.


Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 
Hosted Voice Broadcast


All times are UTC


Who is online

Users browsing this forum: No registered users and 8 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group