Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sms length error #6

Open
uugan opened this issue Jan 16, 2018 · 2 comments
Open

Sms length error #6

uugan opened this issue Jan 16, 2018 · 2 comments

Comments

@uugan
Copy link

uugan commented Jan 16, 2018

Sending ascii sms text like below (text length < 160)
SmsSubmitPdu pdu;
byte dcs = (byte)DataCodingScheme.NoClass_7Bit;
pdu = new SmsSubmitPdu(sms, phoneno, smsc, dcs);
comm.SendMessage(pdu);

but it gives error like "Text is too long. A maximum of 160 resulting septets is allowed. The current input result in 243 septets." How to avoid that error?

@gabigeo
Copy link

gabigeo commented Jan 16, 2018

Try creating multiple pdus.

`OutgoingSmsPdu[] pdus = null;
pdus = SmartMessageFactory.CreateConcatTextMessage(message, number);
int num = pdus.Length;

try
{
// Send the created messages
int i=0;
foreach(OutgoingSmsPdu pdu in pdus)
{
i++;
Output("Sending message " + i.ToString() + " of " + num.ToString() + "...");
comm.SendMessage(pdu);
}
Output("Done.");
Output("");
}
catch(Exception ex)
{
ShowException(ex);
Output("Message sending aborted because of an error.");
Output("");
}`

@uugan
Copy link
Author

uugan commented Jan 17, 2018

It seems like working but sms looks like 7bit string (bunch of numbers) but not the text which i sent.

OutgoingSmsPdu[] pdus = null;
              pdus = SmartMessageFactory.CreateConcatTextMessage(sms, phoneno);
              int num = pdus.Length;
              try
              {
                  // Send the created messages
                  int i = 0;
                  foreach (OutgoingSmsPdu pdu in pdus)
                  {
                      
                     Console.WriteLine("Sending message " + (++i) + " of " + num.ToString() + "...");
                     pdu.DataCodingScheme = (byte)DataCodingScheme.NoClass_7Bit;
                     comm.SendMessage(pdu);
                  }
                  Console.WriteLine("Done.");
                  Console.WriteLine("");
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
                  Console.WriteLine("Message sending aborted because of an error.");
                  Console.WriteLine("");
              }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants