Hi Nikos,

1) I agree with you on that. But I thought by lack of billing possibilities
in bearerbox, I thought this might be a convenient hack. How would you
suggest to modify bearerbox?

2) Where otherwise would you put the price plan? It needs to be able to be
updated in a convenient way. If you put it in kannel.conf, it clutters the
configuration file and also it will need a reboot after a price change or
added route.

Does the current mysql version support a multi-table update? In that case,
we can get rid of 1 sql statement.

== Rene

-----Original Message-----
From: Nikos Balkanas [mailto:[email protected]] 
Sent: Sunday, 01 August, 2010 15:04
To: Rene Kluwen; [email protected]
Cc: [email protected]
Subject: Re: Discussion: Prepaid counting

Hi,

I can see a couple of problems in this approach.

1) Billing should be implemented in bearerbox, since it decides on final 
routing, not sqlbox.
2) There is an overuse of the DB. There is no need to put the priceplan in a

DB.

BR,
Nikos
----- Original Message ----- 
From: "Rene Kluwen" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>
Sent: Sunday, August 01, 2010 4:08 AM
Subject: Discussion: Prepaid counting


> Suppose I add 2 tables to sqlbox:
>
> mysql> describe sms_users;
> +---------+--------------+------+-----+---------+-------+
> | Field   | Type         | Null | Key | Default | Extra |
> +---------+--------------+------+-----+---------+-------+
> | binfo   | varchar(100) | NO   | PRI | NULL    |       |
> | balance | float(10,0)  | NO   |     | 0       |       |
> +---------+--------------+------+-----+---------+-------+
> 2 rows in set (0.00 sec)
>
> And:
>
> mysql> describe sms_rates;
> +---------+--------------+------+-----+---------+-------+
> | Field   | Type         | Null | Key | Default | Extra |
> +---------+--------------+------+-----+---------+-------+
> | prefix  | varchar(100) | NO   | PRI |         |       |
> | smsc    | varchar(100) | NO   | PRI |         |       |
> | rate    | float(10,4)  | NO   |     | 0.0000  |       |
> | country | varchar(255) | YES  |     |         |       |
> +---------+--------------+------+-----+---------+-------+
> 4 rows in set (0.00 sec)
>
> And suppose I match prefix/smsc against sms_rates and draw the variable
> "rate" from it.
>
> Next, I check the sms_users table with the binfo field (not sure if this 
> is
> a good idea or not) and I withdraw "rate" from "balance" if "balance" is 
> big
> enough. Once balance reaches 0, sqlbox will refuse to relay further 
> messages
> to bearerbox.
>
> Attached is a patch that does the trick (for now, only mysql engines). 
> Note:
> This code hasn't been tested yet and probably contains a bug or two.
>
> But I am posting it anyway to see what the almighty Kannel Developers have
> to say about it.
>
> This patch is especially useful if you want your clients to have access to
> an open smppbox with a limited amount of credits. But also it works for
> smsboxes and sqlboxes, as you please.
>
> I made a small patch to open smppbox that allows passing of binfo.
>
> == Rene
>
> 




Reply via email to