Concatenate messages

Dec 5, 2011 at 8:56 AM

is message_payload TLV supported?

I read from activexperts site, that All segmentation is handled by the network if whole message data (up to 65536 bytes) is copied to this field.

Please help me..

thanks in advance...

-Subith

Coordinator
Dec 5, 2011 at 1:58 PM

Subith,

Jamaa SMPP Library supports Tlvs, but you will need to write custom code to get the action you want.

That said, Jamaa SMPP library supports sending/receiving Tlvs but does not process them. You will need add logics in your code to

provide custom processing for Tlvs you want.

Ben

Dec 6, 2011 at 4:18 AM

Thanks for you quick reply Ben ..

I will try to work it out...

Apr 3, 2013 at 3:33 PM
hello you could you report me, if you managed to send messages via the message_payload
Mar 5, 2015 at 6:34 AM
Edited May 20, 2015 at 3:01 PM
To concatenate messages using TLV: (not payload)
TextMessage.cs (NOT SendSmPDU.cs)
                for (int i = 0; i < totalSegments; i++)
                {
                    udh.MessageSequence = i + 1;  // seq+1 , - parts of the message  
                    sm.Header.SequenceNumber = PDUHeader.GetNextSequenceNumber();
                    sm.Tlv.Clear();
                    sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_msg_ref_num, 2, SMPPEncodingUtil.GetBytesFromShort((ushort)SegID)));
                    //sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_total_segments, 2, SMPPEncodingUtil.GetBytesFromShort((ushort)totalSegments)));
                    //sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_segment_seqnum, 2, SMPPEncodingUtil.GetBytesFromShort((ushort)(i + 1))));
                    sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_total_segments, 1, new byte[] { (byte)totalSegments }));
                    sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_segment_seqnum, 1, new byte[] { (byte)(i + 1) }));
                    sm.SetMessageBytes(SMPPEncodingUtil.GetBytesFromString(messages[i], defaultEncoding));
                    yield return sm;
                }
Apr 17, 2015 at 11:21 PM
Edited Apr 17, 2015 at 11:32 PM
Hi rdutoit,
please can you give more details about the customization for concatenated messages, i tried to map it but could get through, couple of hints would really help
May 20, 2015 at 2:45 PM
Edited May 20, 2015 at 3:02 PM
Hi Waelawirr, (sorry did not see your post. Also put in wrong filename. Should be TextMessage.cs)
My network/service-provider (vodacom-south-africa) complained that the concatenation was in the GSM part of the SMPP-packet.
So with the above code i succeeded, with vodacom, to do the concatenation in the SMPP-part (TLV).
If i remember correct the un-commented code was working for vodacom and the commented code was what i thought to be correct.
May 21, 2015 at 6:33 AM
I'm using two different SMPP providers and found out that the one uses concatenation in the GSM part and another in the TLV part:
Here is my working code for these two different companies: ( TextMessage.cs)
            if (bytes.Length > maxLength) // Split into multiple!
            {
                var SegID = new Random().Next(1000, 9999); // create random SegmentID
                var messages = Split(vText, GetMaxMessageLength(defaultEncoding, true));
                var totalSegments = messages.Count; // get the number of (how many) parts
                var udh = new Udh(SegID, totalSegments, 0); // ID, Total, part

                //for (int i = 0; i < totalSegments; i++)
                //{
                //    udh.MessageSequence = i + 1;  // seq+1 , - parts of the message      
                //    //sm.SetMessageText(messages[i], defaultEncoding, udh); // pass default encoding which passed in method prams
                //    sm.SetMessageText(messages[i], DataCoding.SMSCDefault, udh); // send parts of the message + all other UDH settings
                //    yield return sm;
                //}
                if (useGSMconcatenation)
                {
                    for (int i = 0; i < totalSegments; i++)
                    {
                        udh.MessageSequence = i + 1;
                        sm.Header.SequenceNumber = PDUHeader.GetNextSequenceNumber(); // Global locking function to ensure atomicity
                        sm.SetMessageText(messages[i], defaultEncoding, udh); // send parts of the message + all other UDH settings
                        yield return sm;
                    }
                }
                else
                {

                    for (int i = 0; i < totalSegments; i++)
                    {
                        udh.MessageSequence = i + 1;  // seq+1 , - parts of the message  
                        sm.Header.SequenceNumber = PDUHeader.GetNextSequenceNumber();
                        sm.Tlv.Clear();
                        sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_msg_ref_num, 2, SMPPEncodingUtil.GetBytesFromShort((ushort)SegID)));
                        //sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_total_segments, 2, SMPPEncodingUtil.GetBytesFromShort((ushort)totalSegments)));
                        //sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_segment_seqnum, 2, SMPPEncodingUtil.GetBytesFromShort((ushort)(i + 1))));
                        sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_total_segments, 1, new byte[] { (byte)totalSegments }));
                        sm.Tlv.Add(new Lib.Protocol.Tlv.Tlv(Lib.Protocol.Tlv.Tag.sar_segment_seqnum, 1, new byte[] { (byte)(i + 1) }));
                        sm.SetMessageBytes(SMPPEncodingUtil.GetBytesFromString(messages[i], defaultEncoding));
                        yield return sm;
                    }
                }