Page 1 of 1

Multy Part message with with UserDataHeader and ESMClass

Posted: Tue Jun 07, 2016 8:50 am
by ashish
We are try to send message with multi part and each message is in different row with total number of message , Part Number and reference Number
And we are use UserDataHeader and Esmclass as below code

Code: Select all

 

             clsSMS objSMS = (clsSMS)obj;
                   byte[] aaa = new byte[6];
                    aaa[0] = 0x05; // Field 1 (1 octet): Length of User Data Header, in this case 05.
                    aaa[1] = 0x08;//    Field 2 (1 octet): Information Element Identifier, equal to 00 (Concatenated short messages, 8-bit reference number) equal to 08 (Concatenated short messages, 16-bit reference number)
                    aaa[2] = 0x03;//    Field 3 (1 octet): Length of the header, excluding the first two fields; equal to 03
                   //aaa[3] = 0000;//    Field 4 (1 octet): 00-FF, CSMS reference number, must be same for all the SMS parts in the CSMS / (2 octets): 0000-FFFF, CSMS reference number, must be same for all the SMS parts in the CSMS
                    aaa[3] = 0xCC;   //Convert.ToByte(objSMS.referencenumber);//    Field 5 (1 octet): 00-FF, total number of parts.
                    aaa[4] =  0x02  ;//Convert.ToByte(objSMS.totalnumber);//    Field 5 (1 octet): 00-FF, total number of parts.
                    aaa[5] = 0x01; //Convert.ToByte(objSMS.partnumber);//    Field 6 (1 octet): 00-FF, this part's number in the sequence.
         

                    UserDataHeader udh = new UserDataHeader();

                    udh.Data = aaa;

                    //code for send multiple message asynchronously
                    System.Text.Encoding encoding = System.Text.Encoding.UTF8;
           
                    ISubmitSmBuilder builder = SMS.ForSubmit()
                       .Text(objSMS.Message)
                       .From(SourcePrefix + objSMS.StrSenderId, (byte)SourceTon, (byte)SourceNPI)
                       .To(DestinationPrefix + objSMS.MobileNo, (byte)DestinationTon, (byte)DestinationNPI)
                       .Coding((DataCodings)Enum.Parse(typeof(DataCodings), objSMS.messageType.ToString()))
                      .Set(delegate(SubmitSm sm) { sm.UserDataPdu.Headers.Add(udh); sm.EsmClass = 64; })
                       .DeliveryReceipt();
                    _client.SubmitAsync(builder);

                    System.Windows.Forms.Application.DoEvents();

Re: Multy Part message with with UserDataHeader and ESMClass

Posted: Tue Jun 07, 2016 3:21 pm
by alt
Did you try to send long messages with following code:

Code: Select all

 ISubmitSmBuilder builder = SMS.ForSubmit()
                       .Text(objSMS.Message)
                       .From(SourcePrefix + objSMS.StrSenderId, (byte)SourceTon, (byte)SourceNPI)
                       .To(DestinationPrefix + objSMS.MobileNo, (byte)DestinationTon, (byte)DestinationNPI)
                       .Coding((DataCodings)Enum.Parse(typeof(DataCodings), objSMS.messageType.ToString()))
                       .DeliveryReceipt();
                    _client.SubmitAsync(builder);
Do you really need "Concatenated short messages, 16-bit reference number" ? Code above builds automatically SubmitSm PDUs with "Concatenated short messages, 8-bit reference number".

If you really need 16 bit reference number I can do quick changes in the library. After that you will only need to add one additional line in the code above.
ushort referenceNumber = 512;
...
SMS.ForSubmit().ConcatenationInUDH(referenceNumber )

Re: Multy Part message with with UserDataHeader and ESMClass

Posted: Wed Jun 08, 2016 5:32 am
by ashish
when our client connected with our smpp server at that time
We receive multi part message from smpp server
and than we message send to operator multi part in different Concatenated short messages

that's why we need Concatenated short messages to send

Re: Multy Part message with with UserDataHeader and ESMClass

Posted: Wed Jun 08, 2016 5:35 am
by ashish
we are use long messages send as per your given code from last one year and it's properly working
but we are going to make our company to aggregator so we require SMPP Server and SMPP client

Re: Multy Part message with with UserDataHeader and ESMClass

Posted: Wed Jun 08, 2016 9:27 pm
by alt
You can create each SubmitSm PDU with following code:

Code: Select all

 
            ushort referenceNumber = 512;
            byte totalParts = 2;
            byte partNumber = 1;

            SubmitSm sm = new SubmitSm();
            sm.SourceAddr = "1111";
            sm.SourceAddrTon = 0;
            sm.SourceAddrNpi = 1;
            sm.DestAddr = "79171234567";
            sm.DestAddrTon = 0;
            sm.DestAddrNpi = 1;
            sm.DataCoding = DataCodings.Default;
            sm.RegisteredDelivery = 1;
            sm.UserDataPdu.ShortMessage = _client.GetMessageBytes("Message Text Part", sm.DataCoding);

            sm.UserDataPdu.Headers.Add(new ConcatenatedShortMessage16bit(referenceNumber, totalParts, partNumber));

            _client.SubmitAsync(sm);

Re: Multy Part message with with UserDataHeader and ESMClass

Posted: Thu Jun 09, 2016 6:46 am
by ashish
Thank you so much

it's working properly .....