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

6 comments:

  1. wonderful, you have made my day
    :)

    ReplyDelete
  2. Hey laxaman nice article...But i get message as binary format...how can i make it text format using UDH....UDH will allow sending as only BINARY format...???Please help

    ReplyDelete
  3. With java You can try this:

    if (msg instanceof TextMessage) {
    TextMessage textMessage = (TextMessage) msg;
    redMsg = textMessage.getPayloadText();
    } else {
    BinaryMessage binaryMessage = (BinaryMessage) msg;
    byte data[] = binaryMessage.getPayloadData();
    redMsg = new String(data);
    }

    ReplyDelete
  4. Hi Laxman I need your help for sending binary(Picture)sms from kannel. If posible can you help me my mail id is ikiranreddy@gmail.com

    ReplyDelete
  5. Please I need Kannel Configration please ?

    ReplyDelete
  6. Hi Laxman I need your help for sending binary(Picture)sms from kannel. If posible can you help me

    ReplyDelete

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 . ...