| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
Find-Me Follow-Me application. More...
#include "asterisk.h"#include <signal.h>#include "asterisk/paths.h"#include "asterisk/lock.h"#include "asterisk/file.h"#include "asterisk/channel.h"#include "asterisk/pbx.h"#include "asterisk/module.h"#include "asterisk/translate.h"#include "asterisk/say.h"#include "asterisk/features.h"#include "asterisk/musiconhold.h"#include "asterisk/cli.h"#include "asterisk/manager.h"#include "asterisk/config.h"#include "asterisk/utils.h"#include "asterisk/causes.h"#include "asterisk/astdb.h"#include "asterisk/dsp.h"#include "asterisk/app.h"#include "asterisk/stasis_channels.h"#include "asterisk/max_forwards.h"
Go to the source code of this file.
| Data Structures | |
| struct | call_followme::blnumbers | 
| struct | call_followme | 
| Data structure for followme scripts.  More... | |
| struct | fm_args::cnumbers | 
| struct | findme_user | 
| struct | findme_user_listptr | 
| struct | fm_args | 
| struct | followmes | 
| struct | number | 
| Number structure.  More... | |
| struct | call_followme::numbers | 
| struct | call_followme::wlnumbers | 
| Macros | |
| #define | MAX_YN_STRING 20 | 
| #define | REC_FORMAT "sln" | 
| Enumerations | |
| enum | { FOLLOWMEFLAG_STATUSMSG = (1 << 0) , FOLLOWMEFLAG_RECORDNAME = (1 << 1) , FOLLOWMEFLAG_UNREACHABLEMSG = (1 << 2) , FOLLOWMEFLAG_DISABLEHOLDPROMPT = (1 << 3) , FOLLOWMEFLAG_NOANSWER = (1 << 4) , FOLLOWMEFLAG_DISABLEOPTIMIZATION = (1 << 5) , FOLLOWMEFLAG_IGNORE_CONNECTEDLINE = (1 << 6) , FOLLOWMEFLAG_PREDIAL_CALLER = (1 << 7) , FOLLOWMEFLAG_PREDIAL_CALLEE = (1 << 8) } | 
| enum | { FOLLOWMEFLAG_ARG_PREDIAL_CALLER , FOLLOWMEFLAG_ARG_PREDIAL_CALLEE , FOLLOWMEFLAG_ARG_ARRAY_SIZE } | 
| Functions | |
| static void | __reg_module (void) | 
| static void | __unreg_module (void) | 
| static struct call_followme * | alloc_profile (const char *fmname) | 
| Allocate and initialize followme profile. | |
| static int | app_exec (struct ast_channel *chan, const char *data) | 
| struct ast_module * | AST_MODULE_SELF_SYM (void) | 
| static void | clear_caller (struct findme_user *tmpuser) | 
| static void | clear_unanswered_calls (struct findme_user_listptr *findme_user_list) | 
| static struct number * | create_followme_number (const char *number, int timeout, int numorder) | 
| Add a new number. | |
| static void | destroy_calling_node (struct findme_user *node) | 
| static void | destroy_calling_tree (struct findme_user_listptr *findme_user_list) | 
| static void | end_bridge_callback (void *data) | 
| static void | end_bridge_callback_data_fixup (struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator) | 
| static struct call_followme * | find_realtime (const char *name) | 
| static struct ast_channel * | findmeexec (struct fm_args *tpargs, struct ast_channel *caller) | 
| static void | free_numbers (struct call_followme *f) | 
| static void | init_profile (struct call_followme *f, int activate) | 
| static int | load_module (void) | 
| Load the module. | |
| static void | profile_set_param (struct call_followme *f, const char *param, const char *val, int linenum, int failunknown) | 
| Set parameter in profile from configuration file. | |
| static void | publish_dial_end_event (struct ast_channel *in, struct findme_user_listptr *findme_user_list, struct ast_channel *exception, const char *status) | 
| static int | reload (void) | 
| static int | reload_followme (int reload) | 
| Reload followme application module. | |
| static int | unload_module (void) | 
| static struct ast_channel * | wait_for_winner (struct findme_user_listptr *findme_user_list, struct number *nm, struct ast_channel *caller, struct fm_args *tpargs) | 
Find-Me Follow-Me application.
Definition in file app_followme.c.
| #define MAX_YN_STRING 20 | 
Maximum accept/decline DTMF string plus terminator.
Definition at line 154 of file app_followme.c.
| #define REC_FORMAT "sln" | 
Definition at line 67 of file app_followme.c.
| anonymous enum | 
Definition at line 240 of file app_followme.c.
| anonymous enum | 
| Enumerator | |
|---|---|
| FOLLOWMEFLAG_ARG_PREDIAL_CALLER | |
| FOLLOWMEFLAG_ARG_PREDIAL_CALLEE | |
| FOLLOWMEFLAG_ARG_ARRAY_SIZE | |
Definition at line 252 of file app_followme.c.
| 
 | static | 
