Long unicode SMS in binary format issue

.NET library for SMPP protocol
Locked
syam
Posts: 5
Joined: Tue Feb 23, 2016 10:50 am

Long unicode SMS in binary format issue

Post by syam » Tue Feb 23, 2016 11:32 am

Dear Support,

I am finding difficult to send Long SMS in binary format ( hex code of unicode SMS converted to binary). I was able to successfully submit and receive the same when the message length was under single SMS limit. but when it comes to a long SMS i am not receiving the submitted SMS

Code: Select all

               
 lstSubmitSM = Inetlab.SMPP.SMS.ForSubmit()
                    .Data(HexStringToByteArray("06450624063306330629002006450633062A062F06270645062900200645064F0628062A0643063106290020063906440649002006450624063306330629002006450633062A062F06270645062900200645064F0628062A0643063106290020063906440649002006450624063306330629002006450633062A062F06270645062900200645064F0628062A0643063106290020063906440649"))                                                                                   
                    .From("SMS Alert", byte.Parse("0"), byte.Parse("0"))                 
                    .To("97150*******", byte.Parse("0"), byte.Parse("0"))         
                    .Coding(DataCodings.UCS2)
                    .DeliveryReceipt()
                    .Create(objClient)
                    ;
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Long unicode SMS in binary format issue

Post by alt » Tue Mar 01, 2016 7:03 pm

Hello syam,

Why are you trying to send Arabic text as binary message?

Did you try this code instead?

Code: Select all

 lstSubmitSM = Inetlab.SMPP.SMS.ForSubmit()
                    .Text(longArabicText)                                                                                   
                    .From("SMS Alert", byte.Parse("0"), byte.Parse("0"))                 
                    .To("97150*******", byte.Parse("0"), byte.Parse("0"))         
                    .Coding(DataCodings.UCS2)
                    .DeliveryReceipt()
                    .Create(objClient);
syam
Posts: 5
Joined: Tue Feb 23, 2016 10:50 am

Re: Long unicode SMS in binary format issue

Post by syam » Thu Mar 03, 2016 8:52 am

Dear Support,

I had already used the mentioned method to send unicode SMS. But sometime when we deal with arabic SMS text, we might need to convert this to hex code. and henceforth we were used to convert this hex code to binary before submission.

I was able to sent SMS successfully with following code though, objrow[3] is the SMS text. if you feel anything wrong in my approach please let me know, that will be highly appreciable

Code: Select all

IEnumerable<string> lstMsgParts;
                 if (objrow[3].ToString().Length > 280)
                 {
                     lstMsgParts = ChunksUpto(objrow[3].ToString(), 268);
                 }
                 else
                     lstMsgParts = ChunksUpto(objrow[3].ToString(), 280);

                int looper = 1;
                foreach (var item in lstMsgParts)
                {
                    SubmitSm _SubmitSm = new SubmitSm();
                    UserDataHeader _udh = new UserDataHeader();

                    byte[] _HeadreData = new byte[3];
                    _HeadreData[0] = 0x01;
                    _HeadreData[1] = (byte)lstMsgParts.Count();
                    _HeadreData[2] = (byte)looper;

                    _udh.Data = _HeadreData;
                    _udh.IEI = InformationElementIdentifiers.ConcatenatedShortMessages8bit;

                    if (lstMsgParts.Count() > 1)
                    {
                        _SubmitSm.UserDataPdu.Headers.Add(_udh);
                        _SubmitSm.Optional.AddSARReferenceNumber(1);
                        _SubmitSm.Optional.AddSARSequenceNumber((byte)looper);
                        _SubmitSm.Optional.AddSARTotalSegments((byte)lstMsgParts.Count());
                    }

                    _SubmitSm.UserDataPdu.ShortMessage = HexStringToByteArray(item.ToString());
                    _SubmitSm.DataCoding = DataCodings.UCS2;
                    _SubmitSm.MessageMode = MessageModes.Default;
                    _SubmitSm.MessageType = MessageTypes.Default;
                    _SubmitSm.DestAddr = objrow[2].ToString();
                    _SubmitSm.DestAddrNpi=byte.Parse(objConfig.DestinationTON.ToString());
                    _SubmitSm.DestAddrTon = byte.Parse(objConfig.DestinationTON.ToString());
                    _SubmitSm.SourceAddr = objrow[1].ToString();
                    _SubmitSm.SourceAddrNpi = byte.Parse(objConfig.SourceNPI.ToString());
                    _SubmitSm.SourceAddrTon = byte.Parse(objConfig.SourceTON.ToString());
                    _SubmitSm.RegisteredDelivery = 0x01;
                    lstSubmitSM.Add(_SubmitSm);
                    looper++;
                } 
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Long unicode SMS in binary format issue

Post by alt » Fri Mar 04, 2016 12:26 pm

Dear syam,

I think you can also convert hex to sms text and send it with simple code.

Following code should do the same as your code

Code: Select all


 lstSubmitSM = Inetlab.SMPP.SMS.ForSubmit()
                    .Text(objrow[3].ToString())                                                                                   
                    .From(objrow[1].ToString(), byte.Parse(objConfig.SourceTON.ToString()), byte.Parse(objConfig.SourceNPI.ToString()))                 
                    .To(objrow[2].ToString(), byte.Parse(objConfig.DestinationTON.ToString()), byte.Parse(objConfig.DestinationTON.ToString()))         
                    .Coding(DataCodings.UCS2)
                    .DeliveryReceipt()
                    .Create(objClient);
When you need to send concatenation parameters in SAR options please add .ConcatenationInSAR() before .DeliveryReceipt().
Locked