Asterisk - The Open Source Telephony Project
18.5.0
|
Routines implementing call features as call pickup, parking and transfer. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include "features_config.h"
#include <pthread.h>
#include <signal.h>
#include <sys/time.h>
#include <netinet/in.h>
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/causes.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/app.h"
#include "asterisk/say.h"
#include "asterisk/features.h"
#include "asterisk/musiconhold.h"
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
#include "asterisk/utils.h"
#include "asterisk/devicestate.h"
#include "asterisk/audiohook.h"
#include "asterisk/global_datastores.h"
#include "asterisk/astobj2.h"
#include "asterisk/test.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_features.h"
#include "asterisk/bridge_basic.h"
#include "asterisk/bridge_after.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/features_config.h"
#include "asterisk/max_forwards.h"
#include "asterisk/stream.h"
Go to the source code of this file.
Data Structures | |
struct | ast_bridge_thread_obj |
struct | ast_dial_features |
Enumerations | |
enum | { BRIDGE_OPT_PLAYTONE = (1 << 0), OPT_CALLEE_HANGUP = (1 << 1), OPT_CALLER_HANGUP = (1 << 2), OPT_DURATION_LIMIT = (1 << 3), OPT_DURATION_STOP = (1 << 4), OPT_CALLEE_TRANSFER = (1 << 5), OPT_CALLER_TRANSFER = (1 << 6), OPT_CALLEE_MONITOR = (1 << 7), OPT_CALLER_MONITOR = (1 << 8), OPT_CALLEE_PARK = (1 << 9), OPT_CALLER_PARK = (1 << 10), OPT_CALLEE_KILL = (1 << 11), OPT_CALLEE_GO_ON = (1 << 12) } |
enum | { OPT_ARG_DURATION_LIMIT = 0, OPT_ARG_DURATION_STOP, OPT_ARG_CALLEE_GO_ON, OPT_ARG_ARRAY_SIZE } |
enum | feature_interpret_op { FEATURE_INTERPRET_DETECT, FEATURE_INTERPRET_DO, FEATURE_INTERPRET_CHECK } |
enum | play_tone_action { PLAYTONE_NONE = 0, PLAYTONE_CHANNEL1 = (1 << 0), PLAYTONE_CHANNEL2 = (1 << 1), PLAYTONE_BOTH = PLAYTONE_CHANNEL1 | PLAYTONE_CHANNEL2 } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | action_bridge (struct mansession *s, const struct message *m) |
Bridge channels together. More... | |
static int | add_features_datastore (struct ast_channel *chan, const struct ast_flags *my_features, const struct ast_flags *peer_features) |
static void | add_features_datastores (struct ast_channel *caller, struct ast_channel *callee, struct ast_bridge_config *config) |
int | ast_bridge_call (struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config) |
bridge the call and set CDR More... | |
int | ast_bridge_call_with_flags (struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, unsigned int flags) |
Bridge a call, and add additional flags to the bridge. More... | |
int | ast_bridge_timelimit (struct ast_channel *chan, struct ast_bridge_config *config, char *parse, struct timeval *calldurationlimit) |
parse L option and read associated channel variables to set warning, warning frequency, and timelimit More... | |
void | ast_channel_log (char *title, struct ast_channel *chan) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | bridge_check_monitor (struct ast_channel *chan, struct ast_channel *peer) |
static void | bridge_config_set_limits (struct ast_bridge_config *config, struct ast_bridge_features_limits *caller_limits, struct ast_bridge_features_limits *callee_limits) |
static void | bridge_config_set_limits_warning_values (struct ast_bridge_config *config, struct ast_bridge_features_limits *limits) |
static int | bridge_exec (struct ast_channel *chan, const char *data) |
Bridge channels. More... | |
static void | bridge_failed_peer_goto (struct ast_channel *chan, struct ast_channel *peer) |
static void * | dial_features_duplicate (void *data) |
static int | load_module (void) |
static enum play_tone_action | parse_playtone (const char *playtone_val) |
static int | pre_bridge_setup (struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, struct ast_bridge_features *chan_features, struct ast_bridge_features *peer_features) |
static void | set_bridge_features_on_config (struct ast_bridge_config *config, const char *features) |
static void | set_config_flags (struct ast_channel *chan, struct ast_bridge_config *config) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Call Features" , .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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_features_config, .load_pri = AST_MODPRI_CORE, .requires = "extconfig", } |
static char * | app_bridge = "Bridge" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const struct ast_app_option | bridge_exec_options [128] = { [ 'p' ] = { .flag = BRIDGE_OPT_PLAYTONE }, [ 'F' ] = { .flag = OPT_CALLEE_GO_ON , .arg_index = OPT_ARG_CALLEE_GO_ON + 1 }, [ 'h' ] = { .flag = OPT_CALLEE_HANGUP }, [ 'H' ] = { .flag = OPT_CALLER_HANGUP }, [ 'k' ] = { .flag = OPT_CALLEE_PARK }, [ 'K' ] = { .flag = OPT_CALLER_PARK }, [ 'L' ] = { .flag = OPT_DURATION_LIMIT , .arg_index = OPT_ARG_DURATION_LIMIT + 1 }, [ 'S' ] = { .flag = OPT_DURATION_STOP , .arg_index = OPT_ARG_DURATION_STOP + 1 }, [ 't' ] = { .flag = OPT_CALLEE_TRANSFER }, [ 'T' ] = { .flag = OPT_CALLER_TRANSFER }, [ 'w' ] = { .flag = OPT_CALLEE_MONITOR }, [ 'W' ] = { .flag = OPT_CALLER_MONITOR }, [ 'x' ] = { .flag = OPT_CALLEE_KILL }, } |
static const struct ast_datastore_info | dial_features_info |
Routines implementing call features as call pickup, parking and transfer.
Definition in file features.c.
anonymous enum |
Definition at line 846 of file features.c.
anonymous enum |
Enumerator | |
---|---|
OPT_ARG_DURATION_LIMIT | |
OPT_ARG_DURATION_STOP | |
OPT_ARG_CALLEE_GO_ON | |
OPT_ARG_ARRAY_SIZE |
Definition at line 862 of file features.c.
enum feature_interpret_op |
Enumerator | |
---|---|
FEATURE_INTERPRET_DETECT | |
FEATURE_INTERPRET_DO | |
FEATURE_INTERPRET_CHECK |
Definition at line 249 of file features.c.
enum play_tone_action |
Enumerator | |
---|---|
PLAYTONE_NONE | |
PLAYTONE_CHANNEL1 | |
PLAYTONE_CHANNEL2 | |
PLAYTONE_BOTH |
Definition at line 721 of file features.c.
|
static |
Definition at line 1186 of file features.c.
|
static |
Definition at line 1186 of file features.c.
|
static |
Bridge channels together.
s | |
m | Make sure valid channels were specified, send errors if any of the channels could not be found/locked, answer channels if needed, create the placeholder channels and grab the other channels make the channels compatible, send error if we fail doing so setup the bridge thread object and start the bridge. |
0 |
Definition at line 757 of file features.c.
References ao2_cleanup, ast_bridge_add_channel(), ast_bridge_basic_new(), ast_bridge_destroy(), ast_bridge_set_after_goto(), ast_channel_context(), ast_channel_exten(), ast_channel_flags(), ast_channel_get_by_name_prefix(), ast_channel_lock, ast_channel_name(), ast_channel_priority(), ast_channel_unlock, ast_debug, AST_FLAG_IN_AUTOLOOP, ast_get_chan_features_xfer_config(), ast_strdupa, ast_strlen_zero, ast_test_flag, astman_get_header(), astman_send_ack(), astman_send_error(), buf, NULL, parse_playtone(), playtone(), PLAYTONE_CHANNEL1, PLAYTONE_CHANNEL2, and RAII_VAR.
Referenced by load_module().
|
static |
Definition at line 291 of file features.c.
References ast_calloc, ast_channel_datastore_add(), ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_copy_flags, ast_datastore_alloc, ast_datastore_free(), AST_FLAGS_ALL, ast_log, ast_datastore::data, DATASTORE_INHERIT_FOREVER, ast_datastore::inheritance, LOG_WARNING, ast_dial_features::my_features, NULL, and ast_dial_features::peer_features.
Referenced by add_features_datastores().
|
static |
Definition at line 423 of file features.c.
References add_features_datastore(), ast_bridge_config::features_callee, and ast_bridge_config::features_caller.
Referenced by pre_bridge_setup().
int ast_bridge_call | ( | struct ast_channel * | chan, |
struct ast_channel * | peer, | ||
struct ast_bridge_config * | config | ||
) |
bridge the call and set CDR
Bridge a call, optionally allowing redirection.
chan | The bridge considers this channel the caller. |
peer | The bridge considers this channel the callee. |
config | Configuration for this bridge. |
Set start time, check for two channels,check if monitor on check for feature activation, create new CDR
res | on success. |
-1 | on failure to bridge. |
Definition at line 716 of file features.c.
References ast_bridge_call_with_flags().
Referenced by app_exec(), and dial_exec_full().
int ast_bridge_call_with_flags | ( | struct ast_channel * | chan, |
struct ast_channel * | peer, | ||
struct ast_bridge_config * | config, | ||
unsigned int | flags | ||
) |
Bridge a call, and add additional flags to the bridge.
This does the same thing as ast_bridge_call, except that once the bridge is created, the provided flags are set on the bridge. The provided flags are added to the bridge's flags; they will not clear any flags already set.
chan | The calling channel |
peer | The called channel |
config | Bridge configuration for the channels |
flags | Additional flags to set on the created bridge |
Definition at line 633 of file features.c.
References ast_bridge_basic_new(), ast_bridge_basic_set_flags(), ast_bridge_destroy(), ast_bridge_features_cleanup(), ast_bridge_features_destroy(), ast_bridge_features_init(), ast_bridge_features_new(), ast_bridge_impart(), AST_BRIDGE_IMPART_CHAN_INDEPENDENT, AST_BRIDGE_IMPART_INHIBIT_JOIN_COLP, ast_bridge_join(), AST_BRIDGE_JOIN_INHIBIT_JOIN_COLP, AST_BRIDGE_JOIN_PASS_REFERENCE, ast_channel_lock, ast_channel_name(), ast_channel_softhangup_internal_flag(), ast_channel_unlock, AST_SOFTHANGUP_ASYNCGOTO, bridge_failed_peer_goto(), ast_bridge_config::end_bridge_callback, ast_bridge_config::end_bridge_callback_data, NULL, ast_dial_features::peer_features, pre_bridge_setup(), and SCOPE_TRACE.
Referenced by ast_bridge_call(), and try_calling().
int ast_bridge_timelimit | ( | struct ast_channel * | chan, |
struct ast_bridge_config * | config, | ||
char * | parse, | ||
struct timeval * | calldurationlimit | ||
) |
parse L option and read associated channel variables to set warning, warning frequency, and timelimit
Definition at line 886 of file features.c.
References ast_channel_lock, ast_channel_unlock, AST_FEATURE_PLAY_WARNING, ast_log, ast_set_flag, ast_strdup, ast_strdupa, ast_strlen_zero, ast_true(), ast_verb, ast_bridge_config::end_sound, ast_bridge_config::features_callee, ast_bridge_config::features_caller, LOG_WARNING, NULL, pbx_builtin_getvar_helper(), ast_bridge_config::play_warning, S_OR, ast_bridge_config::start_sound, strsep(), ast_bridge_config::timelimit, var, ast_bridge_config::warning_freq, and ast_bridge_config::warning_sound.
Referenced by bridge_exec(), and dial_exec_full().
void ast_channel_log | ( | char * | title, |
struct ast_channel * | chan | ||
) |
Definition at line 363 of file features.c.
References ast_channel_accountcode(), ast_channel_amaflags(), ast_channel_appl(), ast_channel_cdr(), ast_channel_context(), ast_channel_data(), ast_channel_dialcontext(), ast_channel_exten(), ast_channel_linkedid(), ast_channel_macrocontext(), ast_channel_macroexten(), ast_channel_macropriority(), ast_channel_masq(), ast_channel_masqr(), ast_channel_name(), ast_channel_priority(), ast_channel_uniqueid(), ast_log, and LOG_NOTICE.
Referenced by pre_bridge_setup(), and set_config_flags().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1186 of file features.c.
|
static |
Definition at line 486 of file features.c.
References ast_channel_lock, ast_channel_unlock, ast_strdupa, ast_strlen_zero, NULL, pbx_builtin_getvar_helper(), pbx_exec(), pbx_findapp(), and value.
Referenced by pre_bridge_setup().
|
static |
Definition at line 462 of file features.c.
References AST_FEATURE_PLAY_WARNING, ast_test_flag, bridge_config_set_limits_warning_values(), ast_bridge_features_limits::duration, ast_bridge_config::features_callee, ast_bridge_config::features_caller, and ast_bridge_config::timelimit.
Referenced by pre_bridge_setup().
|
static |
Definition at line 437 of file features.c.
References ast_string_field_set, ast_bridge_config::end_sound, ast_bridge_features_limits::frequency, ast_bridge_config::play_warning, ast_bridge_config::start_sound, ast_bridge_features_limits::warning, ast_bridge_config::warning_freq, and ast_bridge_config::warning_sound.
Referenced by bridge_config_set_limits().
|
static |
Bridge channels.
chan | |
data | channel to bridge with. |
Split data, check we aren't bridging with ourself, check valid channel, answer call if not already, check compatible channels, setup bridge config now bridge call, if transferred party hangs up return to PBX extension.
Definition at line 1007 of file features.c.
References ao2_cleanup, args, AST_APP_ARG, ast_app_parse_options(), ast_bridge_add_channel(), ast_bridge_basic_new(), ast_bridge_destroy(), ast_bridge_features_cleanup(), ast_bridge_features_destroy(), ast_bridge_features_init(), ast_bridge_features_new(), ast_bridge_join(), AST_BRIDGE_JOIN_PASS_REFERENCE, ast_bridge_set_after_go_on(), ast_bridge_timelimit(), ast_channel_cleanup, ast_channel_context(), ast_channel_exten(), ast_channel_get_by_name_prefix(), ast_channel_lock, ast_channel_name(), ast_channel_priority(), ast_channel_unlock, ast_channel_unref, AST_DECLARE_APP_ARGS, AST_FEATURE_AUTOMON, AST_FEATURE_DISCONNECT, AST_FEATURE_PARKCALL, AST_FEATURE_REDIRECT, ast_free, ast_get_chan_features_xfer_config(), ast_log, ast_set_flag, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, ast_test_flag, ast_verb, bridge_exec_options, BRIDGE_OPT_PLAYTONE, context, done, ast_bridge_config::end_sound, ast_bridge_config::features_callee, ast_bridge_config::features_caller, LOG_WARNING, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_CALLEE_GO_ON, OPT_ARG_DURATION_LIMIT, OPT_CALLEE_GO_ON, OPT_CALLEE_HANGUP, OPT_CALLEE_KILL, OPT_CALLEE_MONITOR, OPT_CALLEE_PARK, OPT_CALLEE_TRANSFER, OPT_CALLER_HANGUP, OPT_CALLER_MONITOR, OPT_CALLER_PARK, OPT_CALLER_TRANSFER, OPT_DURATION_LIMIT, options, pbx_builtin_setvar_helper(), ast_dial_features::peer_features, pre_bridge_setup(), priority, ast_bridge_config::start_sound, ast_bridge_config::warning_sound, and ast_features_xfer_config::xfersound.
Referenced by load_module().
|
static |
Definition at line 528 of file features.c.
References ast_autoservice_chan_hangup_peer(), ast_bridge_setup_after_goto(), and ast_pbx_start().
Referenced by ast_bridge_call_with_flags().
|
static |
Definition at line 262 of file features.c.
References ast_calloc, and NULL.
|
static |
Definition at line 1168 of file features.c.
References action_bridge(), ast_manager_register_xml_core, AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CORE, AST_MODULE_INFO(), AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ast_register_application2(), ASTERISK_GPL_KEY, bridge_exec(), EVENT_FLAG_CALL, load_features_config(), NULL, reload(), reload_features_config(), and unload_module().
|
static |
Definition at line 728 of file features.c.
References ast_false(), ast_strlen_zero, ast_true(), PLAYTONE_BOTH, PLAYTONE_CHANNEL1, PLAYTONE_CHANNEL2, and PLAYTONE_NONE.
Referenced by action_bridge().
|
static |
Definition at line 536 of file features.c.
References add_features_datastores(), ast_bridge_config::answer_topology, ast_bridge_features_ds_append(), ast_bridge_features_limits_construct(), ast_bridge_features_limits_destroy(), ast_bridge_features_set_limits(), ast_channel_lock, ast_channel_log(), ast_channel_name(), ast_channel_unlock, ast_channel_visible_indication(), AST_CONTROL_RINGING, ast_indicate(), ast_log, ast_max_forwards_reset(), ast_raw_answer_with_stream_topology(), AST_STATE_RINGING, AST_STATE_UP, bridge_check_monitor(), bridge_config_set_limits(), ast_bridge_config::features_callee, ast_bridge_config::features_caller, LOG_ERROR, pbx_builtin_getvar_helper(), SCOPE_TRACE, set_bridge_features_on_config(), set_config_flags(), and ast_bridge_config::timelimit.
Referenced by ast_bridge_call_with_flags(), and bridge_exec().
|
static |
Definition at line 383 of file features.c.
References AST_FEATURE_AUTOMIXMON, AST_FEATURE_AUTOMON, AST_FEATURE_DISCONNECT, AST_FEATURE_PARKCALL, AST_FEATURE_REDIRECT, ast_log, ast_set_flag, ast_strlen_zero, ast_bridge_config::features_callee, ast_bridge_config::features_caller, and LOG_WARNING.
Referenced by pre_bridge_setup().
|
static |
Definition at line 334 of file features.c.
References ao2_cleanup, AST_BRIDGE_DTMF_CHANNEL_0, AST_BRIDGE_DTMF_CHANNEL_1, ast_channel_lock, ast_channel_log(), ast_channel_unlock, ast_clear_flag, AST_FEATURE_DTMF_MASK, AST_FLAGS_ALL, ast_get_chan_applicationmap(), ast_set_flag, ast_test_flag, ast_bridge_config::features_callee, ast_bridge_config::features_caller, NULL, and RAII_VAR.
Referenced by pre_bridge_setup().
|
static |
Definition at line 1157 of file features.c.
References ast_manager_unregister(), ast_unregister_application(), and unload_features_config().
Referenced by load_module().
|
static |
Definition at line 1186 of file features.c.
|
static |
Definition at line 844 of file features.c.
|
static |
Definition at line 1186 of file features.c.
|
static |
Definition at line 884 of file features.c.
Referenced by bridge_exec().
|
static |
Definition at line 275 of file features.c.