Sat Mar 26 11:25:26 2011

Asterisk developer's documentation


pbx_spool.c File Reference

Full-featured outgoing call spool support. More...

#include "asterisk.h"
#include <sys/stat.h>
#include <time.h>
#include <utime.h>
#include <dirent.h>
#include "asterisk/paths.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/callerid.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/utils.h"
#include "asterisk/options.h"

Include dependency graph for pbx_spool.c:

Go to the source code of this file.

Data Structures

struct  outgoing

Enumerations

enum  { SPOOL_FLAG_ALWAYS_DELETE = (1 << 0), SPOOL_FLAG_ARCHIVE = (1 << 1) }

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int apply_outgoing (struct outgoing *o, const char *fn, FILE *f)
static void * attempt_thread (void *data)
static void free_outgoing (struct outgoing *o)
static int init_outgoing (struct outgoing *o)
static void launch_service (struct outgoing *o)
static int load_module (void)
static int remove_from_queue (struct outgoing *o, const char *status)
 Remove a call file from the outgoing queue optionally moving it in the archive dir.
static void safe_append (struct outgoing *o, time_t now, char *s)
static int scan_service (const char *fn, time_t now)
static void * scan_thread (void *unused)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Outgoing Spool Support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static struct ast_module_info * ast_module_info = &__mod_info
static char qdir [255]
static char qdonedir [255]


Detailed Description

Full-featured outgoing call spool support.

Definition in file pbx_spool.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
SPOOL_FLAG_ALWAYS_DELETE  Always delete the call file after a call succeeds or the maximum number of retries is exceeded, even if the modification time of the call file is in the future.
SPOOL_FLAG_ARCHIVE 

Definition at line 63 of file pbx_spool.c.

00063      {
00064    /*! Always delete the call file after a call succeeds or the
00065     * maximum number of retries is exceeded, even if the
00066     * modification time of the call file is in the future.
00067     */
00068    SPOOL_FLAG_ALWAYS_DELETE = (1 << 0),
00069    /* Don't unlink the call file after processing, move in qdonedir */
00070    SPOOL_FLAG_ARCHIVE = (1 << 1)
00071 };


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 736 of file pbx_spool.c.

static void __unreg_module ( void   )  [static]

Definition at line 736 of file pbx_spool.c.

static int apply_outgoing ( struct outgoing *  o,
const char *  fn,
FILE *  f 
) [static]

Definition at line 123 of file pbx_spool.c.

References outgoing::app, app, ast_callerid_split(), ast_log(), ast_parse_allow_disallow(), ast_set2_flag, ast_string_field_set, ast_strlen_zero(), ast_true(), ast_variable_new(), outgoing::callingpid, cid_name, cid_num, context, outgoing::dest, outgoing::exten, exten, outgoing::format, last, LOG_NOTICE, LOG_WARNING, outgoing::maxretries, ast_variable::next, outgoing::options, outgoing::priority, outgoing::retries, outgoing::retrytime, SPOOL_FLAG_ALWAYS_DELETE, SPOOL_FLAG_ARCHIVE, strsep(), outgoing::tech, var, outgoing::vars, and outgoing::waittime.

Referenced by scan_service().