Definition at line 1660 of file app_followme.c.
| 
 | static | 
Definition at line 1660 of file app_followme.c.
| 
 | static | 
Allocate and initialize followme profile.
Definition at line 314 of file app_followme.c.
References ast_calloc, ast_copy_string(), AST_LIST_HEAD_INIT_NOLOCK, ast_mutex_init, call_followme::blnumbers, call_followme::lock, call_followme::name, NULL, call_followme::numbers, and call_followme::wlnumbers.
Referenced by find_realtime(), and reload_followme().
| 
 | static | 
Definition at line 1346 of file app_followme.c.
References call_followme::active, app, args, ast_answer(), AST_APP_ARG, ast_app_exec_sub(), ast_app_expand_sub_args(), ast_app_parse_options(), ast_autoservice_chan_hangup_peer(), ast_autoservice_start(), ast_autoservice_stop(), ast_bridge_call(), ast_calloc, ast_channel_caller(), ast_channel_connected_line_sub(), ast_channel_language(), ast_channel_lock, ast_channel_make_compatible(), ast_channel_name(), ast_channel_uniqueid(), ast_channel_unlock, ast_channel_update_connected_line(), ast_clear_flag, ast_config_AST_SPOOL_DIR, ast_connected_line_copy_from_caller(), AST_CONTROL_HOLD, AST_CONTROL_RINGING, ast_copy_string(), ast_deactivate_generator(), ast_debug, AST_DECLARE_APP_ARGS, ast_dsp_get_threshold_from_settings(), AST_FEATURE_AUTOMON, AST_FEATURE_REDIRECT, ast_fileexists(), ast_free, ast_indicate(), ast_indicate_data(), AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE, ast_log, ast_max_forwards_get(), ast_moh_start(), ast_moh_stop(), ast_mutex_lock, ast_mutex_unlock, ast_party_connected_line_free(), ast_play_and_record(), ast_replace_subargument_delimiter(), AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_set_flag, AST_STANDARD_APP_ARGS, AST_STATE_UP, ast_strdupa, ast_stream_and_wait(), ast_streamfile(), ast_strlen_zero(), ast_test_flag, ast_waitstream(), ast_channel::caller, call_followme::callfromprompt, fm_args::callfromprompt, fm_args::cnumbers, config, fm_args::connected_in, fm_args::connected_out, call_followme::connprompt, fm_args::connprompt, call_followme::context, fm_args::context, create_followme_number(), ast_channel::data, call_followme::enable_callee_prompt, fm_args::enable_callee_prompt, end_bridge_callback(), end_bridge_callback_data_fixup(), errno, find_realtime(), findmeexec(), followme_opts, FOLLOWMEFLAG_ARG_ARRAY_SIZE, FOLLOWMEFLAG_ARG_PREDIAL_CALLEE, FOLLOWMEFLAG_ARG_PREDIAL_CALLER, FOLLOWMEFLAG_DISABLEHOLDPROMPT, FOLLOWMEFLAG_NOANSWER, FOLLOWMEFLAG_PREDIAL_CALLEE, FOLLOWMEFLAG_PREDIAL_CALLER, FOLLOWMEFLAG_RECORDNAME, FOLLOWMEFLAG_STATUSMSG, FOLLOWMEFLAG_UNREACHABLEMSG, fm_args::followmeflags, free_numbers(), call_followme::lock, LOG_NOTICE, LOG_WARNING, call_followme::moh, fm_args::mohclass, call_followme::name, fm_args::namerecloc, call_followme::nextindp, fm_args::nextindp, call_followme::norecordingprompt, fm_args::norecordingprompt, NULL, number::number, call_followme::numbers, options, call_followme::optionsprompt, fm_args::optionsprompt, number::order, PATH_MAX, fm_args::pending_hold, fm_args::pending_in_connected_update, fm_args::pending_out_connected_update, call_followme::plsholdprompt, fm_args::plsholdprompt, fm_args::predial_callee, call_followme::realtime, REC_FORMAT, call_followme::sorryprompt, fm_args::sorryprompt, call_followme::statusprompt, fm_args::statusprompt, fm_args::suggested_moh, call_followme::takecall, fm_args::takecall, THRESHOLD_SILENCE, and number::timeout.
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 1660 of file app_followme.c.
| 
 | static | 
