Search code examples
javasmpp

How to retrieve UDH from DeliverSM (logica smpp) and java


we use Java 1.6 and logica_smpp.1.3.7.jar

My issue is with concatenated messages. We always used the hasSarMsgRefNum method in the DeliverSM class to indicate that this is a multi message part.

However this was changed and we now receive GSM Short Message Service User Data as part of the DeliverSM.

I can get the esm_class of the DeliverSM that indicates to me this is a concatenated message part. I am having difficulty retrieving the actual User Data Header information that is in the beginning of the shortMessage field.

This is how I get the UDHI:

  byte udhi = (byte)Data.SM_UDH_GSM;

  if (del.getEsmClass() == udhi) {
      log.debug("This is a concatenated message part!");
  }

This is how I get the shortMessage:

  byte[] bytes = del.getShortMessage().getBytes();

However when I convert that to a String it looks like this:

  ^E^@^C�^B^This is part one of a test message...

I need to know how to convert that first part.


Solution

  • I solved this.

    I get the first 5 chars (header info).

      int char1 = del.getShortMessage().charAt(1);
      int char2 = del.getShortMessage().charAt(2);
    

    etc..

    The 3rd char is the message reference number. The 4th char is the total parts. The 5th char is the current part.

    I hope this helps somebody in the future :)