Wednesday, February 11, 2009

kannel send sms to specific port

To send sms to a specific port number ( eg: port in your j2me application ) you have to add following extra parameter to kannel send sms url

udh=

which will specify the User Data Header of the sms. For example following url will send the sms to port 6579

http://127.0.0.1:13013/cgi-bin/sendsms?username=[kannel user]&password=[kannel passwd]&to=[to phone number]&text=[message text]&udh=%06%05%04%19%B3

As you can see udh is a url-encoded string and it have a standard format as follows;

[how long the UDH is] [the format used to specify ports numbers] [the port number length] [destination port number] [source port number]

As a practical example, say I want to create a UDH to send a sms to port 2948, the UDH will be:

06 05 04 0B 84 23 F0 -> 06%05%04%0B%84%23%F0

where:

* 06 means "hey read the following 6 bytes"
* 05 is the format for numbers, in this case hexadecimal numbers
* 04 will tell the UDH that each port is represented using 4 character
* 0B84 is the destination port in hexadecimal, 2948 (decimal representation)
* 23F0 is the source port in hexadecimal, 9200 (decimal representation) or 23F0 (hexadecimal representation).

You have to keep in mind that after adding udh to the url, sms will be transfred as a binary messaage.

Ref:http://mobiforge.com/developing/story/binary-sms-sending-rich-content-devices-using-sms

kannel sms delivery report workout

1) Add one of the following options to core group of kannel configuration. If you use mysql as dlr-storage you have to configure two more groups to associate mysql with kannel. If you use dlr-storage=internal skip step 2. If you use dlr-storage=internal the data is not tangible according to my knowledge. Also keep in mind that there are other parameters for dlr-storage which we can use to connect with other databases like postgresql

dlr-storage = internal
dlr-storage = mysql

2) If you use mysql add following two groups to kannel.conf (or to separate file and include that file). Put your database username and password to the place of [db user] and [db passwd] . Group dlr-db uses to specify the table and map the feilds together. if you configure for mysql, the message will be temporarily stored in the table until it reaches the destination.

group = mysql-connection
id = mydlr
host = localhost
username = [db user]
password = [db passwd]
database = kannel
max-connections = 1

group = dlr-db
id = mydlr
table = dlr
field-smsc = smsc
field-timestamp = ts
field-destination = destination
field-source = source
field-service = service
field-url = url
field-mask = mask
field-status = status
field-boxc-id = boxc

Thats all for kannel.conf...

3) Now you have to introduce following extra parameters to your kannel send sms url

dlr-mask=
dlr-url=


dlr-mask specifies the types of reports which kannel should generate. dlr-url specifies the url which will be called when the delivery report is received. For dlr-mask you can use one of the following mask numbers or any combination of them.

1: delivery success

2: delivery failure

4: message buffered

8: smsc submit

16: smsc reject

If you want multiple report types, you simply add the values together. For dlr-url you have to provide a url-encoded url for example
url:
http://localhost/sms/inc/deliveryReport.php?user=john&passwd=1234&type=%d&receiver=%p&reply=%A&time=%t&usr=%n&message=%b
urlencoded url:
http%3A%2F%2Flocalhost%2Fsms%2Finc%2FdeliveryReport.php%3Fuser%3Djohn%26passwd%3D1234%26type%3D%25d%26receiver%3D%25p%26reply%3D%25A%26time%3D%25t%26usr%3D%25n%26message%3D%25b

If you use php to interact with kannel you can easily generate urlencoded url using urlencode() function.


finally the resulting url is like this
http://localhost:13013/cgi-bin/sendsms?username=[kannel user]&password=[kannel passwd]&to=[to phone number]&text=[message text]&dlr-url=http%3A%2F%2Flocalhost%2Fsms%2Finc%2FdeliveryReport.php%3Fuser%3Djohn%26passwd%3D1234%26type%3D%25d%26receiver%3D%25p%26reply%3D%25A%26time%3D%25t%26usr%3D%25n%26message%3D%25b&dlr-mask=7

here I have used dlr-mask=7 so it will report following three types;
1: delivery success

2: delivery failure

4: message buffered

Intel Corporation XMM7360 LTE Advanced Modem in ArchLinux

The required packages are available in ArchLinux User Repository (AUR) so it will be easier if you can use an AUR helper package like yay . ...