Definition at line 606 of file app_followme.c.
References ast_hangup(), NULL, and findme_user::ochan.
Referenced by clear_unanswered_calls(), destroy_calling_node(), and wait_for_winner().
| 
 | static | 
Definition at line 620 of file app_followme.c.
References findme_user::answered, AST_LIST_TRAVERSE, clear_caller(), and findme_user::entry.
Referenced by wait_for_winner().
| 
 | static | 
Add a new number.
Definition at line 387 of file app_followme.c.
References ast_calloc, ast_copy_string(), ast_debug, ast_strdupa, buf, NULL, number::number, number::order, and number::timeout.
Referenced by app_exec(), find_realtime(), and reload_followme().
| 
 | static | 
Definition at line 631 of file app_followme.c.
References ast_free, ast_party_connected_line_free(), and clear_caller().
Referenced by destroy_calling_tree(), and findmeexec().
| 
 | static | 
Definition at line 638 of file app_followme.c.
References AST_LIST_REMOVE_HEAD, destroy_calling_node(), and findme_user::entry.
Referenced by findmeexec().
| 
 | static | 
Definition at line 1325 of file app_followme.c.
References ast_channel_get_duration(), ast_channel_get_up_time(), ast_channel_lock, ast_channel_unlock, buf, ast_channel::data, end, and pbx_builtin_setvar_helper().
Referenced by app_exec().
| 
 | static | 
Definition at line 1341 of file app_followme.c.
References ast_bridge_config::end_bridge_callback_data.
Referenced by app_exec().
| 
 | static | 
Definition at line 1243 of file app_followme.c.
References alloc_profile(), ast_category_browse(), ast_config_destroy(), ast_false(), ast_free, AST_LIST_INSERT_TAIL, ast_load_realtime(), ast_load_realtime_multientry(), ast_mutex_destroy, ast_str_buffer(), ast_str_create, ast_str_set(), ast_variable_retrieve(), ast_variables_destroy(), create_followme_number(), number::entry, init_profile(), call_followme::lock, name, ast_variable::name, ast_variable::next, NULL, call_followme::numbers, profile_set_param(), call_followme::realtime, SENTINEL, str, number::timeout, ast_variable::value, and var.
Referenced by app_exec().
| 
 | static | 
