Store Tools for Kannel
One of the problems with Kannel’s store formats is that they’re binary packed and it’s not easy to manipulate them. Specially with the store-file format, getting rid of a single message requires editing the binary file and it’s not a trivial task. Converting between file and spool formats it’s not easy, and if you want to export the content to some other format you need to rely on the web interface.
That’s why I’ve created these simple store-manipulation program: store_tools.
What store_tools do is to read the store location and format from your kannel.conf file and allows you to perform a series of commands with it. The available commands are:
| list [limit/start] [limit] | Allows you to list the content of the store. Optional parameters allows you to list limit records, or start at a given record and also limit the amount returned. |
| delete <uid> | Allows you to delete a message. You can retrieve the uid by using the list command. |
| export <format> <location> | Allows you to export the store into another format. Possible formats are: text, xml, html, spool and file. <location> specifies the path where you want the exported data to be written. |
NOTE: Since the delete command modifies the store, you should do it with kannel stopped.
Please download the patch here: kannel_store_tools
Please try it and let me know if it works for you.
-Alex-
I’m running the stock kannel from CentOS 5.3 and I’ve also installed the kannel-devel and libxml2 package. Now how do I compile your code? I don’t have the complete kannel source and don’t intent to rebuild it.
The code is intended to be built along with the rest of Kannel, a lot of macros and definitions are inherited from other parts of the code.
The easy way is to compile it with the rest, you don’t need to _install_ kannel again anyway, just compile it and then copy the store_tools executable from the test/ folder on the source tree.
Thanks for the reply. As suggested, I’ve managed to built it with the source rpm of the same version that is installed on my system. I haven’t got any message in the store file yet but when I tested listing it, I’m getting a segmentation fault at the end of the output. I’m running kannel-1.4.2-1.
$ store_tools -c /etc/kannel.conf list
Listing records 1 -> 100
+-���<————————————-+-p��<———–+- ��<———–+-���<—————+-�rj—————————————————+
| message id | from | to | smsc | text |
+-p��<————————————-+-p��<———–+- ��<———–+-���<—————+—————————————————-+
| Store is Empty |
+- ��<————————————-+- ��<———–+-`��<———–+-p��<—————+-���<—————————————————+
Segmentation fault
Hey !
I am already using kannel. Can you please guide me how to add this patch into Live Kannel ?
You need to patch the source code (usually placing the file on your source code root and running something like “patch -p0 < kannel_store_tools.patch") and recompile. You'll find the store_tools executable on the test/ folder.
I’m using Kannel v1.4.3 and i recompiled all the application, with your tool included. It created the store_tools executable in the test folder, but it also gives me segmentaion fault:
store_tools -c ~/kannel/config/kannel.conf list
Listing records 1 -> 100
Segmentation fault
Do you have an ideea why this is happening?
Can you give me more information? Platform? 32/64 bits? A backtrace from gdb would be useful as well.