00124 {
00125    char buf[256];
00126    char *c, *c2;
00127    int lineno = 0;
00128    struct ast_variable *var, *last = o->vars;
00129 
00130    while (last && last->next) {
00131       last = last->next;
00132    }
00133 
00134    while(fgets(buf, sizeof(buf), f)) {
00135       lineno++;
00136       /* Trim comments */
00137       c = buf;
00138       while ((c = strchr(c, '#'))) {
00139          if ((c == buf) || (*(c-1) == ' ') || (*(c-1) == '\t'))
00140             *c = '\0';
00141          else
00142             c++;
00143       }
00144 
00145       c = buf;
00146       while ((c = strchr(c, ';'))) {
00147          if ((c > buf) && (c[-1] == '\\')) {
00148             memmove(c - 1, c, strlen(c) + 1);
00149             c++;
00150          } else {
00151             *c = '\0';
00152             break;
00153          }
00154       }
00155 
00156       /* Trim trailing white space */
00157       while(!ast_strlen_zero(buf) && buf[strlen(buf) - 1] < 33)
00158          buf[strlen(buf) - 1] = '\0';
00159       if (!ast_strlen_zero(buf)) {
00160          c = strchr(buf, ':');
00161          if (c) {
00162             *c = '\0';
00163             c++;
00164             while ((*c) && (*c < 33))
00165                c++;
00166 #if 0
00167             printf("'%s' is '%s' at line %d\n", buf, c, lineno);
00168 #endif
00169             if (!strcasecmp(buf, "channel")) {
00170                if ((c2 = strchr(c, '/'))) {
00171                   *c2 = '\0';
00172                   c2++;
00173                   ast_string_field_set(o, tech, c);
00174                   ast_string_field_set(o, dest, c2);
00175                } else {
00176                   ast_log(LOG_NOTICE, "Channel should be in form Tech/Dest at line %d of %s\n", lineno, fn);
00177                }
00178             } else if (!strcasecmp(buf, "callerid")) {
00179                char cid_name[80] = {0}, cid_num[80] = {0};
00180                ast_callerid_split(c, cid_name, sizeof(cid_name), cid_num, sizeof(cid_num));
00181                ast_string_field_set(o, cid_num, cid_num);
00182                ast_string_field_set(o, cid_name, cid_name);
00183             } else if (!strcasecmp(buf, "application")) {
00184                ast_string_field_set(o, app, c);
00185             } else if (!strcasecmp(buf, "data")) {
00186                ast_string_field_set(o, data, c);
00187             } else if (!strcasecmp(buf, "maxretries")) {
00188                if (sscanf(c, "%30d", &o->maxretries) != 1) {
00189                   ast_log(LOG_WARNING, "Invalid max retries at line %d of %s\n", lineno, fn);
00190                   o->maxretries = 0;
00191                }
00192             } else if (!strcasecmp(buf, "codecs")) {
00193                ast_parse_allow_disallow(NULL, &o->format, c, 1);
00194             } else if (!strcasecmp(buf, "context")) {
00195                ast_string_field_set(o, context, c);
00196             } else if (!strcasecmp(buf, "extension")) {
00197                ast_string_field_set(o, exten, c);
00198             } else if (!strcasecmp(buf, "priority")) {
00199                if ((sscanf(c, "%30d", &o->priority) != 1) || (o->priority < 1)) {
00200                   ast_log(LOG_WARNING, "Invalid priority at line %d of %s\n", lineno, fn);
00201                   o->priority = 1;
00202                }
00203             } else if (!strcasecmp(buf, "retrytime")) {
00204                if ((sscanf(c, "%30d", &o->retrytime) != 1) || (o->retrytime < 1)) {
00205                   ast_log(LOG_WARNING, "Invalid retrytime at line %d of %s\n", lineno, fn);
00206                   o->retrytime = 300;
00207                }
00208             } else if (!strcasecmp(buf, "waittime")) {
00209                if ((sscanf(c, "%30d", &o->waittime) != 1) || (o->waittime < 1)) {
00210                   ast_log(LOG_WARNING, "Invalid waittime at line %d of %s\n", lineno, fn);
00211                   o->waittime = 45;
00212                }
00213             } else if (!strcasecmp(buf, "retry")) {
00214                o->retries++;
00215             } else if (!strcasecmp(buf, "startretry")) {
00216                if (sscanf(c, "%30ld", &o->callingpid) != 1) {
00217                   ast_log(LOG_WARNING, "Unable to retrieve calling PID!\n");
00218                   o->callingpid = 0;
00219                }
00220             } else if (!strcasecmp(buf, "endretry") || !strcasecmp(buf, "abortretry")) {
00221                o->callingpid = 0;
00222                o->retries++;
00223             } else if (!strcasecmp(buf, "delayedretry")) {
00224             } else if (!strcasecmp(buf, "setvar") || !strcasecmp(buf, "set")) {
00225                c2 = c;
00226                strsep(&c2, "=");
00227                if (c2) {
00228                   var = ast_variable_new(c, c2, fn);
00229                   if (var) {
00230                      /* Always insert at the end, because some people want to treat the spool file as a script */
00231                      if (last) {
00232                         last->next = var;
00233                      } else {
00234                         o->vars = var;
00235                      }
00236                      last = var;
00237                   }
00238                } else
00239                   ast_log(LOG_WARNING, "Malformed \"%s\" argument.  Should be \"%s: variable=value\"\n", buf, buf);
00240             } else if (!strcasecmp(buf, "account")) {
00241                ast_string_field_set(o, account, c);
00242             } else if (!strcasecmp(buf, "alwaysdelete")) {
00243                ast_set2_flag(&o->options, ast_true(c), SPOOL_FLAG_ALWAYS_DELETE);
00244             } else if (!strcasecmp(buf, "archive")) {
00245                ast_set2_flag(&o->options, ast_true(c), SPOOL_FLAG_ARCHIVE);
00246             } else {
00247                ast_log(LOG_WARNING, "Unknown keyword '%s' at line %d of %s\n", buf, lineno, fn);
00248             }
00249          } else
00250             ast_log(LOG_NOTICE, "Syntax error at line %d of %s\n", lineno, fn);
00251       }
00252    }
00253    ast_string_field_set(o, fn, fn);
00254    if (ast_strlen_zero(o->tech) || ast_strlen_zero(o->dest) || (ast_strlen_zero(o->app) && ast_strlen_zero(o->exten))) {
00255       ast_log(LOG_WARNING, "At least one of app or extension must be specified, along with tech and dest in file %s\n", fn);
00256       return -1;
00257    }
00258    return 0;
00259 }

