SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Tue Apr 13, 2021 13:54
SMSTools3 Community » Help and support Bottom

fast sms + queues

Login and Post Reply

Page:  1  2  Next

Author Post
Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Operating system name and version: Debian GNU/Linux squeeze/sid (2.6.32-3-686)
Version of smsd: 3.1.11
Smsd installed from: package repository
Name and model of a modem / phone: ZTE K3565-Z
Interface: USB


Hi everybody,
I'm trying to send a bunch of SMS over several usbserial modems. I'm trying to send all sms in fast sms sending mode so I've put at+cmss=2 as init string. When I use one modem at a time and use global spool (/var/spool/sms/outgoing) everything goes well and it takes aproximately 0.8 - 0.9s per SMS, which is ok. But when I try to send over two modems where I have a queue for each of them - the speed goes normal (not fast) and it takes about 2.5s per SMS (which is intolerably slow in my case). When I start two separated smsd instances, each having separate config and pid file, then it goes fast again. So is there a chance to make sending over queues to go in fast speed mode?

Here is my global config file:
devices = GSM1,GSM2
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
incoming = /var/spool/sms/incoming
logfile = /var/log/smstools/smsd.log
infofile = /var/run/smstools/smsd.working
pidfile = /var/run/smstools/smsd.pid
failed = /var/spool/sms/failed
sent = /var/spool/sms/sent
stats = /var/log/smstools/smsd_stats
receive_before_send = no
autosplit = 3
max_continuous_sending = 7200

[queues]
GSM1 = /var/spool/sms/GSM1
GSM2 = /var/spool/sms/GSM2

[GSM1]
device = /dev/ttyUSB3
init = at+cmms=2
incoming = no
mode = new
baudrate = 115200
rtscts = yes
cs_convert = yes
report = no
sending_disabled = no
queues = GSM1

[GSM2]
device = /dev/ttyUSB8
init = at+cmms=2
incoming = no
mode = new
baudrate = 115200
rtscts = yes
cs_convert = yes
report = no
sending_disabled = no
queues = GSM2
 
 
'smsdconf' Syntax Highlight powered by GeSHi


Also, is there a chance to force multiple modems to serve one queue? (hundreds of modems).

Any help will be appreciated :)

Best regards,
Ljubomir

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
First, you need to upgrade to 3.1.12 or later. Debian has migrated 3.1.14-1 to testing today, so it's available from the repository.

In the 3.1.11 there is a bug when more than one modems are serving the same queue. Lock files are not checked by default, and this may cause slow performance in some cases. A modem setting trust_spool = no helps for this (with 3.1.11), but there is then a one second delay when searching for a file. This probably is too much for you.

By default all modems will serve the same queue, which is a "checked" directory, when queues are not defined.

You have had headers "Queue: GSM1" or "Queue: GSM2" in SMS files, because without this definition all messages are targeted to GSM1. It may be possible that other modem had nothing to send for few seconds, because some number of messages were spooled to another modem. This causes that the radio link is closed (typically after 3 seconds of idle time), and benefit of AT+CMMS is lost at that time.

It could be useful to see some pieces of a log, but first upgrade to 3.1.14 which provides more infomation about spooling.

Some settings probably can be used to speed up the spooling, but before I recommend anything, I need to know how do you exactly create outgoing SMS files, and what is the number of files in outgoing directory as a peak?

Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
Hi Keke, thanx for fast reply !

I guess that problem is actually more profound than I thought. The speed is always normal, never really gets to fast mode: I only measured the speed of emptying outgoing directory. So, didn't realize that all messages are moved to checked or some other queue and than being processed.

Anyway, I upgraded to 3.1.14. The speed I'm trying to get is definitely achieved with this modem by hand: I've made simple script that just triggers at command for sms send, waits for OK and so on ... Am I wrong or this starts to look like feature request? Simply what has to be done is to invoke at+cmss=2 seconds before sending is started. I put keep_open = no (hoping that init string will be sent to modem in apropriate time, but this didn't help as well).

Here is a log of following configuration:
- Two modems
- Two separate queues, each modem serving one queue
- Copied 3 messages in each queue at (almost) same time



Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
If you are sure that "More Messages to Send" works in your GSM network, we could patch the code. In this case you should download the latest package and prepare to compile it. You will also need development version of libmm. If you can do this, I will show later how to change the code.

It is known that CMMS is not supported by many modems, and also it's not supported by many networks. But for those users who have the support, this feature might be very valuable. It looks like I'm going to include a modem setting "fast_mode" in the next version. ;) But let's test it first...

Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
Deal ! :) I'm waiting for further instructions, now going to grab the source code ....

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Okay. Edit the file smsd.c, search the following and change the highlighted line:

  // Compose the modem command
  make_pdu(to,text,textlen,alphabet,flash,report,with_udh,udh_data,DEVICE.mode,pdu,validity, replace_msg, system_msg, to_type, smsc);
  if (strcasecmp(DEVICE.mode,"old")==0)
    sprintf(command,"AT+CMGS=%i\r",(int)strlen(pdu)/2);
  else
    sprintf(command,"AT%s+CMMS=2;+CMGS=%i\r", (DEVICE.verify_pdu)? "E1" : "", (int)strlen(pdu)/2-1); // 3.1.4: verify_pdu
 
