I'm working with my first setup of A2billing (and am new to Postgres too), so take this w/ a grain of salt.
My calls made it into AGI and a2billing.php but were getting stuck at the rating process.
I figured I needed to get the RateSimulator? woring first, as it wasn't returning errors nor any results. Working my way through /A2Billing_UI/Public/CC_entity_sim_ratecard.php and then A2Billing_UI/lib/Class.RateEngine?.php, I think I found a bug.
Postgres 8.3.1 does not seem to like this in the rate look up query at Class.RateEngine:113
LENGTH(expirationdate)<5
Postgres gives me this error for the following query:
ERROR: function length(timestamp without time zone) does not exist
LINE 1: ... > CURRENT_TIMESTAMP OR expirationdate IS NULL OR LENGTH(exp...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
in response to the ratesimulate query generated by a2billing:
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, id_outbound_cidgroup,
freetimetocall_package_offer, freetimetocall, packagetype, billingtype, startday,
id_cc_package_offer FROM cc_tariffgroup RIGHT JOIN cc_tariffgroup_plan ON
cc_tariffgroup_plan.idtariffgroup=cc_tariffgroup.id 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 LEFT JOIN cc_package_offer ON
cc_package_offer.id=cc_tariffgroup.id_cc_package_offer WHERE cc_tariffgroup.id=1 AND
(dialprefix='19056921234' OR dialprefix='1905692123' OR dialprefix='190569212' OR
dialprefix='19056921' OR dialprefix='1905692' OR dialprefix='190569' OR
dialprefix='19056' OR dialprefix='1905' OR dialprefix='190' OR dialprefix='19' OR
dialprefix='1' 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 <= 7867 AND
endtime >=7867) AND idtariffgroup='1' AND (
dnidprefix=SUBSTRING('19056921234',1,length(dnidprefix)) OR (dnidprefix='all' AND 0 =
(SELECT count(dnidprefix) FROM cc_tariffplan RIGHT JOIN cc_tariffgroup_plan ON
cc_tariffgroup_plan.idtariffgroup=1 WHERE
dnidprefix=SUBSTRING('19056921234',1,length(dnidprefix)) ) )) AND (
calleridprefix=SUBSTRING('',1,length(calleridprefix)) OR (calleridprefix='all' AND 0 =
(SELECT count(calleridprefix) FROM cc_tariffplan RIGHT JOIN cc_tariffgroup_plan ON
cc_tariffgroup_plan.idtariffgroup=1 WHERE
calleridprefix=SUBSTRING('',1,length(calleridprefix)) ) )) ORDER BY LENGTH(dialprefix)
DESC
Removing " OR LENGTH(expirationdate)<5" and " OR LENGTH(stopdate)<5" from that query gives me correct results for the rate simulate.
I haven't a clue as to why they are there, but a fix/patch is probably best left to someone more familiar w/ A2B than I :-)