opentelecoms-org / jsmpp

SMPP implemented in Java
Apache License 2.0
232 stars 164 forks source link

7bit long message split into 153 bytes using UDH 1 byte #168

Closed prancius closed 1 year ago

prancius commented 2 years ago

Hi,

I am using jsmpp for some time, but now need to solve one problem. Actually via protocol description we should be able to send long message using fragments of 153 bytes. With jssmpp it is possible only with fragments of 152 because UDH is 2 16bit length, otherwise smsc response 45 error.

Any suggestion to fragment 7bit long message into 153 bytes via jsmpp

`int totalSegments = getTotalSegmentsForTextMessage(data, Main.splitSimpleLength); String[] msgId = new String[totalSegments];

            Random random = new Random();
            OptionalParameter sarMsgRefNum = OptionalParameters.newSarMsgRefNum((short) random.nextInt());
            OptionalParameter sarTotalSegments = OptionalParameters.newSarTotalSegments(totalSegments);

            for (int i = 0, seqNum = 0; i < totalSegments; i++)
            {
               seqNum = i + 1;

               OptionalParameter sarSegmentSeqnum = OptionalParameters.newSarSegmentSeqnum(seqNum);

                       msgId[i] = session.submitShortMessage("CMT", sourceAddressTone,
                             NumberingPlanIndicator.UNKNOWN, sender_, TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.ISDN, 
                             receiver_, new ESMClass(), (byte) 0, (byte) 1, timeFormatter.format(new Date()), null, 
                             registeredDelivery, (byte) 0, dataCoding, (byte) 0, getSegmentData(data, i, Main.splitSimpleLength), sarMsgRefNum, sarSegmentSeqnum, sarTotalSegments);

                       System.out.println("Message id  for segment " + seqNum + " out of totalsegment " + totalSegments + " is " + msgId[i]);
            }

            response.setIds(msgId);
            response.setTotalSegments(totalSegments);`
prancius commented 2 years ago

Solved https://github.com/uudashr/jsmpp/blob/master/jsmpp-examples/src/main/java/org/jsmpp/examples/SubmitMultipartMultilangualExample.java

Thank you