Full-featured outgoing call spool support. More...
#include "asterisk.h"
#include <sys/stat.h>
#include <time.h>
#include <utime.h>
#include <dirent.h>
#include <sys/inotify.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"
Go to the source code of this file.
Data Structures | |
struct | createlist |
struct | direntry |
struct | dirlist |
struct | openlist |
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, FILE *f) |
static void * | attempt_thread (void *data) |
static void | free_outgoing (struct outgoing *o) |
static void | launch_service (struct outgoing *o) |
static int | load_module (void) |
static struct outgoing * | new_outgoing (const char *fn) |
static void | queue_created_files (void) |
static void | queue_file (const char *filename, time_t when) |
static void | queue_file_create (const char *filename) |
static void | queue_file_open (const char *filename) |
static void | queue_file_write (const char *filename) |
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. More... | |
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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } |
static struct ast_module_info * | ast_module_info = &__mod_info |
static struct createlist | createlist = { .first = NULL, .last = NULL, } |
static struct dirlist | dirlist = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, 1 } , } |
static struct openlist | openlist = { .first = NULL, .last = NULL, } |
static char | qdir [255] |
static char | qdonedir [255] |
Full-featured outgoing call spool support.
Definition in file pbx_spool.c.
anonymous enum |
Definition at line 62 of file pbx_spool.c.
|
static |
Definition at line 893 of file pbx_spool.c.
|
static |
Definition at line 893 of file pbx_spool.c.
|
static |
Definition at line 147 of file pbx_spool.c.
References app, outgoing::app, ast_callerid_split(), ast_log(), ast_parse_allow_disallow(), ast_set2_flag, ast_skip_blanks(), ast_string_field_set, ast_strlen_zero(), ast_trim_blanks(), ast_true(), ast_variable_new(), outgoing::callingpid, cid_name, cid_num, context, outgoing::dest, outgoing::exten, exten, outgoing::fn, 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().
|
static |
Definition at line 358 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::fn, outgoing::format, free_outgoing(), LOG_NOTICE, outgoing::maxretries, outgoing::priority, queue_file(), remove_from_queue(), outgoing::retries, outgoing::retrytime, safe_append(), outgoing::tech, outgoing::vars, and outgoing::waittime.
Referenced by launch_service().
|
static |
Definition at line 104 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(), new_outgoing(), and scan_service().
|
static |
Definition at line 392 of file pbx_spool.c.
References ast_log(), ast_pthread_create_detached, attempt_thread(), free_outgoing(), and LOG_WARNING.
Referenced by scan_service().
|
static |
Definition at line 874 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.
|
static |
Definition at line 113 of file pbx_spool.c.
References ast_calloc, AST_FORMAT_SLINEAR, ast_free, ast_set_flag, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), outgoing::fn, outgoing::format, free_outgoing(), outgoing::options, outgoing::priority, outgoing::retrytime, SPOOL_FLAG_ALWAYS_DELETE, and outgoing::waittime.
Referenced by scan_service().
|
static |
Definition at line 585 of file pbx_spool.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, direntry::mtime, direntry::name, and queue_file().
Referenced by scan_thread().
|
static |
Definition at line 488 of file pbx_spool.c.
References ast_alloca, ast_calloc, AST_LIST_EMPTY, AST_LIST_INSERT_BEFORE_CURRENT, AST_LIST_INSERT_HEAD, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log(), errno, LOG_WARNING, direntry::mtime, direntry::name, and scan_service().
Referenced by attempt_thread(), queue_created_files(), queue_file_write(), and scan_thread().
|
static |
Definition at line 552 of file pbx_spool.c.
References ast_calloc, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, direntry::mtime, and direntry::name.
Referenced by scan_thread().
|
static |
Definition at line 571 of file pbx_spool.c.
References AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, and direntry::name.
Referenced by scan_thread().
|
static |
Definition at line 602 of file pbx_spool.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, direntry::name, and queue_file().
Referenced by scan_thread().
|
static |
Remove a call file from the outgoing queue optionally moving it in the archive dir.
o | the pointer to outgoing struct |
status | the exit status of the call. Can be "Completed", "Failed" or "Expired" |
Definition at line 307 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().
|
static |
Definition at line 283 of file pbx_spool.c.
References ast_debug, ast_log(), ast_mainpid, outgoing::dest, errno, f, outgoing::fn, LOG_WARNING, outgoing::retries, outgoing::retrytime, and outgoing::tech.
Referenced by attempt_thread(), and scan_service().
|
static |
Definition at line 404 of file pbx_spool.c.
References apply_outgoing(), ast_debug, ast_log(), ast_mainpid, outgoing::callingpid, outgoing::dest, errno, f, outgoing::fn, free_outgoing(), launch_service(), LOG_DEBUG, LOG_NOTICE, LOG_WARNING, outgoing::maxretries, new_outgoing(), remove_from_queue(), outgoing::retries, outgoing::retrytime, safe_append(), and outgoing::tech.
Referenced by queue_file().
|
static |
Definition at line 618 of file pbx_spool.c.
References ast_debug, ast_free, ast_fully_booted, AST_LIST_EMPTY, AST_LIST_FIRST, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, ast_log(), errno, HAVE_INOTIFY, inotify_fd, len(), LOG_ERROR, direntry::mtime, direntry::name, direntry::next, queue_created_files(), queue_file(), queue_file_create(), queue_file_open(), and queue_file_write().
Referenced by load_module().
|
static |
Definition at line 869 of file pbx_spool.c.
|
static |
Definition at line 893 of file pbx_spool.c.
|
static |
Definition at line 893 of file pbx_spool.c.
|
static |
|
static |
|
static |
Definition at line 72 of file pbx_spool.c.
|
static |
Definition at line 73 of file pbx_spool.c.