Asterisk - The Open Source Telephony Project GIT-master-d856a3e
|
MiniVoiceMail - A Minimal Voicemail System for Asterisk. More...
#include "asterisk.h"
#include <ctype.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <time.h>
#include <dirent.h>
#include <locale.h>
#include "asterisk/paths.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/config.h"
#include "asterisk/say.h"
#include "asterisk/module.h"
#include "asterisk/app.h"
#include "asterisk/mwi.h"
#include "asterisk/dsp.h"
#include "asterisk/localtime.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/linkedlists.h"
#include "asterisk/callerid.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/json.h"
Go to the source code of this file.
Data Structures | |
struct | leave_vm_options |
Options for leaving voicemail with the voicemail() application. More... | |
struct | message_templates |
The list of e-mail templates. More... | |
struct | minivm_account |
struct | minivm_accounts |
struct | minivm_stats |
Structure for gathering statistics. More... | |
struct | minivm_template |
struct | minivm_zone |
Voicemail time zones. More... | |
struct | minivm_zones |
The list of e-mail time zones. More... | |
Macros | |
#define | ASTERISK_USERNAME "asterisk" |
#define | DEFAULT_CHARSET "ISO-8859-1" |
#define | DEFAULT_DATEFORMAT "%A, %B %d, %Y at %r" |
#define | EOL "\r\n" |
#define | ERROR_LOCK_PATH -100 |
#define | FALSE 0 |
#define | HMSU_OUTPUT_FORMAT "%-23s %-15s %-15s %-10s %-10s %-50s\n" |
#define | HMSZ_OUTPUT_FORMAT "%-15s %-20s %-45s\n" |
#define | HVLT_OUTPUT_FORMAT "%-15s %-10s %-10s %-15.15s %-50s\n" |
#define | MAX_DATETIME_FORMAT 512 |
#define | MAX_NUM_CID_CONTEXTS 10 |
#define | MVM_ALLOCED (1 << 13) |
#define | MVM_ENVELOPE (1 << 4) |
#define | MVM_OPERATOR (1 << 1) |
#define | MVM_PBXSKIP (1 << 9) |
#define | MVM_REALTIME (1 << 2) |
#define | MVM_REVIEW (1 << 0) |
#define | MVM_SVMAIL (1 << 3) |
#define | SENDMAIL "/usr/sbin/sendmail -t" |
Default mail command to mail voicemail. Change it with the mailcmd= command in voicemail.conf. More... | |
#define | SOUND_INTRO "vm-intro" |
#define | TRUE 1 |
#define | VOICEMAIL_CONFIG "minivm.conf" |
#define | VOICEMAIL_DIR_MODE 0700 |
Enumerations | |
enum | minivm_option_args { OPT_ARG_RECORDGAIN = 0 , OPT_ARG_ARRAY_SIZE = 1 } |
enum | minivm_option_flags { OPT_SILENT = (1 << 0) , OPT_BUSY_GREETING = (1 << 1) , OPT_UNAVAIL_GREETING = (1 << 2) , OPT_TEMP_GREETING = (1 << 3) , OPT_NAME_GREETING = (1 << 4) , OPT_RECORDGAIN = (1 << 5) } |
enum | mvm_messagetype { MVM_MESSAGE_EMAIL , MVM_MESSAGE_PAGE } |
Message types for notification. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | access_counter_file (char *directory, char *countername, int value, int operand) |
Access counter file, lock directory, read and possibly write it again changed. More... | |
static int | apply_general_options (struct ast_variable *var) |
Apply general configuration options. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static const char * | ast_str_encode_mime (struct ast_str **end, ssize_t maxlen, const char *charset, const char *start, size_t preamble, size_t postamble) |
static const char * | ast_str_quote (struct ast_str **buf, ssize_t maxlen, const char *from) |
static int | check_dirpath (char *dest, int len, char *domain, char *username, char *folder) |
static int | check_mime (const char *str) |
static char * | complete_minivm_show_users (const char *line, const char *word, int pos, int state) |
static int | create_dirpath (char *dest, int len, char *domain, char *username, char *folder) |
static int | create_vmaccount (char *name, struct ast_variable *var, int realtime) |
Append new mailbox to mailbox list from configuration file. More... | |
static struct minivm_account * | find_account (const char *domain, const char *username, int createtemp) |
static struct minivm_account * | find_user_realtime (const char *domain, const char *username) |
static void | free_user (struct minivm_account *vmu) |
static void | free_zone (struct minivm_zone *z) |
Free Mini Voicemail timezone. More... | |
static int | get_date (char *s, int len) |
static char * | handle_minivm_list_templates (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI routine for listing templates. More... | |
static char * | handle_minivm_reload (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Reload cofiguration. More... | |
static char * | handle_minivm_show_settings (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI Show settings. More... | |
static char * | handle_minivm_show_stats (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show stats. More... | |
static char * | handle_minivm_show_users (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
CLI command to list voicemail accounts. More... | |
static char * | handle_minivm_show_zones (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Show a list of voicemail zones in the CLI. More... | |
static int | invent_message (struct ast_channel *chan, char *domain, char *username, int busy, char *ecodes) |
static int | leave_voicemail (struct ast_channel *chan, char *username, struct leave_vm_options *options) |
static int | load_config (int reload) |
Load minivoicemail configuration. More... | |
static int | load_module (void) |
Load mini voicemail module. More... | |
static int | make_dir (char *dest, int len, const char *domain, const char *username, const char *folder) |
static void | message_destroy_list (void) |
static int | message_template_build (const char *name, struct ast_variable *var) |
static struct minivm_template * | message_template_create (const char *name) |
static struct minivm_template * | message_template_find (const char *name) |
static void | message_template_free (struct minivm_template *template) |
static char * | message_template_parse_emailbody (const char *configuration) |
Parse emailbody template from configuration file. More... | |
static char * | message_template_parse_filebody (const char *filename) |
Read message template from file. More... | |
static int | minivm_accmess_exec (struct ast_channel *chan, const char *data) |
Record specific messages for voicemail account. More... | |
static int | minivm_account_func_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
${MINIVMACCOUNT()} Dialplan function - reads account data More... | |
static int | minivm_counter_func_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
${MINIVMCOUNTER()} Dialplan function - read counters More... | |
static int | minivm_counter_func_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
${MINIVMCOUNTER()} Dialplan function - changes counter data More... | |
static int | minivm_delete_exec (struct ast_channel *chan, const char *data) |
static int | minivm_greet_exec (struct ast_channel *chan, const char *data) |
static int | minivm_mwi_exec (struct ast_channel *chan, const char *data) |
static int | minivm_notify_exec (struct ast_channel *chan, const char *data) |
static int | minivm_record_exec (struct ast_channel *chan, const char *data) |
static struct minivm_account * | mvm_user_alloc (void) |
static int | notify_new_message (struct ast_channel *chan, const char *templatename, struct minivm_account *vmu, const char *filename, long duration, const char *format, char *cidnum, char *cidname) |
static int | play_record_review (struct ast_channel *chan, char *playfile, char *recordfile, int maxtime, char *fmt, int outsidecaller, struct minivm_account *vmu, int *duration, int *sound_duration, const char *unlockdir, signed char record_gain) |
static void | populate_defaults (struct minivm_account *vmu) |
static void | prep_email_sub_vars (struct ast_channel *channel, const struct minivm_account *vmu, const char *cidnum, const char *cidname, const char *dur, const char *date, const char *counter) |
static void | queue_mwi_event (const char *channel_id, const char *mbx, const char *ctx, int urgent, int new, int old) |
static int | reload (void) |
Reload mini voicemail module. More... | |
static void | run_externnotify (struct ast_channel *chan, struct minivm_account *vmu) |
Run external notification for voicemail message. More... | |
static int | sendmail (struct minivm_template *template, struct minivm_account *vmu, char *cidnum, char *cidname, const char *filename, char *format, int duration, int attach_user_voicemail, enum mvm_messagetype type, const char *counter) |
static int | timezone_add (const char *zonename, const char *config) |
Add time zone to memory list. More... | |
static void | timezone_destroy_list (void) |
Clear list of timezones. More... | |
static int | unload_module (void) |
Unload mini voicemail module. More... | |
static int | vm_delete (char *file) |
static int | vm_lock_path (const char *path) |
lock directory More... | |
static void | vmaccounts_destroy_list (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Mini VoiceMail (A minimal Voicemail e-mail System)" , .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, .support_level = AST_MODULE_SUPPORT_EXTENDED, .load = load_module, .unload = unload_module, .reload = reload, } |
static char * | app_minivm_accmess = "MinivmAccMess" |
static char * | app_minivm_delete = "MinivmDelete" |
static char * | app_minivm_greet = "MinivmGreet" |
static char * | app_minivm_mwi = "MinivmMWI" |
static char * | app_minivm_notify = "MinivmNotify" |
static char * | app_minivm_record = "MinivmRecord" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_cli_entry | cli_minivm [] |
CLI commands for Mini-voicemail. More... | |
static char | default_vmformat [80] |
static char | global_externnotify [160] |
static char | global_logfile [PATH_MAX] |
static char | global_mailcmd [160] |
static int | global_maxgreet |
static int | global_maxsilence |
static int | global_saydurationminfo |
static int | global_silencethreshold = 128 |
static struct minivm_stats | global_stats |
Statistics for voicemail. More... | |
static int | global_vmmaxmessage |
static int | global_vmminmessage |
static double | global_volgain |
static struct ast_flags | globalflags = {0} |
static struct message_templates | message_templates = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static const struct ast_app_option | minivm_accmess_options [128] = { [ 'b' ] = { .flag = OPT_BUSY_GREETING }, [ 'u' ] = { .flag = OPT_UNAVAIL_GREETING }, [ 't' ] = { .flag = OPT_TEMP_GREETING }, [ 'n' ] = { .flag = OPT_NAME_GREETING }, } |
static struct ast_custom_function | minivm_account_function |
static struct minivm_accounts | minivm_accounts = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static const struct ast_app_option | minivm_app_options [128] = { [ 's' ] = { .flag = OPT_SILENT }, [ 'b' ] = { .flag = OPT_BUSY_GREETING }, [ 'u' ] = { .flag = OPT_UNAVAIL_GREETING }, [ 'g' ] = { .flag = OPT_RECORDGAIN , .arg_index = OPT_ARG_RECORDGAIN + 1 }, } |
static struct ast_custom_function | minivm_counter_function |
static struct minivm_zones | minivm_zones = { .first = NULL, .last = NULL, .lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } , } |
static ast_mutex_t | minivmlock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static FILE * | minivmlogfile |
static ast_mutex_t | minivmloglock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static char | MVM_SPOOL_DIR [PATH_MAX] |
MiniVoiceMail - A Minimal Voicemail System for Asterisk.
A voicemail system in small building blocks, working together based on the Comedian Mail voicemail system (app_voicemail.c).
Definition in file app_minivm.c.
#define ASTERISK_USERNAME "asterisk" |
Default username for sending mail is asterisk@localhost
Definition at line 553 of file app_minivm.c.
#define DEFAULT_CHARSET "ISO-8859-1" |
Definition at line 707 of file app_minivm.c.
#define DEFAULT_DATEFORMAT "%A, %B %d, %Y at %r" |
Definition at line 706 of file app_minivm.c.
#define EOL "\r\n" |
Definition at line 544 of file app_minivm.c.
#define ERROR_LOCK_PATH -100 |
Definition at line 549 of file app_minivm.c.
#define FALSE 0 |
Definition at line 527 of file app_minivm.c.
#define HMSU_OUTPUT_FORMAT "%-23s %-15s %-15s %-10s %-10s %-50s\n" |
#define HMSZ_OUTPUT_FORMAT "%-15s %-20s %-45s\n" |
#define HVLT_OUTPUT_FORMAT "%-15s %-10s %-10s %-15.15s %-50s\n" |
#define MAX_DATETIME_FORMAT 512 |
Definition at line 546 of file app_minivm.c.
#define MAX_NUM_CID_CONTEXTS 10 |
Definition at line 547 of file app_minivm.c.
#define MVM_ALLOCED (1 << 13) |
Definition at line 537 of file app_minivm.c.
#define MVM_ENVELOPE (1 << 4) |
Definition at line 535 of file app_minivm.c.
#define MVM_OPERATOR (1 << 1) |
Operator exit during voicemail recording
Definition at line 532 of file app_minivm.c.
#define MVM_PBXSKIP (1 << 9) |
Definition at line 536 of file app_minivm.c.
#define MVM_REALTIME (1 << 2) |
This user is a realtime account
Definition at line 533 of file app_minivm.c.
#define MVM_REVIEW (1 << 0) |
Review message
Definition at line 531 of file app_minivm.c.
#define MVM_SVMAIL (1 << 3) |
Definition at line 534 of file app_minivm.c.
#define SENDMAIL "/usr/sbin/sendmail -t" |
Default mail command to mail voicemail. Change it with the mailcmd= command in voicemail.conf.
Definition at line 541 of file app_minivm.c.
#define SOUND_INTRO "vm-intro" |
Definition at line 543 of file app_minivm.c.
#define TRUE 1 |
Definition at line 524 of file app_minivm.c.
#define VOICEMAIL_CONFIG "minivm.conf" |
Definition at line 552 of file app_minivm.c.
#define VOICEMAIL_DIR_MODE 0700 |
Definition at line 550 of file app_minivm.c.
enum minivm_option_args |
Enumerator | |
---|---|
OPT_ARG_RECORDGAIN | |
OPT_ARG_ARRAY_SIZE |
Definition at line 583 of file app_minivm.c.
enum minivm_option_flags |
Enumerator | |
---|---|
OPT_SILENT | |
OPT_BUSY_GREETING | |
OPT_UNAVAIL_GREETING | |
OPT_TEMP_GREETING | |
OPT_NAME_GREETING | |
OPT_RECORDGAIN |
Definition at line 574 of file app_minivm.c.
enum mvm_messagetype |
Message types for notification.
Enumerator | |
---|---|
MVM_MESSAGE_EMAIL | |
MVM_MESSAGE_PAGE |
Definition at line 556 of file app_minivm.c.
|
static |
Definition at line 3450 of file app_minivm.c.
|
static |
Definition at line 3450 of file app_minivm.c.
|
static |
Access counter file, lock directory, read and possibly write it again changed.
directory | Directory to crate file in |
countername | filename |
value | If set to zero, we only read the variable |
operand | 0 to read, 1 to set new value, 2 to change |
Definition at line 3170 of file app_minivm.c.
References ast_debug, ast_log, ast_unlock_path(), errno, LOG_ERROR, value, and vm_lock_path().
Referenced by minivm_counter_func_read(), and minivm_counter_func_write().
|
static |
Apply general configuration options.
Definition at line 2655 of file app_minivm.c.
References ast_config_AST_LOG_DIR, ast_copy_string(), ast_log, ast_set2_flag, ast_strlen_zero(), ast_true(), default_vmformat, error(), global_externnotify, global_logfile, global_mailcmd, global_maxgreet, global_maxsilence, global_silencethreshold, global_vmmaxmessage, global_vmminmessage, globalflags, LOG_WARNING, MVM_OPERATOR, MVM_REVIEW, and var.
Referenced by load_config().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 3450 of file app_minivm.c.
|
static |
Definition at line 1040 of file app_minivm.c.
References ast_str_alloca, ast_str_append(), ast_str_buffer(), ast_str_reset(), ast_str_set(), ast_str_strlen(), end, and tmp().
Referenced by sendmail().
|
static |
Definition at line 1081 of file app_minivm.c.
References ast_str_append(), ast_str_buffer(), ast_str_set(), and buf.
Referenced by sendmail().
|
static |
Definition at line 1405 of file app_minivm.c.
References FALSE, len(), make_dir(), and TRUE.
Referenced by leave_voicemail(), minivm_account_func_read(), and minivm_greet_exec().
|
static |
Definition at line 1011 of file app_minivm.c.
References str.
Referenced by sendmail().
|
static |
Definition at line 2896 of file app_minivm.c.
References AST_LIST_TRAVERSE, ast_strdup, minivm_account::domain, minivm_template::list, and NULL.
Referenced by handle_minivm_show_users().
|
static |
Definition at line 1424 of file app_minivm.c.
References ast_debug, ast_log, ast_mkdir(), len(), LOG_WARNING, and make_dir().
Referenced by leave_voicemail(), minivm_counter_func_read(), and minivm_counter_func_write().
|
static |
Append new mailbox to mailbox list from configuration file.
Definition at line 2443 of file app_minivm.c.
References minivm_account::accountcode, ast_calloc, ast_copy_string(), ast_debug, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log, ast_strlen_zero(), ast_variable_new, minivm_account::chanvars, minivm_account::domain, minivm_account::email, minivm_account::etemplate, minivm_account::externnotify, minivm_account::fullname, global_stats, minivm_account::language, minivm_template::list, LOG_ERROR, name, ast_variable::next, minivm_account::pager, minivm_account::pincode, populate_defaults(), minivm_account::ptemplate, minivm_account::serveremail, minivm_account::username, var, minivm_stats::voicemailaccounts, minivm_account::volgain, and minivm_account::zonetag.
Referenced by find_user_realtime(), and load_config().
|
static |
Definition at line 934 of file app_minivm.c.
References ast_copy_string(), ast_debug, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_log, ast_set2_flag, ast_strlen_zero(), minivm_account::domain, find_user_realtime(), minivm_template::list, LOG_NOTICE, MVM_ALLOCED, mvm_user_alloc(), NULL, TRUE, and minivm_account::username.
Referenced by leave_voicemail(), minivm_accmess_exec(), minivm_account_func_read(), minivm_counter_func_read(), minivm_counter_func_write(), minivm_greet_exec(), and minivm_notify_exec().
|
static |
Definition at line 978 of file app_minivm.c.
References ast_copy_string(), ast_free, ast_load_realtime(), ast_variables_destroy(), create_vmaccount(), MAXHOSTNAMELEN, mvm_user_alloc(), name, NULL, populate_defaults(), retval, SENTINEL, TRUE, and var.
Referenced by find_account().
|
static |
Definition at line 856 of file app_minivm.c.
References ast_free, ast_variables_destroy(), and minivm_account::chanvars.
Referenced by leave_voicemail(), minivm_accmess_exec(), minivm_account_func_read(), minivm_greet_exec(), and minivm_notify_exec().
|
static |
Free Mini Voicemail timezone.
Definition at line 2538 of file app_minivm.c.
References ast_free.
Referenced by timezone_destroy_list().
|
static |
Definition at line 844 of file app_minivm.c.
References ast_localtime(), ast_strftime(), ast_tvnow(), len(), and NULL.
Referenced by leave_voicemail().
|
static |
CLI routine for listing templates.
Definition at line 2855 of file app_minivm.c.
References a, ast_cli(), AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, minivm_template::attachment, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, HVLT_OUTPUT_FORMAT, minivm_template::list, locale, NULL, S_OR, minivm_template::subject, and ast_cli_entry::usage.
|
static |
Reload cofiguration.
Definition at line 3402 of file app_minivm.c.
References a, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, NULL, reload(), and ast_cli_entry::usage.
|
static |
CLI Show settings.
Definition at line 3004 of file app_minivm.c.
References a, ast_cli(), ast_test_flag, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, default_vmformat, global_externnotify, global_logfile, global_mailcmd, global_maxsilence, global_silencethreshold, global_vmmaxmessage, global_vmminmessage, globalflags, MVM_OPERATOR, MVM_REVIEW, NULL, and ast_cli_entry::usage.
|
static |
Show stats.
Definition at line 3036 of file app_minivm.c.
References a, ast_cli(), ast_localtime(), ast_strftime(), buf, CLI_GENERATE, CLI_INIT, CLI_SUCCESS, ast_cli_entry::command, global_stats, minivm_stats::lastreceived, NULL, minivm_stats::receivedmessages, minivm_stats::reset, minivm_stats::templates, minivm_stats::timezones, ast_cli_entry::usage, and minivm_stats::voicemailaccounts.
|
static |
CLI command to list voicemail accounts.
Definition at line 2919 of file app_minivm.c.
References a, ast_cli(), AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, minivm_account::attachfmt, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, complete_minivm_show_users(), minivm_account::domain, minivm_account::etemplate, minivm_account::fullname, HMSU_OUTPUT_FORMAT, minivm_template::list, NULL, minivm_account::ptemplate, S_OR, tmp(), ast_cli_entry::usage, minivm_account::username, and minivm_account::zonetag.
|
static |
Show a list of voicemail zones in the CLI.
Definition at line 2967 of file app_minivm.c.
References a, ast_cli_entry::args, ast_cli(), AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, HMSZ_OUTPUT_FORMAT, minivm_template::list, minivm_zone::msg_format, minivm_zone::name, NULL, minivm_zone::timezone, and ast_cli_entry::usage.
|
static |
Definition at line 1440 of file app_minivm.c.
References ast_channel_language(), ast_debug, ast_fileexists(), ast_say_digit_str(), ast_streamfile(), ast_waitstream(), FALSE, MVM_SPOOL_DIR, NULL, and PATH_MAX.
Referenced by minivm_greet_exec().
|
static |
Definition at line 1779 of file app_minivm.c.
References minivm_account::accountcode, ast_callerid_merge(), ast_channel_caller(), ast_channel_context(), ast_channel_exten(), ast_channel_language(), ast_channel_name(), ast_channel_priority(), ast_copy_string(), ast_debug, ast_filedelete(), ast_fileexists(), ast_localtime(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_streamfile(), ast_strftime(), ast_strlen_zero(), ast_test_flag, ast_tvnow(), ast_verb, ast_waitstream(), minivm_account::attachfmt, check_dirpath(), create_dirpath(), default_vmformat, minivm_account::domain, errno, find_account(), free_user(), get_date(), global_stats, global_vmmaxmessage, global_vmminmessage, minivm_stats::lastreceived, LOG_ERROR, LOG_WARNING, minivmlogfile, minivmloglock, MVM_ALLOCED, name, NULL, options, PATH_MAX, pbx_builtin_setvar_helper(), play_record_review(), minivm_stats::receivedmessages, S_COR, tmp(), and TRUE.
Referenced by minivm_record_exec().
|
static |
Load minivoicemail configuration.
Definition at line 2713 of file app_minivm.c.
References apply_general_options(), ast_category_browse(), ast_config_destroy(), ast_config_load, ast_copy_string(), ast_debug, ast_dsp_get_threshold_from_settings(), ast_log, ast_mutex_lock, ast_mutex_unlock, ast_set2_flag, ast_strlen_zero(), ast_tvnow(), ast_variable_browse(), ast_variable_retrieve(), chanvar, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, create_vmaccount(), default_vmformat, errno, error(), FALSE, global_externnotify, global_logfile, global_mailcmd, global_maxgreet, global_maxsilence, global_saydurationminfo, global_silencethreshold, global_stats, global_vmmaxmessage, global_vmminmessage, globalflags, LOG_ERROR, LOG_WARNING, message_destroy_list(), message_template_build(), message_template_find(), message_template_parse_emailbody(), minivmlock, minivmlogfile, MVM_OPERATOR, MVM_REVIEW, name, NULL, reload(), minivm_stats::reset, SENDMAIL, THRESHOLD_SILENCE, timezone_add(), timezone_destroy_list(), TRUE, var, vmaccounts_destroy_list(), and VOICEMAIL_CONFIG.
Referenced by load_module(), and reload().
|
static |
Load mini voicemail module.
Definition at line 3368 of file app_minivm.c.
References app_minivm_accmess, app_minivm_delete, app_minivm_greet, app_minivm_mwi, app_minivm_notify, app_minivm_record, ARRAY_LEN, ast_cli_register_multiple, ast_config_AST_SPOOL_DIR, ast_custom_function_register, ast_register_application_xml, cli_minivm, load_config(), minivm_accmess_exec(), minivm_account_function, minivm_counter_function, minivm_delete_exec(), minivm_greet_exec(), minivm_mwi_exec(), minivm_notify_exec(), minivm_record_exec(), and MVM_SPOOL_DIR.
|
static |
Definition at line 1391 of file app_minivm.c.
References ast_strlen_zero(), len(), and MVM_SPOOL_DIR.
Referenced by check_dirpath(), and create_dirpath().
|
static |
Definition at line 833 of file app_minivm.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, minivm_template::list, and message_template_free().
Referenced by load_config(), and unload_module().
|
static |
Definition at line 748 of file app_minivm.c.
References ast_copy_string(), ast_debug, ast_free, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log, ast_true(), error(), global_stats, minivm_template::list, LOG_ERROR, message_template_create(), message_template_parse_emailbody(), message_template_parse_filebody(), name, minivm_stats::templates, and var.
Referenced by load_config().
|
static |
Definition at line 718 of file app_minivm.c.
References ast_calloc, ast_copy_string(), DEFAULT_CHARSET, DEFAULT_DATEFORMAT, name, NULL, and TRUE.
Referenced by message_template_build().
|
static |
Definition at line 811 of file app_minivm.c.
References AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_strlen_zero(), minivm_template::list, name, and NULL.
Referenced by load_config(), and notify_new_message().
|
static |
Definition at line 738 of file app_minivm.c.
References ast_free.
Referenced by message_destroy_list().
|
static |
Parse emailbody template from configuration file.
Definition at line 2628 of file app_minivm.c.
References ast_log, ast_strdup, emailbody, len(), and LOG_NOTICE.
Referenced by load_config(), and message_template_build().
|
static |
Read message template from file.
Definition at line 2588 of file app_minivm.c.
References ast_calloc, ast_config_AST_CONFIG_DIR, ast_copy_string(), ast_debug, ast_log, ast_strlen_zero(), buf, LOG_ERROR, and NULL.
Referenced by message_template_build().
|
static |
Record specific messages for voicemail account.
Definition at line 2345 of file app_minivm.c.
References ARRAY_LEN, ast_answer(), ast_app_parse_options(), ast_app_separate_args, ast_copy_string(), ast_debug, ast_log, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), ast_test_flag, default_vmformat, minivm_account::domain, error(), FALSE, find_account(), free_user(), global_maxgreet, LOG_ERROR, LOG_WARNING, minivm_accmess_options, MVM_ALLOCED, MVM_SPOOL_DIR, NULL, OPT_ARG_ARRAY_SIZE, OPT_BUSY_GREETING, OPT_NAME_GREETING, OPT_TEMP_GREETING, OPT_UNAVAIL_GREETING, PATH_MAX, pbx_builtin_setvar_helper(), play_record_review(), prompt, tmp(), TRUE, and minivm_account::username.
Referenced by load_module().
|
static |
${MINIVMACCOUNT()} Dialplan function - reads account data
Definition at line 3076 of file app_minivm.c.
References minivm_account::accountcode, ast_copy_string(), ast_log, ast_strdupa, ast_strlen_zero(), ast_test_flag, buf, minivm_account::chanvars, check_dirpath(), minivm_account::domain, minivm_account::email, minivm_account::etemplate, find_account(), free_user(), minivm_account::fullname, minivm_account::language, len(), LOG_ERROR, MVM_ALLOCED, NULL, minivm_account::pager, minivm_account::pincode, minivm_account::ptemplate, TRUE, minivm_account::username, var, and minivm_account::zonetag.
|
static |
${MINIVMCOUNTER()} Dialplan function - read counters
Definition at line 3223 of file app_minivm.c.
References access_counter_file(), ast_log, ast_strdupa, ast_strlen_zero(), buf, create_dirpath(), FALSE, find_account(), len(), LOG_ERROR, and NULL.
|
static |
${MINIVMCOUNTER()} Dialplan function - changes counter data
Definition at line 3276 of file app_minivm.c.
References access_counter_file(), ast_log, ast_strdupa, ast_strlen_zero(), create_dirpath(), FALSE, find_account(), LOG_ERROR, NULL, and value.
|
static |
Definition at line 2307 of file app_minivm.c.
References ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_debug, ast_fileexists(), ast_log, ast_strlen_zero(), LOG_ERROR, NULL, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), and vm_delete().
Referenced by load_module().
|
static |
Definition at line 2134 of file app_minivm.c.
References ARRAY_LEN, ast_answer(), ast_app_parse_options(), ast_app_separate_args, ast_channel_caller(), ast_channel_context(), ast_channel_context_set(), ast_channel_exten_set(), ast_channel_language(), ast_channel_priority_set(), ast_copy_flags, ast_copy_string(), ast_debug, ast_exists_extension(), ast_log, ast_play_and_wait(), ast_set_flag, AST_STATE_UP, ast_stopstream(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_test_flag, ast_waitstream(), check_dirpath(), minivm_account::domain, minivm_account::exit, find_account(), free_user(), invent_message(), LOG_ERROR, minivm_app_options, MVM_ALLOCED, MVM_OPERATOR, MVM_SPOOL_DIR, NULL, OPT_ARG_ARRAY_SIZE, OPT_BUSY_GREETING, OPT_SILENT, OPT_UNAVAIL_GREETING, PATH_MAX, pbx_builtin_setvar_helper(), S_COR, SOUND_INTRO, tmp(), and TRUE.
Referenced by load_module().
|
static |
Definition at line 1965 of file app_minivm.c.
References ARRAY_LEN, ast_app_separate_args, ast_channel_uniqueid(), ast_copy_string(), ast_log, ast_strdupa, ast_strlen_zero(), LOG_ERROR, voicemailpwcheck::mailbox, PATH_MAX, queue_mwi_event(), and tmp().
Referenced by load_module().
|
static |
Definition at line 2003 of file app_minivm.c.
References ARRAY_LEN, ast_app_separate_args, ast_channel_caller(), ast_channel_lock, ast_channel_unlock, ast_copy_string(), ast_log, ast_strdupa, ast_strlen_zero(), ast_test_flag, find_account(), free_user(), LOG_ERROR, LOG_WARNING, MVM_ALLOCED, name, notify_new_message(), NULL, PATH_MAX, pbx_builtin_getvar_helper(), pbx_builtin_setvar_helper(), S_COR, tmp(), and TRUE.
Referenced by load_module().
|
static |
Definition at line 2081 of file app_minivm.c.
References ARRAY_LEN, ast_answer(), ast_app_parse_options(), ast_app_separate_args, ast_copy_flags, ast_log, AST_STATE_UP, ast_strdupa, ast_strlen_zero(), ast_test_flag, ERROR_LOCK_PATH, leave_voicemail(), LOG_ERROR, LOG_WARNING, minivm_app_options, OPT_ARG_ARRAY_SIZE, OPT_ARG_RECORDGAIN, OPT_BUSY_GREETING, OPT_RECORDGAIN, OPT_SILENT, OPT_UNAVAIL_GREETING, pbx_builtin_setvar_helper(), leave_vm_options::record_gain, and tmp().
Referenced by load_module().
|
static |
Definition at line 907 of file app_minivm.c.
References ast_calloc, NULL, and populate_defaults().
Referenced by find_account(), and find_user_realtime().
|
static |
Definition at line 1678 of file app_minivm.c.
References ao2_cleanup, ast_channel_lock, ast_channel_snapshot_get_latest(), ast_channel_uniqueid(), ast_channel_unlock, ast_copy_string(), ast_debug, ast_json_pack(), ast_json_unref(), ast_log, ast_mwi_blob_create(), ast_mwi_create(), ast_mwi_topic(), ast_mwi_vm_app_type(), ast_strdupa, ast_strlen_zero(), minivm_account::attachfmt, minivm_template::attachment, minivm_account::domain, minivm_account::etemplate, minivm_template::locale, LOG_WARNING, message_template_find(), MVM_MESSAGE_EMAIL, MVM_MESSAGE_PAGE, NULL, minivm_account::pager, pbx_builtin_getvar_helper(), minivm_account::ptemplate, RAII_VAR, run_externnotify(), sendmail(), stasis_publish(), strsep(), and minivm_account::username.
Referenced by minivm_notify_exec().
|
static |
Definition at line 1511 of file app_minivm.c.
References ast_channel_language(), ast_channel_setoption(), AST_DIGIT_ANY, ast_log, AST_OPTION_RXGAIN, ast_play_and_record_full(), ast_play_and_wait(), AST_RECORD_IF_EXISTS_OVERWRITE, ast_stream_and_wait(), ast_streamfile(), ast_test_flag, ast_verb, ast_waitfordigit(), ast_waitstream(), global_maxsilence, global_silencethreshold, LOG_WARNING, MVM_OPERATOR, MVM_REVIEW, NULL, and vm_delete().
Referenced by leave_voicemail(), and minivm_accmess_exec().
|
static |
Definition at line 898 of file app_minivm.c.
References ast_copy_flags, ast_copy_string(), AST_FLAGS_ALL, minivm_account::attachfmt, default_vmformat, global_volgain, globalflags, and minivm_account::volgain.
Referenced by create_vmaccount(), find_user_realtime(), and mvm_user_alloc().
|
static |
Definition at line 869 of file app_minivm.c.
References ast_callerid_merge(), ast_log, ast_strlen_zero(), minivm_account::chanvars, minivm_account::domain, minivm_account::fullname, LOG_ERROR, pbx_builtin_setvar_helper(), minivm_account::username, and var.
Referenced by sendmail().
|
static |
Definition at line 1950 of file app_minivm.c.
References ast_publish_mwi_state_channel, ast_strdupa, ast_strlen_zero(), voicemailpwcheck::context, and voicemailpwcheck::mailbox.
Referenced by minivm_mwi_exec().
|
static |
Reload mini voicemail module.
Definition at line 3396 of file app_minivm.c.
References load_config().
Referenced by handle_minivm_reload(), and load_config().
|
static |
Run external notification for voicemail message.
Definition at line 1643 of file app_minivm.c.
References ast_channel_caller(), ast_debug, AST_MAX_CONTEXT, ast_safe_execvp(), ast_strlen_zero(), minivm_account::domain, minivm_account::externnotify, global_externnotify, ast_party_caller::id, ast_party_id::name, NULL, ast_party_id::number, S_COR, ast_party_name::str, ast_party_number::str, minivm_account::username, ast_party_name::valid, and ast_party_number::valid.
Referenced by notify_new_message().
|
static |
Definition at line 1101 of file app_minivm.c.
References ast_base64_encode_file_path(), ast_channel_unref, ast_copy_string(), ast_debug, ast_dummy_channel_alloc, ast_free, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_localtime(), ast_log, ast_random(), ast_safe_system(), ast_str_buffer(), ast_str_create, ast_str_encode_mime(), ast_str_quote(), ast_str_set(), ast_str_substitute_variables(), ast_strftime(), ast_strlen_zero(), ast_tvnow(), check_mime(), DEBUG_ATLEAST, minivm_account::domain, minivm_account::email, email, EOL, errno, minivm_template::fromaddress, minivm_account::fullname, global_mailcmd, minivm_template::list, LOG_ERROR, LOG_WARNING, MAXHOSTNAMELEN, mkdtemp(), MVM_MESSAGE_EMAIL, MVM_MESSAGE_PAGE, minivm_zone::name, NULL, out, minivm_account::pager, PATH_MAX, prep_email_sub_vars(), RAII_VAR, minivm_account::serveremail, minivm_zone::timezone, tmp(), type, minivm_account::username, minivm_account::volgain, and minivm_account::zonetag.
Referenced by notify_new_message().
|
static |
Add time zone to memory list.
Definition at line 2556 of file app_minivm.c.
References ast_calloc, ast_copy_string(), ast_free, AST_LIST_INSERT_TAIL, AST_LIST_LOCK, AST_LIST_UNLOCK, ast_log, ast_strdupa, config, global_stats, minivm_template::list, LOG_WARNING, minivm_zone::msg_format, minivm_zone::name, NULL, strsep(), minivm_zone::timezone, and minivm_stats::timezones.
Referenced by load_config().
|
static |
Clear list of timezones.
Definition at line 2544 of file app_minivm.c.
References AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, free_zone(), and minivm_template::list.
Referenced by load_config(), and unload_module().
|
static |
Unload mini voicemail module.
Definition at line 3422 of file app_minivm.c.
References app_minivm_accmess, app_minivm_delete, app_minivm_greet, app_minivm_mwi, app_minivm_notify, app_minivm_record, ARRAY_LEN, ast_cli_unregister_multiple(), ast_custom_function_unregister(), ast_unregister_application(), cli_minivm, message_destroy_list(), minivm_account_function, minivm_counter_function, timezone_destroy_list(), and vmaccounts_destroy_list().
|
static |
Definition at line 1497 of file app_minivm.c.
References ast_debug, ast_filedelete(), make_ari_stubs::file, and NULL.
Referenced by minivm_delete_exec(), and play_record_review().
|
static |
lock directory
only return failure if ast_lock_path returns 'timeout', not if the path does not exist or any other reason
Definition at line 3153 of file app_minivm.c.
References ast_lock_path(), and AST_LOCK_TIMEOUT.
Referenced by access_counter_file().
|
static |
Definition at line 922 of file app_minivm.c.
References ast_free, AST_LIST_LOCK, AST_LIST_REMOVE_HEAD, AST_LIST_UNLOCK, and minivm_template::list.
Referenced by load_config(), and unload_module().
|
static |
Definition at line 3450 of file app_minivm.c.
|
static |
Definition at line 569 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 568 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 566 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 570 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 567 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 565 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 3450 of file app_minivm.c.
|
static |
CLI commands for Mini-voicemail.
Definition at line 3347 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 697 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), leave_voicemail(), load_config(), minivm_accmess_exec(), and populate_defaults().
|
static |
External notification application
Definition at line 695 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), load_config(), and run_externnotify().
|
static |
Global log file for messages
Definition at line 696 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), and load_config().
|
static |
Configurable mail cmd
Definition at line 694 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), load_config(), and sendmail().
|
static |
Maximum length of prompts
Definition at line 692 of file app_minivm.c.
Referenced by apply_general_options(), load_config(), and minivm_accmess_exec().
|
static |
Maximum silence during recording
Definition at line 691 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), load_config(), and play_record_review().
|
static |
Definition at line 700 of file app_minivm.c.
Referenced by load_config().
|
static |
Definition at line 693 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), load_config(), and play_record_review().
|
static |
Statistics for voicemail.
Definition at line 682 of file app_minivm.c.
Referenced by create_vmaccount(), handle_minivm_show_stats(), leave_voicemail(), load_config(), message_template_build(), and timezone_add().
|
static |
Maximum duration of message
Definition at line 690 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), leave_voicemail(), and load_config().
|
static |
Minimum duration of messages
Definition at line 689 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), leave_voicemail(), and load_config().
|
static |
Volume gain for voicmemail via e-mail
Definition at line 702 of file app_minivm.c.
Referenced by populate_defaults().
|
static |
Global voicemail flags
Definition at line 699 of file app_minivm.c.
Referenced by apply_general_options(), handle_minivm_show_settings(), load_config(), and populate_defaults().
|
static |
|
static |
Definition at line 600 of file app_minivm.c.
Referenced by minivm_accmess_exec().
|
static |
Definition at line 3362 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
|
static |
Definition at line 593 of file app_minivm.c.
Referenced by minivm_greet_exec(), and minivm_record_exec().
|
static |
Definition at line 3356 of file app_minivm.c.
Referenced by load_module(), and unload_module().
|
static |
|
static |
Lock to protect voicemail system
Definition at line 684 of file app_minivm.c.
Referenced by load_config().
|
static |
The minivm log file
Definition at line 687 of file app_minivm.c.
Referenced by leave_voicemail(), and load_config().
|
static |
Lock to protect voicemail system log file
Definition at line 685 of file app_minivm.c.
Referenced by leave_voicemail().
|
static |
Definition at line 562 of file app_minivm.c.
Referenced by invent_message(), load_module(), make_dir(), minivm_accmess_exec(), and minivm_greet_exec().