static void* attempt_thread ( void *  data  )  [static]

Definition at line 338 of file pbx_spool.c.

References outgoing::account, outgoing::app, ast_channel_reason2str(), ast_log(), ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_strlen_zero(), ast_verb, outgoing::cid_name, outgoing::cid_num, outgoing::context, outgoing::data, outgoing::dest, outgoing::exten, outgoing::format, free_outgoing(), LOG_NOTICE, outgoing::maxretries, outgoing::priority, remove_from_queue(), outgoing::retries, safe_append(), outgoing::tech, outgoing::vars, and outgoing::waittime.

Referenced by launch_service().

00339 {
00340    struct outgoing *o = data;
00341    int res, reason;
00342    if (!ast_strlen_zero(o->app)) {
00343       ast_verb(3, "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries);
00344       res = ast_pbx_outgoing_app(o->tech, o->format, (void *) o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
00345       o->vars = NULL;
00346    } else {
00347       ast_verb(3, "Attempting call on %s/%s for %s@%s:%d (Retry %d)\n", o->tech, o->dest, o->exten, o->context,o->priority, o->retries);
00348       res = ast_pbx_outgoing_exten(o->tech, o->format, (void *) o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
00349       o->vars = NULL;
00350    }
00351    if (res) {
00352       ast_log(LOG_NOTICE, "Call failed to go through, reason (%d) %s\n", reason, ast_channel_reason2str(reason));
00353       if (o->retries >= o->maxretries + 1) {
00354          /* Max retries exceeded */
00355          ast_log(LOG_NOTICE, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
00356          remove_from_queue(o, "Expired");
00357       } else {
00358          /* Notate that the call is still active */
00359          safe_append(o, time(NULL), "EndRetry");
00360       }
00361    } else {
00362       ast_log(LOG_NOTICE, "Call completed to %s/%s\n", o->tech, o->dest);
00363       remove_from_queue(o, "Completed");
00364    }
00365    free_outgoing(o);
00366    return NULL;
00367 }

static void free_outgoing ( struct outgoing *  o  )  [static]

Definition at line 114 of file pbx_spool.c.

References ast_free, ast_string_field_free_memory, ast_variables_destroy(), and outgoing::vars.

Referenced by attempt_thread(), launch_service(), and scan_service().

00115 {
00116    if (o->vars) {
00117       ast_variables_destroy(o->vars);
00118    }
00119    ast_string_field_free_memory(o);
00120    ast_free(o);
00121 }

static int init_outgoing ( struct outgoing *  o  )  [static]

Definition at line 101 of file pbx_spool.c.

References AST_FORMAT_SLINEAR, ast_set_flag, ast_string_field_init, outgoing::format, outgoing::options, outgoing::priority, outgoing::retrytime, SPOOL_FLAG_ALWAYS_DELETE, and outgoing::waittime.

Referenced by scan_service().

00102 {
00103    o->priority = 1;
00104    o->retrytime = 300;
00105    o->waittime = 45;
00106    o->format = AST_FORMAT_SLINEAR;
00107    ast_set_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE);
00108    if (ast_string_field_init(o, 128)) {
00109       return -1;
00110    }
00111    return 0;
00112 }

static void launch_service ( struct outgoing *  o  )  [static]

Definition at line 369 of file pbx_spool.c.

References ast_log(), ast_pthread_create_detached, attempt_thread(), free_outgoing(), and LOG_WARNING.

Referenced by scan_service().

00370 {
00371    pthread_t t;
00372    int ret;
00373 
00374    if ((ret = ast_pthread_create_detached(&t, NULL, attempt_thread, o))) {
00375       ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
00376       free_outgoing(o);
00377    }
00378 }

static int load_module ( void   )  [static]

Definition at line 717 of file pbx_spool.c.

References ast_config_AST_SPOOL_DIR, ast_log(), ast_mkdir(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, ast_pthread_create_detached_background, LOG_WARNING, scan_thread(), and thread.

00718 {
00719    pthread_t thread;
00720    int ret;
00721    snprintf(qdir, sizeof(qdir), "%s/%s", ast_config_AST_SPOOL_DIR, "outgoing");
00722    if (ast_mkdir(qdir, 0777)) {
00723       ast_log(LOG_WARNING, "Unable to create queue directory %s -- outgoing spool disabled\n", qdir);
00724       return AST_MODULE_LOAD_DECLINE;
00725    }
00726    snprintf(qdonedir, sizeof(qdir), "%s/%s", ast_config_AST_SPOOL_DIR, "outgoing_done");
00727 
00728    if ((ret = ast_pthread_create_detached_background(&thread, NULL, scan_thread, NULL))) {
00729       ast_log(LOG_WARNING, "Unable to create thread :( (returned error: %d)\n", ret);
00730       return AST_MODULE_LOAD_FAILURE;
00731    }
00732 
00733    return AST_MODULE_LOAD_SUCCESS;
00734 }

static int remove_from_queue ( struct outgoing *  o,
const char *  status 
) [static]

Remove a call file from the outgoing queue optionally moving it in the archive dir.

Parameters:
o the pointer to outgoing struct
status the exit status of the call. Can be "Completed", "Failed" or "Expired"

Definition at line 289 of file pbx_spool.c.

References ast_log(), ast_mkdir(), ast_test_flag, f, outgoing::fn, LOG_WARNING, outgoing::options, SPOOL_FLAG_ALWAYS_DELETE, and SPOOL_FLAG_ARCHIVE.

Referenced by attempt_thread(), and scan_service().

00290 {
00291    int fd;
00292    FILE *f;
00293    char newfn[256];
00294    const char *bname;
00295 
00296    if (!ast_test_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE)) {
00297       struct stat current_file_status;
00298 
00299       if (!stat(o->fn, &current_file_status)) {
00300          if (time(NULL) < current_file_status.st_mtime)
00301             return 0;
00302       }
00303    }
00304 
00305    if (!ast_test_flag(&o->options, SPOOL_FLAG_ARCHIVE)) {
00306       unlink(o->fn);
00307       return 0;
00308    }
00309 
00310    if (ast_mkdir(qdonedir, 0777)) {
00311       ast_log(LOG_WARNING, "Unable to create queue directory %s -- outgoing spool archiving disabled\n", qdonedir);
00312       unlink(o->fn);
00313       return -1;
00314    }
00315 
00316    if ((fd = open(o->fn, O_WRONLY | O_APPEND))) {
00317       if ((f = fdopen(fd, "a"))) {
00318          fprintf(f, "Status: %s\n", status);
00319          fclose(f);
00320       } else
00321          close(fd);
00322    }
00323 
00324    if (!(bname = strrchr(o->fn, '/')))
00325       bname = o->fn;
00326    else
00327       bname++; 
00328    snprintf(newfn, sizeof(newfn), "%s/%s", qdonedir, bname);
00329    /* a existing call file the archive dir is overwritten */
00330    unlink(newfn);
00331    if (rename(o->fn, newfn) != 0) {
00332       unlink(o->fn);
00333       return -1;
00334    } else
00335       return 0;
00336 }

static void safe_append ( struct outgoing *  o,
time_t  now,
char *  s 
) [static]

Definition at line 261 of file pbx_spool.c.

References ast_log(), ast_mainpid, errno, f, outgoing::fn, LOG_WARNING, outgoing::retries, and outgoing::retrytime.

Referenced by attempt_thread(), and scan_service().

00262 {
00263    int fd;
00264    FILE *f;
00265    struct utimbuf tbuf;
00266 
00267    if ((fd = open(o->fn, O_WRONLY | O_APPEND)) < 0)
00268       return;
00269 
00270    if ((f = fdopen(fd, "a"))) {
00271       fprintf(f, "\n%s: %ld %d (%ld)\n", s, (long)ast_mainpid, o->retries, (long) now);
00272       fclose(f);
00273    } else
00274       close(fd);
00275 
00276    /* Update the file time */
00277    tbuf.actime = now;
00278    tbuf.modtime = now + o->retrytime;
00279    if (utime(o->fn, &tbuf))
00280       ast_log(LOG_WARNING, "Unable to set utime on %s: %s\n", o->fn, strerror(errno));
00281 }

static int scan_service ( const char *  fn,
time_t  now 
) [static]

Definition at line 381 of file pbx_spool.c.

References apply_outgoing(), ast_calloc, ast_free, ast_log(), ast_mainpid, outgoing::callingpid, outgoing::dest, errno, f, outgoing::fn, free_outgoing(), init_outgoing(), launch_service(), LOG_DEBUG, LOG_NOTICE, LOG_WARNING, outgoing::maxretries, remove_from_queue(), outgoing::retries, outgoing::retrytime, safe_append(), and outgoing::tech.

Referenced by scan_thread().

00382 {
00383    struct outgoing *o = NULL;
00384    FILE *f;
00385    int res = 0;
00386 
00387    if (!(o = ast_calloc(1, sizeof(*o)))) {
00388       ast_log(LOG_WARNING, "Out of memory ;(\n");
00389       return -1;
00390    }
00391    
00392    if (init_outgoing(o)) {
00393       /* No need to call free_outgoing here since we know the failure
00394        * was to allocate string fields and no variables have been allocated
00395        * yet.
00396        */
00397       ast_free(o);
00398       return -1;
00399    }
00400 
00401    /* Attempt to open the file */
00402    if (!(f = fopen(fn, "r+"))) {
00403       remove_from_queue(o, "Failed");
00404       free_outgoing(o);
00405       ast_log(LOG_WARNING, "Unable to open %s: %s, deleting\n", fn, strerror(errno));
00406       return -1;
00407    }
00408 
00409    /* Read in and verify the contents */
00410    if (apply_outgoing(o, fn, f)) {
00411       remove_from_queue(o, "Failed");
00412       free_outgoing(o);
00413       ast_log(LOG_WARNING, "Invalid file contents in %s, deleting\n", fn);
00414       fclose(f);
00415       return -1;
00416    }
00417    
00418 #if 0
00419    printf("Filename: %s, Retries: %d, max: %d\n", fn, o->retries, o->maxretries);
00420 #endif
00421    fclose(f);
00422    if (o->retries <= o->maxretries) {
00423       now += o->retrytime;
00424       if (o->callingpid && (o->callingpid == ast_mainpid)) {
00425          safe_append(o, time(NULL), "DelayedRetry");
00426          ast_log(LOG_DEBUG, "Delaying retry since we're currently running '%s'\n", o->fn);
00427          free_outgoing(o);
00428       } else {
00429          /* Increment retries */
00430          o->retries++;
00431          /* If someone else was calling, they're presumably gone now
00432             so abort their retry and continue as we were... */
00433          if (o->callingpid)
00434             safe_append(o, time(NULL), "AbortRetry");
00435          
00436          safe_append(o, now, "StartRetry");
00437          launch_service(o);
00438       }
00439       res = now;
00440    } else {
00441       ast_log(LOG_NOTICE, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
00442       remove_from_queue(o, "Expired");
00443       free_outgoing(o);
00444    }
00445 
00446    return res;
00447 }

static void* scan_thread ( void *  unused  )  [static]

Definition at line 639 of file pbx_spool.c.

References ast_fully_booted, ast_log(), errno, last, LOG_WARNING, and scan_service().

Referenced by load_module().

00640 {
00641    struct stat st;
00642    DIR *dir;
00643    struct dirent *de;
00644    char fn[256];
00645    int res;
00646    time_t last = 0, next = 0, now;
00647    struct timespec ts = { .tv_sec = 1 };
00648   
00649    while (!ast_fully_booted) {
00650       nanosleep(&ts, NULL);
00651    }
00652 
00653    for(;;) {
00654       /* Wait a sec */
00655       nanosleep(&ts, NULL);
00656       time(&now);
00657 
00658       if (stat(qdir, &st)) {
00659          ast_log(LOG_WARNING, "Unable to stat %s\n", qdir);
00660          continue;
00661       }
00662 
00663       /* Make sure it is time for us to execute our check */
00664       if ((st.st_mtime == last) && (next && (next > now)))
00665          continue;
00666       
00667 #if 0
00668       printf("atime: %ld, mtime: %ld, ctime: %ld\n", st.st_atime, st.st_mtime, st.st_ctime);
00669       printf("Ooh, something changed / timeout\n");
00670 #endif
00671       next = 0;
00672       last = st.st_mtime;
00673 
00674       if (!(dir = opendir(qdir))) {
00675          ast_log(LOG_WARNING, "Unable to open directory %s: %s\n", qdir, strerror(errno));
00676          continue;
00677       }
00678 
00679       while ((de = readdir(dir))) {
00680          snprintf(fn, sizeof(fn), "%s/%s", qdir, de->d_name);
00681          if (stat(fn, &st)) {
00682             ast_log(LOG_WARNING, "Unable to stat %s: %s\n", fn, strerror(errno));
00683             continue;
00684          }
00685          if (!S_ISREG(st.st_mode))
00686             continue;
00687          if (st.st_mtime <= now) {
00688             res = scan_service(fn, now);
00689             if (res > 0) {
00690                /* Update next service time */
00691                if (!next || (res < next)) {
00692                   next = res;
00693                }
00694             } else if (res) {
00695                ast_log(LOG_WARNING, "Failed to scan service '%s'\n", fn);
00696             } else if (!next) {
00697                /* Expired entry: must recheck on the next go-around */
00698                next = st.st_mtime;
00699             }
00700          } else {
00701             /* Update "next" update if necessary */
00702             if (!next || (st.st_mtime < next))
00703                next = st.st_mtime;
00704          }
00705       }
00706       closedir(dir);
00707    }
00708    return NULL;
00709 }

static int unload_module ( void   )  [static]

Definition at line 712 of file pbx_spool.c.

00713 {
00714    return -1;
00715 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Outgoing Spool Support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 736 of file pbx_spool.c.

Definition at line 736 of file pbx_spool.c.

char qdir[255] [static]

Definition at line 73 of file pbx_spool.c.

char qdonedir[255] [static]

Definition at line 74 of file pbx_spool.c.


Generated on Sat Mar 26 11:25:29 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.9