Using individual meta-data fields on urls

With the addition of meta-data functionality in Kannel, now it’s possible to pass meta-data between different smsc’s and services.

When defining services or urls to send messages, the new %D parameter gets replaced with the complete meta-data information available.

However, there wasn’t any way to use only part of that data when posting to url’s. This is why I’ve created this patch that allows you to use individual meta-data fields in your urls.


To use it, a new set of parameters is defined, with the following format:


Where group is the meta-data group (for example: smpp, http or foo) and parameter is the individual meta-data parameter you want to replace.

For example, let’s suppose we’re using a generic http-smsc, and we want to pass a couple of extra parameters for a dynamic username and password (some aggregators do that). Right now, that would require patching the source code and inventing some method to pass the extra parameters from the sendsms interface.

With the patch applied, this would be as simple as this:

1. Pass the meta-data parameter on the sendsms request (urlencoded):


2. Define the send-url parameter on your http-smsc to pass those parameters:

send-url = http://myhost/sms?….&username=%#http#user#&password=#http#pass#

Note: I’m defining the http group here, but it could be anything, even the smpp group coming from an smpp bind, in which case the syntax would be #smpp#username# instead.

Download the patch from here.

Please try it and let me know if it works for you.

Comments (5)

LukaszNovember 25th, 2009 at 2:03 pm

Hi Alex,

When i saw this patch i couldn’t believe – you read in my mind cause this is exactly what i need:) I use the generic http smsc connection and i need to pass some custom parameters. I patched my CVS kannel with your patch but unfortunately it seems it doesn’t work.

I modified my send-url to include two additional fields, ‘msgclass’ and ‘option':

send-url = http://../..&msgclass=%#http#msgclass#&option=%#http#option#

When sending sms i am adding: &?http?msgclass=CLASS_0&option=205

Unfortunately, kannel is not adding these parameters. The values of ‘msgclass’ and ‘option’ are empty when send-url is invoked by kannel.

Do you have any clue what can be wrong? I would much appreciate your feedback on this.

Best wishes,

LukaszNovember 25th, 2009 at 2:05 pm

i forgot to add that “&?http?msgclass=CLASS_0&option=205″ that i am passing in the sendsms url is properly url-encoded. Still, it doesn’t add these optional parameters.


alexNovember 26th, 2009 at 3:39 am

Are you missing the “meta-data=” part when sending?

The right url should be something like “&meta-data=%3Fhttp%3Fmsgclass%3DCLASS_0%26option%3D205″

LukaszNovember 26th, 2009 at 5:50 am

Oh yes, i forgot about “meta-data=”. It works now!
Thanks so much for your help, great patch :)


priboedsusSeptember 14th, 2011 at 12:40 pm

Thanks Alex, your steps works amazing 😀

Leave a comment

Your comment