[Home]

Summary:ASTERISK-18027: SMS queued with smsq not sent
Reporter:László BORTEL (bortel)Labels:
Date Opened:2011-06-16 10:04:38Date Closed:2012-01-16 12:52:41.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:PBX/pbx_spool
Versions:1.8.4 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-18331 app_sms failure
Environment:Asterisk 1.8.4.2 built by root @ AlarmServer on a i686 running Linux on 2011-06-16 08:54:39 UTC Linux AlarmServer 2.6.32-5-686 #1 SMP Wed May 18 07:08:50 UTC 2011 i686 GNU/Linux Debian WheezyAttachments:
Description:When trying to send SMS using smsq utility the SMS is not sent. The SMS file in /var/spool/asterisk/sms/motx and the spooler entry in /var/spool/asterisk/outgoing are correctly created, but the SMS call is not initiated. When I manually copy or move the spool file into the outgoing directory or just rename the existing spool file the SMS is immediately sent. So it is not an SMS problem, but a spooler issue.
On my system asterisk have been compiled with option HAVE_INOTIFY. In this case pbx_spool.c expects that either an IN_CREATE event followed by an IN_CLOSE_WRITE event or an IN_MOVED_TO event happens before the new entry gets into the active spooler list (dirlist). However smsq first creates a temporary hidden spool file in /var/spool/asterisk/sms and then moves this file into the outgoing directory using link() and unlink() functions. This process results in an IN_CREATE event, but there is no IN_CLOSE_WRITE event that follows (because the content of the spool entry file is already complete). So the SMS spool file gets onto the 'createlist', but not onto the 'dirlist', therefore no outgoing SMS call.
SMS sending with smsq works correctly when I #undef HAVE_INOTIFY. It also works correctly when I add a queue_file() call to the end of the queue_file_create() function in pbx_spool.c, like this:
static void queue_file_create(const char *filename)
{
       struct direntry *cur;

       AST_LIST_TRAVERSE(&createlist, cur, list) {
               if (!strcmp(cur->name, filename)) {
                       return;
               }
       }

       if (!(cur = ast_calloc(1, sizeof(*cur) + strlen(filename) + 1))) {
               return;
       }
       strcpy(cur->name, filename);
       AST_LIST_INSERT_TAIL(&createlist, cur, list);
queue_file(filename, 0);
}
Comments:By: Matt Jordan (mjordan) 2012-01-16 12:52:41.225-0600

This is actually a ASTERISK-18331, fixed by dwmw2 and kmoore in 1.8, r342276.  It should be released in version 1.8.9.0.