Disclaimer: These archives are mirrored from smsforum.net in 2007 before the forum got closed. Please only part of the forum is available here.
For any clarifications regarding these archives you can contact us at http://www.telecomspace.com/contact.


+  SMS Forum Online Discussion
|-+  SMS Technologies
| |-+  GSM-Related (Moderator: SMS Forum Support)
| | |-+  urgent!!! Help regarding converting GSM PDU
« previous next »
Pages: [1] Go Down Print
Author Topic: urgent!!! Help regarding converting GSM PDU  (Read 462 times)
Full Member
Offline Offline

Posts: 28

« on: December 19, 2006, 14:15:10 UTC »


The hex-string PDU from a GSM modem is a s follows

0791448720003023040C91447790335322000460218161938 000250021010EC078000100C0FFFF00000200C0FFFF000003 0000000000000400000000000058B1

The data is 8-bit binary data.
i have extracted the message part which is as follows

0021010ec078000100c0ffff00000200c0ffff00000300000 00000000400000000000058b1

Now i am converting this into a byet array

      ///Method hextoBytes
      byte[] bts = new byte[hex.length() / 2];
      for (int i = 0; i < bts.length; i++) {
         bts = (byte) Integer.parseInt(hex.substring(2*i, 2*i+2), 16);

and trying to store it in an instance of deliverSM (since I am designing a store and forward
message center all the incomming messages will be stored as SMPP units and will
be sent to SMPP clients)

then i create a DeliverSM

//manually set the orginator; sender addresses
//set the message

                 org.smpp.util.ByteBuffer message = new org.smpp.util.ByteBuffer();

            /////Is this correct way of setting binary data?
            /////The method is the same as the one in SubmitSM

            org.smpp.util.ByteBuffer NEWbuffer = new org.smpp.util.ByteBuffer(DeliverSMdeliverSM.getData().getBuffer());
        PDU NEWpdu = PDU.createPDU(NEWbuffer);
        org.smpp.pdu.DeliverSM NEWdeliverSM = (org.smpp.pdu.DeliverSM) NEWpdu;
        System.out.println("\nNEW mESSAGE FROM fILKE:" + NEWdeliverSM.debugString());

Eventually when the deliverSm is sent to a SMPP cleint I get a checksum error.
I am not able to find out where I am going wrong?
any help regarding this will be great

- there isnt a method in DeliverSM to set/submit binary message (i have modified the source
code to - the code is same as SubmitSM)
Full Member
Offline Offline

Posts: 28

« Reply #1 on: December 21, 2006, 09:43:27 UTC »

ok, I got this working, like I mentioned - i was trying to convert a SMS(it has binary data) received via GSM modem into SMPP recognizable format.

I have used SMSLIB from sourceforge to read/write messages via GSM modem,
using this library I am able to extract the complete PDU as a hex string,

for e.g.

the complete/full PDU is a s follows
0791448720003023040C91447790335322000460218161834 5005500510109C075013F7C0CEB28BF313230313039323334 313037313830303635373635000F034D41545454455354310 0000000005481020F81000000004D41545454455354320000 0000005400010E8100000000D479

sender/receiver addresses can be fetched thro the API, the information in the PDU can be verified thro this link

On viewing this using this link 
I was able to see the following
TimeStamp:18/12/06 16:38:54
TP_DCS-popis:Uncompressed Text
<binary data>

the #clean# PDU is  (binary message is extracted from the full PDU)
00510109C075013F7C0CEB28BF31323031303932333431303 7313830303635373635000F034D4154545445535431000000 00005481020F81000000004D4154545445535432000000000 05400010E8100000000D479
they do look identical, starting from the end -> beginning - up to a certain point where the header appears. 

Then I convert this hex string to a byte array by this code
From this PDU I extract the message part alone, so the clean PDU (binary message looks something like )

public synchronized byte[] hextoBytes(String hex) {
System.out.println("Hex is:" + hex);
byte[] bts = new byte[hex.length() / 2];
for (int i = 0; i < bts.length; i++) {
bts = (byte) Integer.parseInt(hex.substring(2*i, 2*i+2), 16);
return bts;

I then create an instance of org.smpp.util.ByteBuffer with this byte array, then I set this ByteBuffer in an instance of DeliverSM; this deliverSM will then be delivered to the SMPP clients.

The assumption while creating a DeliverSM is that - if the message has 8-bit data; then the DataCoding will be set to ((byte)4) ; if the message has 7-bit data; then the DataCoding will be set to ((byte)0) ; with hte ESM class being set to Data.SM_ESM_DEFAULT.

This way I am able to convert a SMS received via GSM modem to SMPP format.
Pages: [1] Go Up Print 
« previous next »
Jump to:  

Login with username, password and session length