Changes in match_tariff function (sqlbill)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Michal.
I've changed you match_tariff function a little.
If it's needed to apply this schema:
the 1-st user must can place calls whit prefix 1234# with common price,
for the 2-nd user tariffs must be different for different destinations,
but he use 1234# prefix too,
and we use your variance of match_tariff, we need to write all destinations 
for both users:
user1 1234#1 price1
user2 1234#1 price2
user1 1234#2 price1
user2 1234#2 price3
user1 1234#3 price1
user2 1234#3 price4
...
In my variance we can to write destinations separately for each user:
user1 1234# price1
user2 1234#1 price2
user2 1234#2 price3
user2 1234#2 price4
.....
-- 
Best regards,
Igor Prokhorov
--- c_functions.sql	Fri Aug 27 05:36:45 2004
+++ c_functions_new.sql	Mon Aug 30 11:29:00 2004
@@ -84,10 +84,15 @@
 	-- find an active destination for the given e164 (longest prefix match)
 	IF length(e164) > 0 THEN
 		IF ascii(e164) >= 48 AND ascii(e164) <= 57 THEN
-			SELECT INTO dst * FROM voiptariffdst
-				WHERE active AND ascii(prefix) = ascii(e164)
+			SELECT INTO dst voiptariffdst.id, voiptariffdst.active, prefix,
+			    voiptariffdst.description 
+			    FROM voiptariffdst, voiptariff, voiptariffsel
+				WHERE voiptariffdst.active AND ascii(prefix) = ascii(e164)
 					AND (e164 LIKE (prefix || ''%''))
-				ORDER BY length(prefix) DESC
+					AND voiptariff.grpid=voiptariffsel.grpid
+					AND voiptariffsel.accountid=accid
+					AND voiptariff.dstid=voiptariffdst.id
+				ORDER BY length(prefix) DESC 
 				LIMIT 1;
 		ELSE
 			SELECT INTO dst * FROM voiptariffdst

[Index of Archives]     [SIP]     [Open H.323]     [Gnu Gatekeeper]     [Asterisk PBX]     [ISDN Cause Codes]     [Yosemite News]

  Powered by Linux