Help to convert GSM Modem PDU to SMPP PDU | Search |
NowSMS Support Forums ⬆ MMS & SMS Technical Discussions (unsupported) ⬆ Archive through April 05, 2007 ⬆ |
◄ ► |
Author | Message | |||
Deepak Angeswar New member Username: Angeshwar Post Number: 8 Registered: 09-2006 |
Hello, I am receiving SMS via GSM modem the data is binary (8-bit encoded) i am having some proble in converting this to SMPP format. i am storing the SMS as instances of DeliverSM. i am able to extract the source address, destination address and the actual message. while constructing a DeliverSM, I manually set all the mandatory parameters the header information is constructed automatically - since we do not know the overall length for setting the command_length (correct me if i am wrong here) however when i send the data to the SMPP client, I get a checksum error, obviously the data is not set correctly in the DeliverSM clarify me regarding the following - How can I construct a PDU header? do I need to create one? - How can i know with which mandatory field I am facing problem with? | |||
Deepak Angeswar New member Username: Angeshwar Post Number: 10 Registered: 09-2006 |
hello, i have found the solution for this... 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 0791448720003023040C914477903353220004602181618345005500510109C075013F7C0CEB28BF 313230313039323334313037313830303635373635000F034D415454544553543100000000005481 020F81000000004D415454544553543200000000005400010E8100000000D479 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 http://home.student.utwente.nl/s.p.ekkebus/portfolio/resource/sms_pdu.html#LINKS I was able to see the following ------------------------------------------- SMSC#+447802000332 Sender:+447709333522 TimeStamp:18/12/06 16:38:54 TP_PID:00 TP_DCS:04 TP_DCS-popis:Uncompressed Text class:0 Alphabet:8bit <binary data> ------------------------------------------- the #clean# PDU is (binary message is extracted from the full PDU) 00510109C075013F7C0CEB28BF313230313039323334313037313830303635373635000F034D4154 54544553543100000000005481020F81000000004D415454544553543200000000005400010E8100 000000D479 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[i] = (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. |