Asterisk - The Open Source Telephony Project GIT-master-b023714
|
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"
#include "asterisk/format.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | createlist |
struct | direntry |
struct | dirlist |
struct | openlist |
struct | outgoing |
Macros | |
#define | LINE_BUFFER_SIZE 1024 |
Enumerations | |
enum | { SPOOL_FLAG_ALWAYS_DELETE = (1 << 0) , SPOOL_FLAG_ARCHIVE = (1 << 1) , SPOOL_FLAG_EARLY_MEDIA = (1 << 2) } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | append_variable (struct outgoing *o, const char *name, const char *value) |
static int | apply_outgoing (struct outgoing *o, FILE *f) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
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 | parse_line (char *line, unsigned int lineno, struct outgoing *o) |
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. | |
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 = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, .support_level = AST_MODULE_SUPPORT_CORE, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct createlist | createlist = AST_LIST_HEAD_NOLOCK_INIT_VALUE |
static struct dirlist | dirlist = AST_LIST_HEAD_INIT_VALUE |
static struct openlist | openlist = AST_LIST_HEAD_NOLOCK_INIT_VALUE |
static char | qdir [255] |
static char | qdonedir [255] |
Full-featured outgoing call spool support.
Definition in file pbx_spool.c.
#define LINE_BUFFER_SIZE 1024 |
Definition at line 294 of file pbx_spool.c.
anonymous enum |
Definition at line 62 of file pbx_spool.c.
|
static |
Definition at line 965 of file pbx_spool.c.
|
static |
Definition at line 965 of file pbx_spool.c.
|
static |
Definition at line 164 of file pbx_spool.c.
References ast_variable_list_append, ast_variable_new, outgoing::fn, name, value, var, and outgoing::vars.
Referenced by apply_outgoing(), and parse_line().
|
static |
Definition at line 296 of file pbx_spool.c.
References outgoing::app, append_variable(), ast_log, ast_strlen_zero(), buf, outgoing::dest, outgoing::exten, outgoing::fn, len(), LINE_BUFFER_SIZE, ast_variable::lineno, LOG_WARNING, parse_line(), outgoing::retries, and outgoing::tech.
Referenced by scan_service().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 965 of file pbx_spool.c.
|
static |
Definition at line 431 of file pbx_spool.c.
References outgoing::account, outgoing::app, ast_channel_reason2str(), ast_log, AST_OUTGOING_WAIT_COMPLETE, ast_pbx_outgoing_app(), ast_pbx_outgoing_exten(), ast_strlen_zero(), ast_test_flag, ast_verb, outgoing::capabilities, outgoing::cid_name, outgoing::cid_num, outgoing::context, outgoing::data, outgoing::dest, outgoing::exten, outgoing::fn, free_outgoing(), LOG_NOTICE, outgoing::maxretries, NULL, outgoing::options, outgoing::priority, queue_file(), remove_from_queue(), outgoing::retries, outgoing::retrytime, safe_append(), SPOOL_FLAG_EARLY_MEDIA, outgoing::tech, outgoing::vars, and outgoing::waittime.
Referenced by launch_service().
|
static |
Definition at line 114 of file pbx_spool.c.
References ao2_cleanup, ast_free, ast_string_field_free_memory, ast_variables_destroy(), outgoing::capabilities, and outgoing::vars.
Referenced by attempt_thread(), launch_service(), new_outgoing(), and scan_service().
|
static |
Definition at line 470 of file pbx_spool.c.
References ast_log, ast_pthread_create_detached, attempt_thread(), free_outgoing(), LOG_WARNING, and NULL.
Referenced by scan_service().
|
static |
Definition at line 946 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, NULL, qdir, qdonedir, scan_thread(), and thread.
|
static |
Definition at line 124 of file pbx_spool.c.
References ast_calloc, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_slin, ast_free, ast_set_flag, ast_string_field_init, ast_string_field_set, ast_strlen_zero(), outgoing::capabilities, outgoing::fn, free_outgoing(), NULL, outgoing::options, outgoing::priority, outgoing::retrytime, SPOOL_FLAG_ALWAYS_DELETE, and outgoing::waittime.
Referenced by scan_service().
|
static |
Definition at line 177 of file pbx_spool.c.
References app, append_variable(), ast_callerid_split(), ast_format_cap_update_by_allow_disallow(), ast_log, ast_set2_flag, ast_skip_blanks(), ast_string_field_set, ast_strlen_zero(), ast_trim_blanks(), ast_true(), c, outgoing::callingpid, outgoing::capabilities, outgoing::fn, ast_variable::lineno, LOG_NOTICE, LOG_WARNING, outgoing::maxretries, outgoing::options, outgoing::priority, outgoing::retries, outgoing::retrytime, SPOOL_FLAG_ALWAYS_DELETE, SPOOL_FLAG_ARCHIVE, SPOOL_FLAG_EARLY_MEDIA, strsep(), and outgoing::waittime.
Referenced by apply_outgoing().
|
static |
Definition at line 657 of file pbx_spool.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, direntry::list, direntry::mtime, direntry::name, NULL, and queue_file().
Referenced by scan_thread().
|
static |
Definition at line 560 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, direntry::list, LOG_WARNING, direntry::mtime, direntry::name, NULL, qdir, and scan_service().
Referenced by attempt_thread(), queue_created_files(), queue_file_write(), and scan_thread().
|
static |
Definition at line 624 of file pbx_spool.c.
References ast_calloc, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, direntry::list, direntry::mtime, direntry::name, and NULL.
Referenced by scan_thread().
|
static |
Definition at line 643 of file pbx_spool.c.
References AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, direntry::list, and direntry::name.
Referenced by scan_thread().
|
static |
Definition at line 674 of file pbx_spool.c.
References ast_free, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, direntry::list, 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 363 of file pbx_spool.c.
References ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log, ast_mkdir(), ast_test_flag, outgoing::fn, LOG_WARNING, direntry::name, NULL, outgoing::options, qdonedir, SPOOL_FLAG_ALWAYS_DELETE, SPOOL_FLAG_ARCHIVE, and status.
Referenced by attempt_thread(), and scan_service().
|
static |
Definition at line 339 of file pbx_spool.c.
References ast_debug, ast_log, ast_mainpid, outgoing::dest, errno, outgoing::fn, LOG_WARNING, outgoing::retries, outgoing::retrytime, and outgoing::tech.
Referenced by attempt_thread(), and scan_service().
|
static |
Definition at line 482 of file pbx_spool.c.
References apply_outgoing(), ast_debug, ast_log, ast_mainpid, outgoing::callingpid, outgoing::dest, errno, outgoing::fn, free_outgoing(), launch_service(), LOG_NOTICE, LOG_WARNING, outgoing::maxretries, new_outgoing(), NULL, remove_from_queue(), outgoing::retries, outgoing::retrytime, safe_append(), and outgoing::tech.
Referenced by queue_file().
|
static |
Definition at line 690 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, buf, errno, HAVE_INOTIFY, inotify_fd, len(), LOG_ERROR, direntry::mtime, direntry::name, direntry::next, NULL, qdir, queue_created_files(), queue_file(), queue_file_create(), queue_file_open(), and queue_file_write().
Referenced by load_module().
|
static |
Definition at line 941 of file pbx_spool.c.
|
static |
Definition at line 965 of file pbx_spool.c.
|
static |
Definition at line 965 of file pbx_spool.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 74 of file pbx_spool.c.
Referenced by load_module(), queue_file(), and scan_thread().
|
static |
Definition at line 75 of file pbx_spool.c.
Referenced by load_module(), and remove_from_queue().