0

I have searched a lot but still couldn't find exactly what am looking for. Actually i'm working on a winforms app that will allow user to send bulk sms using GSMCOMM library with the help of a GSM Modem. What i have achieved so far is that i can send text messages that are <= 160 characters but problem begins when a message gets longer that 160 characters. I don't get any error and sms seemed to have been sent but its not actually. I'm sharing my code snippet that is used to send sms. Please have a look at it and let me know where the problem is. Thanks.

SmsSubmitPdu[] pdus; 
comm.Open();
pdus = SmartMessageFactory.CreateConcatTextMessage(message, number);
comm.SendMessages(pdus);
comm.Close();
Omer
  • 133
  • 1
  • 2
  • 16
  • 2
    Possible duplicate of [How to send SMS with more than 160 characters and enable the customer to receive as ONE SMS using GSMComm library](https://stackoverflow.com/questions/25567936/how-to-send-sms-with-more-than-160-characters-and-enable-the-customer-to-receive) – Sani Huttunen Jul 02 '18 at 12:36
  • @SaniSinghHuttunen No its not related to the link you have shared. Please see the updated question. I'm not using any API. – Omer Jul 02 '18 at 12:48
  • Please format your code a little, it's almost impossible to read this way. – bommelding Jul 02 '18 at 13:34
  • Unclear why you would use CreateConcatTextMessage() for messages <= 160 but that meths is where the magic happens. Post it. – bommelding Jul 02 '18 at 13:35
  • @bommelding i have updated the code snippet please have a look now and give your valuable suggestion. – Omer Jul 02 '18 at 15:42
  • You shortened it (too much). The loop was relevant, but mostly it's about CreateConcatTextMessage, that has to add the special continuation chars. – bommelding Jul 03 '18 at 06:22
  • @bommelding thanks for responding. I have posted the solution as answer. Cheers – Omer Jul 03 '18 at 09:09

1 Answers1

1

Alright, so after lots and lots of effort, research and minor change in the code i have got the solution and now it's working perfectly. I'm posting the solution that worked for me and I hope it will also help those who face the same problem.

Please make sure that the GSMCOMM library is up-to-date i.e. version 1.21.0 otherwise it may not work properly.

This is the correct code snippet. It will send short messages (i.e. less or equal to 160 chars) as well as long text message (i.e. more than 160 chars) as a single sms.

OutgoingSmsPdu[] pdus = null;
comm.Open();
pdus = SmartMessageFactory.CreateConcatTextMessage(message, number);
comm.SendMessages(pdus);
comm.Close();
Omer
  • 133
  • 1
  • 2
  • 16