Definition at line 1032 of file app_followme.c.
References ao2_bump, ao2_cleanup, ast_autoservice_start(), ast_autoservice_stop(), ast_call(), ast_calloc, ast_cause2str(), ast_channel_caller(), ast_channel_connected(), ast_channel_datastore_inherit(), ast_channel_inherit_variables(), ast_channel_language(), ast_channel_lock, ast_channel_lock_both, ast_channel_musicclass(), ast_channel_nativeformats(), ast_channel_publish_dial(), ast_channel_req_accountcodes(), AST_CHANNEL_REQUESTOR_BRIDGE_PEER, ast_channel_unlock, ast_check_hangup(), ast_connected_line_copy_from_caller(), ast_copy_string(), ast_debug, ast_exists_extension(), ast_free, AST_LIST_APPEND_LIST, AST_LIST_EMPTY, AST_LIST_HEAD_NOLOCK_INIT_VALUE, AST_LIST_INSERT_TAIL, AST_LIST_REMOVE_CURRENT, AST_LIST_REMOVE_HEAD, AST_LIST_TRAVERSE, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, ast_log, ast_max_forwards_decrement(), ast_pre_call(), ast_request(), ast_strlen_zero(), ast_test_flag, ast_verb, fm_args::cnumbers, findme_user::connected, fm_args::connected_out, fm_args::context, destroy_calling_node(), destroy_calling_tree(), findme_user::dialarg, FOLLOWMEFLAG_DISABLEOPTIMIZATION, fm_args::followmeflags, LOG_ERROR, LOG_WARNING, NULL, number::number, findme_user::ochan, number::order, findme_user::pending_connected_update, fm_args::pending_out_connected_update, fm_args::predial_callee, S_COR, findme_user::state, number::timeout, and wait_for_winner().
Referenced by app_exec().
| 
 | static | 
Definition at line 291 of file app_followme.c.
References ast_free, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_REMOVE_HEAD, call_followme::blnumbers, number::entry, call_followme::numbers, and call_followme::wlnumbers.
Referenced by app_exec(), reload_followme(), and unload_module().
| 
 | static | 
Definition at line 329 of file app_followme.c.
References call_followme::active, ast_copy_string(), call_followme::callfromprompt, callfromprompt, call_followme::connprompt, connprompt, call_followme::context, defaultmoh, call_followme::enable_callee_prompt, enable_callee_prompt, call_followme::moh, call_followme::nextindp, nextindp, call_followme::norecordingprompt, norecordingprompt, call_followme::optionsprompt, optionsprompt, call_followme::plsholdprompt, plsholdprompt, call_followme::sorryprompt, sorryprompt, call_followme::statusprompt, statusprompt, call_followme::takecall, and takecall.
Referenced by find_realtime(), and reload_followme().
| 
 | static | 
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 1640 of file app_followme.c.
References app, app_exec, AST_MODULE_LOAD_DECLINE, ast_register_application_xml, and reload_followme().
| 
 | static | 
Set parameter in profile from configuration file.
Definition at line 351 of file app_followme.c.
References ast_copy_string(), ast_log, ast_true(), call_followme::callfromprompt, call_followme::connprompt, call_followme::context, call_followme::enable_callee_prompt, LOG_WARNING, call_followme::moh, call_followme::name, call_followme::nextindp, call_followme::norecordingprompt, call_followme::optionsprompt, call_followme::plsholdprompt, call_followme::sorryprompt, call_followme::statusprompt, and call_followme::takecall.
Referenced by find_realtime(), and reload_followme().
| 
 | static | 
Definition at line 595 of file app_followme.c.
References ast_channel_publish_dial(), AST_LIST_TRAVERSE, findme_user::entry, in, NULL, findme_user::ochan, and status.
Referenced by wait_for_winner().
| 
 | static | 
Definition at line 1648 of file app_followme.c.
References reload_followme().
Referenced by reload_followme().
| 
 | static | 
Reload followme application module.
Definition at line 407 of file app_followme.c.
References call_followme::active, alloc_profile(), ast_category_browse(), ast_config_destroy(), ast_config_load, ast_copy_string(), ast_debug, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_RWLIST_INSERT_HEAD, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_true(), ast_variable_browse(), ast_variable_retrieve(), callfromprompt, CONFIG_FLAG_FILEUNCHANGED, CONFIG_STATUS_FILEINVALID, CONFIG_STATUS_FILEUNCHANGED, connprompt, copy(), create_followme_number(), enable_callee_prompt, featuredigittimeout, featuredigittostr, free_numbers(), init_profile(), call_followme::lock, LOG_ERROR, LOG_WARNING, call_followme::name, nextindp, norecordingprompt, NULL, call_followme::numbers, optionsprompt, plsholdprompt, profile_set_param(), reload(), sorryprompt, statusprompt, takecall, number::timeout, and var.
Referenced by load_module(), and reload().
| 
 | static | 
