This Kannel patch fixes support for Sqlite2 (which was partially implemented but missed the configuration section) and also adds a new option “lock-timeout” for both [sqlite-connection] (newly added) and [sqlite3-connection] groups.
lock-timeout can be set to the number of milliseconds that sqlite waits before throwing a “BUSY” error. Because locking on sqlite is done AT THE DATABASE LEVEL, it can be a serious issue because any write operation would lock the entire database, so this option aims to ease the risk of getting locks.
If it’s not set, the default sqlite behaviour is maintained.
Here’s the patch:
kannel-sqlite-pool-patches
As usual, please try it and let me know what you think.
November 7th, 2008 in
Kannel | tags:
Kannel,
locking,
patches,
sqlite |
Comments Off on Sqlite2, Sqlite3, locking and friends
I’m now the maintainer for Sqlbox, and I’ve decided to start by writing proper Sqlbox Documentation.
I’m doing a refactoring on the build scripts to integrate Documentation into the build workflow (as Kannel does), will release my first Sqlbox source tree soon, but I wanted to release some Docs beforehand so other people can start using it.
Here’s a first approach at Sqlbox Documentation:
Sqlbox User Guide (PDF Format)
Sqlbox User Guide (HTML Format)
I know it still needs some polishing, but I hope it helps to ease the learning curve and installation questions that shows on Kannel’s mailing list from time to time.
I’ve married twice to the same woman.
I’ve rented my apartment to the guy that sold it to me.
Now I’m moving to Barcelona again.
Life always seemed kind of recursive for me. I wonder what comes next.
Alex.
October 30th, 2008 in
Misc | tags:
barcelona,
luggage,
moving,
planes,
travel |
Comments Off on Back to Barcelona
I’ve struggled in the past trying to build Kannel RPM packages or using packages built by other people. I’ve also read a lot of posts on Kannel Mailing Lists – you’re already a member isn’t it? 😉 – from people having problems with the packaged config files and/or this or that incompatibility.
Seeing this, I’ve decided to create an easy way to compile Kannel’s RPM and, at the same time get as close to a working installation as possible only by installing the RPM’s.
I’ve decided that the more user-friendly way to achieve this was to integrate the RPM build process into the regular compile cycle for Kannel. In other words, my approach to Kannel RPM’s is as easy as:
./configure
make rpm
rpm -i /usr/src/redhat/RPMS/i386/kannel-cvs-YYYYMMDD.i386.rpm
After installing the package, you’ll get a properly installed Kannel with the following features:
- MySQL support (for DLR’s and/or other packages.
- PCRE (Perl-Compatible Regular Expressions) support.
- OpenSSL support.
- Spool based store engine (spool folder located at /var/spool/kannel/).
- Init scripts already installed and chkconfig‘ed to run at boot time.
- All boxes run as user kannel (which is created at install time).
- wapbox is disabled by default (but could be easily enabled by changing one line on the init script and restarting the service).
- Config files are on /etc/kannel/
- Log files are on /var/log/kannel/
The config file is ready to run with a single fakesmsc connection running on port 10000 (so you can run fakesmsc from the command line and start testing your setup right after installing the RPM).
To get all this nice features working on your own box, you have to follow this easy steps:
- Download the latest CVS HEAD from the Kannel Website. It can be by CVS or the latest snapshot.
- Download this file and extract it into the Kannel Source tree. You’ll have an rpm folder at the same level as gw, gwlib, test, etc.
- Download this patch file, copy it to your Kannel source tree and apply the patch with:patch -p0 < kannel-rpm.patch
- Run autoconf to rebuild the configure file. This is only needed once after applying the patch. Sometimes I’ve got an error about a missing macro (unrelated with the patches we’ve just made), but the new configure file is created and works anyway, so I assume it’s safe to ignore it.
- Run ./configure . Do not put any switches here, they’ll be blatantly ignored by the RPM anyway, so if you expected to be able to put your special switches on the RPM, you’re out of luck (at least by now).
- Run make rpm to build the RPM’s. At the end, you’ll get a message indicating the final location of your files (which is usually /usr/src/redhat/RPMS, (unless you redefined %_topdir on your .rpmmacros or did any other similar hack for what matters).
- Install the RPM (you don’t need my help at this point right? 😉
- Start the service with service kannel start and start playing with it!
If you encounter any problems running the service, check on /var/log/kannel and see if you can figure out what went wrong.
As a side note, you’ll also get a kannel-devel and kannel-debug RPM packages, and a source RPM on the SRPMS folder. You can use this later to tweak it and build your own package if you want to.
Enough said, please try it out and let me know if it worked for you.
Alejandro Guerrieri
October 9th, 2008 in
Kannel | tags:
build,
Kannel,
rpm |
20 Comments
This patch adds an alternative storage engine that uses mysql as backend, instead of a big file or a spool directory. This makes some interesting setups possible and also allows to ease the disk I/O on the server (by using an external MySQL engine).
To use it, you first need to create a MySQL database, and a table to hold the store messages. We’ll use “kannel” as DB Name and “store” as the table name, but you can choose whatever you want and modify the config file to reflect your setup (more on this later).
To create the “store” table, run the following SQL query:
CREATE TABLE store ( uuid VARCHAR(36) NOT NULL PRIMARY KEY, message TEXT );
Again, you can rename the fields and modify the config to reflect your environment.
Then, on kannel.conf, you need to add a store-db group, and a mysql-connection pool:
group = mysql-connection
id = mypool
host = localhost
username = <user>
password = <password>
database = kannel
max-connections = 1
group = store-db
id = mypool
table = store
field-uuid = uuid
field-message = message
Last but not least, set the store-type to use the mysql storage engine on the core group:
store-type = mysql
As you may have noticed, you can modify the fields table, field-uuid and field-message to suit your particular database schema.
Here’s the patch against latest CVS:
kannel-mysql-storage-engine
This needs further testing (do not use it for production -yet-), please try it and let me know if you find any problems.
October 4th, 2008 in
Kannel | tags:
Kannel,
mysql,
sms,
storage |
7 Comments
I’ve developed this PHP code back in 2004, to encode a Wap-Push into one SMS without using Kannel’s PPG (which at that time was a little hard to get it to work as expected).
Many people are still finding it useful, so I’m putting it here so it’s easier to find than on those clumsy mailing-list archives 🙂
To use it, you should fill both arrays ($fields and $kannel) with the relevant information and call send_wap_push(). You can define additional parameters on $fields and they’ll get passed on the sendsms request.
Here’s the code: send_wap_push
September 29th, 2008 in
Kannel | tags:
Kannel,
php,
wap-push |
3 Comments
This patch adds support for the “%w” key on DLR’s, to get the message_id from the SMSC on SMPP connections.
Explanation: When Kannel sends an MT over an SMPP connection, a submit_sm PDU is sent. The carrier responds with a submit_sm_response, carrying a “message_id” attribute. If we have proper dlr-mask set, this event (the carrier accepting the message) causes Kannel to hit the dlr-url (even if the carrier’s not sending DLR’s).
After applying the patch, a new parameter %w could be added to the dlr-url, which will be loaded with the message_id from the SMSC. This can be useful to correlate sent messages with the carriers response.
Download the patch: kannel-response-message-id
This needs further testing, please try it and let me know if it worked for you (it does for me!).
September 29th, 2008 in
Kannel | tags:
dlr,
Kannel,
message_id,
patches,
submit_sm_reponse |
Comments Off on Getting the message_id from submit_sm_response
Like I usually do when I’m trying a new programming language, my first post in here should be named “Hello world”.
In this little web shack, I’ll try to keep track of what I’m doing in “codespace”, but I’ll probably also post some unrelated but yet interesting stuff about some of my other interests in life.
I hope you enjoy reading it.
Regards,
Alejandro Guerrieri
September 28th, 2008 in
Misc |
Comments Off on Hello world