'c' Syntax Highlight powered by GeSHi


Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
Hmmm, still same performances :( Is it possible that spool engine takes to much time to feed the modem? (didn't read the source actually, just coming up with the idea ....)

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
From the log we should see how much the time is spent between each SMS.

About your testing script, does it generate timestamps which will show the difference?

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
Another change, it may help but I'm not sure. File smsd.c:

  else
  {
    // 3.1:
    if (0) // if (DEVICE.sending_disabled == 0 && DEVICE.check_network)
    {
      switch (wait_network_registration(1, 100))
      {
        case -1:
          STATISTICS->usage_s+=time(0)-start_time;
          flush_smart_logging();
          return 1;

        case -2:
          STATISTICS->usage_s+=time(0)-start_time;
          flush_smart_logging();
          return 3;
      }
    }
  }

  // Compose the modem command
 
'c' Syntax Highlight powered by GeSHi


Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
Hi, here are logs and comparation.

First, here is log of pathced smsd:



Now, here is a script I'm testing cmms with:



So as you can see the message is stored into memory and it is simply resent every time. I tried with text and pdu message, the results are completely the same (regarding the speed). Here are timestamps:



The script is quite unstable and unuseful, I just made it for test as you can see :)

Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
Ah I now saw new reply from you :) When I said "patched" I meant on first one, not second one .... Be online back in a few hours and then I'll let you know if second one helped ;)

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
While waiting for the new log...

We are now talking about two completely different features. In your first post you were talking about AT+CMSS, but in the configuration AT+CMMS was used. I was thinking that the CMSS is a typo, as this feature is not supported by smstools, and even if it is implemented, it does not belong to the init string.

CMMS may work, but it depends on the network, as said. I have one more patch available, but let's see the current result first.

CMSS will be problematic, if incoming messages are read. Stored messages should be in different memory, otherwise smsd will read them out and mark as "unsupported messages". To get this functionality work well, smsd should create stored message, send it from memory to multiple recipients, and then delete message. Lot of new functionality and testing will be needed. I think that if "lightning fast" speed is required for sending, external script like yours could be used.

Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
Hi again,

I would say that with both patches the results are quite the same (new log is included).

But reported time of sending is 1s, it actually fits performances provided by at+cmms. But it remains unresolved where smsd spends it's "spare time", because resulting time of sending is a little bit longer (2 seconds per SMS, maybe more).



Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
ljubex wrote
I would say that with both patches the results are quite the same (new log is included).

But reported time of sending is 1s, it actually fits performances provided by at+cmms. But it remains unresolved where smsd spends it's "spare time", because resulting time of sending is a little bit longer (2 seconds per SMS, maybe more).

Sending time is now better because network registration is not checked after the first message was sent.

With "at+cmms" you meant at+cmss, which is used in your script, right? Because those are two different things, results cannot be directly compared.

Make the following changes:

In the global part of smsd.conf, define logtime_us = yes. The next log will show better time resolution.

In the file extras.c, apply the following change:

  if (!found)
    *filename = 0;
  else
  {
    strcpy(filename, fname);

    // 3.1.12:
    i = (int)(time_usec() - start_time) / 100000;
    // if (i > 10)
      writelogfile((i >= 50)? LOG_NOTICE : LOG_DEBUG, 0, "Took %.1f seconds to get a file %s, lost %i times, %i SMS files and %i LOCK files seen.", (double)i / 10, fname, lost_count, files_count, locked_count);
  }

#ifdef DEBUGMSG
  printf("## result for dir %s: %s\n\n", dir, filename);
#endif
  return found;
}
 
'c' Syntax Highlight powered by GeSHi


After those changes do the test again and show the log.

Then, remove the patch shown in post #6 (file smsd.c):

  // Compose the modem command
  make_pdu(to,text,textlen,alphabet,flash,report,with_udh,udh_data,DEVICE.mode,pdu,validity, replace_msg, system_msg, to_type, smsc);
  if (strcasecmp(DEVICE.mode,"old")==0)
    sprintf(command,"AT+CMGS=%i\r",(int)strlen(pdu)/2);
  else
    sprintf(command,"AT%s+CMGS=%i\r", (DEVICE.verify_pdu)? "E1" : "", (int)strlen(pdu)/2-1); // 3.1.4: verify_pdu
 
'c' Syntax Highlight powered by GeSHi


Add a new patch in smsd.c:

  // 3.1beta7: Now logged only if a message file contained Report:yes.
  if (report == 1 && !DEVICE.incoming)
    writelogfile(LOG_NOTICE, 0, "Cannot receive status report because receiving is disabled");

  if ((quick==0 || (*smsc && !DEVICE.smsc_pdu)) && DEVICE.sending_disabled == 0)
  {
    int i;

    i = initialize_modem_sending(smsc);
    if (i)
    {
      STATISTICS->usage_s+=time(0)-start_time;

      flush_smart_logging();

      return (i == 7)? 3 : 1;
    }

    put_command("AT+CMMS=2\r", answer ,sizeof(answer), 1, EXPECT_OK_ERROR);
  }
  else
 
'c' Syntax Highlight powered by GeSHi


This will show the execution time of AT+CMMS, and if it has remarkable effect when it was used together with AT+CMGS, every time when SMS was sent. Run test and show this log too.

Member
Registered:
Mar 2011
Location: Belgrade, Serbia
Topic owner
I'm on my way ,,,, I've just enabled mili