Definition at line 1612 of file app_followme.c.
References app, ast_free, AST_RWLIST_REMOVE_HEAD, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_unregister_application(), call_followme::entry, and free_numbers().
| 
 | static | 
Definition at line 647 of file app_followme.c.
References findme_user::answered, ARRAY_LEN, AST_CAUSE_NORMAL_CLEARING, ast_channel_hangupcause_set(), ast_channel_language(), ast_channel_name(), ast_channel_publish_dial(), ast_channel_sched(), ast_channel_stream(), ast_channel_timingfunc(), ast_connected_line_parse_data(), AST_CONTROL_ANSWER, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_FLASH, AST_CONTROL_HANGUP, AST_CONTROL_HOLD, AST_CONTROL_OFFHOOK, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_PVT_CAUSE_CODE, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, AST_CONTROL_VIDUPDATE, ast_copy_string(), ast_debug, AST_FRAME_CONTROL, AST_FRAME_DTMF, ast_frfree, ast_indicate_data(), AST_LIST_TRAVERSE, ast_log, ast_party_connected_line_free(), ast_party_connected_line_set(), ast_party_connected_line_set_init(), ast_read(), ast_sched_runq(), ast_sched_wait(), ast_stopstream(), ast_strdupa, ast_streamfile(), ast_strlen_zero(), ast_test_flag, ast_verb, ast_waitfor_n(), fm_args::callfromprompt, clear_caller(), clear_unanswered_calls(), findme_user::connected, connected, fm_args::connected_in, ast_frame::data, ast_frame::datalen, findme_user::digts, fm_args::enable_callee_prompt, findme_user::entry, featuredigittimeout, FOLLOWMEFLAG_IGNORE_CONNECTEDLINE, fm_args::followmeflags, ast_frame::frametype, ast_frame_subclass::integer, LOG_NOTICE, LOG_WARNING, fm_args::namerecloc, fm_args::nextindp, fm_args::norecordingprompt, NULL, findme_user::ochan, fm_args::optionsprompt, findme_user::pending_connected_update, fm_args::pending_hold, fm_args::pending_in_connected_update, ast_frame::ptr, publish_dial_end_event(), findme_user::state, ast_frame::subclass, fm_args::suggested_moh, fm_args::takecall, number::timeout, ast_frame::uint32, findme_user::yn, and findme_user::ynidx.
Referenced by findmeexec().
| 
 | static | 
Definition at line 1660 of file app_followme.c.
| 
 | static | 
Definition at line 151 of file app_followme.c.
Referenced by app_exec(), load_module(), and unload_module().
| 
 | static | 
Definition at line 1660 of file app_followme.c.
Definition at line 279 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Definition at line 285 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Default Music-On-Hold Class
Definition at line 274 of file app_followme.c.
Referenced by init_profile().
| 
 | static | 
Definition at line 278 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Feature Digit Timeout
Definition at line 273 of file app_followme.c.
Referenced by reload_followme(), and wait_for_winner().
| 
 | static | 
Definition at line 272 of file app_followme.c.
Referenced by reload_followme().
| 
 | static | 
Definition at line 270 of file app_followme.c.
Referenced by app_exec().
| 
 | static | 
| 
 | static | 
Definition at line 277 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Definition at line 280 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Definition at line 281 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
Definition at line 282 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Definition at line 284 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Definition at line 283 of file app_followme.c.
Referenced by init_profile(), and reload_followme().
| 
 | static | 
Definition at line 276 of file app_followme.c.
Referenced by init_profile(), and reload_followme().