hello,
I use the default tariff and also need to assign an tariff to
an account.
here is the account:
id |
created | closed | disabled |
balance | balancelimit | currencysym
----+------------------------+--------+----------+---------+--------------+------------- 8 | 2005-08-27 09:50:57+08
| |
f | 79.6000
| 0.0000
| RMB
assign one prefix for long distance call.
id | active | prefix | description |
exactmatch ----+--------+--------+--------------+------------ 2 | t | 0 | longdistance | f create two tariff for the above
destination: id | dstid | grpid | price | currencysym |
initialincrement | regularincrement | graceperiod | description | active |
terminating
----+-------+-------+--------+-------------+------------------+------------------+-------------+-------------+--------+------------- 5 | 2 | 1 | 0.2000 | RMB | 60 | 60 | 0 | zhongchang | t | f 1 | 2 | | 0.3000 | RMB | 60 | 60 | 0 | 60/60 | t | f here is the tariff group: id | priority |
description
----+----------+------------- 1 | 1 | zhong and the assign the account with id=8 to group 1.
id | grpid |
accountid
----+-------+----------- 1 | 1 | 8 I want: the default tariff is 0.30/60s, and for account with
id=8, it use the tariff with 0.20/60s. but the result is not right, the user of
account id 8 use the default tariff 0.30/60s. and i check the sql in
match_tariff.
SELECT INTO dst.id, dst.active, trf.id D.id,
D.active, T.id
FROM voiptariffdst D LEFT JOIN voiptariff T ON T.dstid = D.id LEFT JOIN voiptariffgrp G ON T.grpid = G.id LEFT JOIN voiptariffsel S ON S.grpid = G.id WHERE NOT D.exactmatch AND (e164 LIKE (D.prefix || ''%'')) AND NOT T.terminating AND T.currencysym = curr AND (T.grpid IS NULL OR S.accountid = accid) ORDER BY length(D.prefix) DESC, G.priority DESC LIMIT 1; the default tariff (0.3) with G.priority= null and the tariff
(0.2) with G.priority=1,so the default tariff will be used, but in the readme,
there are one sentence:
If two or more tariffs are found for the same destination, a one that
belongs to a group associated with the particular account is selected (priority
over a default tariff).
Is there any wrong to create the data.
thx in advanced.
Victor
|