This patch will definitely have its place for many people's requirement, but it's not generic enough for general usage imho.
Personally speaking, I don't like the idea of clogging any boxes' code with non-generic stuff. The billing approach would work for some people, but surely won't be flexible enough for others. I like Stipe's "plugin approach" on his (commercial) smppbox: messages can be routed thru plugins, where you can implement all kind of stuff and add/remove them from your message pipeline. Using that approach, all kind of billing mechanisms could be implemented (along with many other stuff of course). Regards, -- Alejandro Guerrieri [email protected] On 01/08/2010, at 03:08, Rene Kluwen wrote: > 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 > > <prepaid_1.patch>
