Asterisk - The Open Source Telephony Project
18.5.0
|
Periodic dialplan hooks. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/audiohook.h"
#include "asterisk/beep.h"
Go to the source code of this file.
Data Structures | |
struct | hook_state |
struct | hook_thread_arg |
Macros | |
#define | AST_API_MODULE |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
int AST_OPTIONAL_API_NAME() | ast_beep_start (struct ast_channel *chan, unsigned int interval, char *beep_id, size_t len) |
int AST_OPTIONAL_API_NAME() | ast_beep_stop (struct ast_channel *chan, const char *beep_id) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | do_hook (struct ast_channel *chan, struct hook_state *state) |
static int | hook_callback (struct ast_audiohook *audiohook, struct ast_channel *chan, struct ast_frame *frame, enum ast_audiohook_direction direction) |
static void | hook_datastore_destroy_callback (void *data) |
static void * | hook_launch_thread (void *data) |
static int | hook_off (struct ast_channel *chan, const char *hook_id) |
static int | hook_on (struct ast_channel *chan, const char *data, unsigned int hook_id) |
static int | hook_re_enable (struct ast_channel *chan, const char *uid) |
static int | hook_read (struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len) |
static struct hook_state * | hook_state_alloc (const char *context, const char *exten, unsigned int interval, unsigned int hook_id) |
static struct hook_thread_arg * | hook_thread_arg_alloc (struct ast_channel *chan, struct hook_state *state) |
static void | hook_thread_arg_destroy (struct hook_thread_arg *arg) |
static int | hook_write (struct ast_channel *chan, const char *cmd, char *data, const char *value) |
static int | init_hook (struct ast_channel *chan, const char *context, const char *exten, unsigned int interval, unsigned int hook_id) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS , .description = "Periodic dialplan hooks." , .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, .requires = "app_chanspy,func_cut,func_groupcount,func_uri", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const char | beep_exten [] = "beep" |
static const char | context_name [] = "__func_periodic_hook_context__" |
static const char | exten_name [] = "hook" |
static const char | full_exten_name [] = "hook@__func_periodic_hook_context__" |
static unsigned int | global_hook_id |
Last used hook ID. More... | |
static const struct ast_datastore_info | hook_datastore |
static struct ast_custom_function | hook_function |
Periodic dialplan hooks.
Definition in file func_periodic_hook.c.
#define AST_API_MODULE |
Definition at line 43 of file func_periodic_hook.c.
|
static |
Definition at line 523 of file func_periodic_hook.c.
|
static |
Definition at line 523 of file func_periodic_hook.c.
int AST_OPTIONAL_API_NAME() ast_beep_start | ( | struct ast_channel * | chan, |
unsigned int | interval, | ||
char * | beep_id, | ||
size_t | len | ||
) |
Definition at line 497 of file func_periodic_hook.c.
References args, ast_log, AST_MAX_CONTEXT, AST_MAX_EXTENSION, beep_exten, context_name, hook_read(), hook_state::interval, len(), LOG_WARNING, and NULL.
Referenced by mixmonitor_exec(), and start_monitor_exec().
int AST_OPTIONAL_API_NAME() ast_beep_stop | ( | struct ast_channel * | chan, |
const char * | beep_id | ||
) |
Definition at line 513 of file func_periodic_hook.c.
References AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, hook_write(), load_module(), NULL, and unload_module().
Referenced by __stub__ast_beep_start(), ast_monitor_stop(), and stop_mixmonitor_full().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 523 of file func_periodic_hook.c.
|
static |
Definition at line 225 of file func_periodic_hook.c.
References ast_pthread_create_detached_background, hook_launch_thread(), hook_thread_arg_alloc(), hook_thread_arg_destroy(), and NULL.
Referenced by hook_callback().
|
static |
Definition at line 247 of file func_periodic_hook.c.
References AST_AUDIOHOOK_STATUS_DONE, ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_log, ast_strdupa, ast_tvdiff_ms(), ast_tvnow(), hook_state::disabled, do_hook(), hook_state::interval, hook_state::last_hook, LOG_WARNING, name, and ast_audiohook::status.
Referenced by hook_state_alloc().
|
static |
Definition at line 128 of file func_periodic_hook.c.
References ast_audiohook_destroy(), ast_audiohook_detach(), ast_audiohook_lock, ast_audiohook_unlock, ast_free, hook_state::audiohook, hook_state::context, and hook_state::exten.
|
static |
Definition at line 168 of file func_periodic_hook.c.
References AST_OUTGOING_NO_WAIT, ast_pbx_outgoing_exten(), hook_thread_arg::chan_name, hook_thread_arg::context, hook_thread_arg::exten, full_exten_name, hook_state::hook_id, hook_thread_arg::hook_id, hook_thread_arg_destroy(), ast_variable::name, and NULL.
Referenced by do_hook().
|
static |
Definition at line 350 of file func_periodic_hook.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_log, ast_strlen_zero, ast_datastore::data, hook_state::disabled, LOG_WARNING, and state.
Referenced by hook_write().
|
static |
Definition at line 321 of file func_periodic_hook.c.
References args, AST_APP_ARG, ast_channel_name(), ast_debug, AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero, hook_state::context, hook_state::exten, init_hook(), hook_state::interval, LOG_WARNING, parse(), and S_OR.
Referenced by hook_read().
|
static |
Definition at line 392 of file func_periodic_hook.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_log, ast_strlen_zero, ast_datastore::data, hook_state::disabled, LOG_WARNING, and state.
Referenced by hook_write().
|
static |
Definition at line 376 of file func_periodic_hook.c.
References ast_atomic_fetchadd_int(), global_hook_id, hook_state::hook_id, and hook_on().
Referenced by ast_beep_start().
|
static |
Definition at line 273 of file func_periodic_hook.c.
References ast_audiohook_init(), AST_AUDIOHOOK_MANIPULATE_ALL_RATES, AST_AUDIOHOOK_TYPE_MANIPULATE, ast_calloc, AST_MODULE, ast_strdup, hook_state::audiohook, hook_state::context, hook_state::exten, hook_callback(), hook_state::hook_id, hook_state::interval, ast_audiohook::manipulate_callback, NULL, and state.
Referenced by init_hook().
|
static |
Definition at line 190 of file func_periodic_hook.c.
References ast_asprintf, ast_calloc, ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_strdup, hook_thread_arg::chan_name, hook_state::context, hook_thread_arg::context, hook_state::exten, hook_thread_arg::exten, hook_state::hook_id, hook_thread_arg::hook_id, hook_thread_arg_destroy(), and NULL.
Referenced by do_hook().
|
static |
Definition at line 159 of file func_periodic_hook.c.
References ast_free, hook_thread_arg::chan_name, hook_thread_arg::context, hook_thread_arg::exten, and hook_thread_arg::hook_id.
Referenced by do_hook(), hook_launch_thread(), and hook_thread_arg_alloc().
|
static |
Definition at line 418 of file func_periodic_hook.c.
References ast_false(), ast_log, ast_true(), hook_off(), hook_re_enable(), and LOG_WARNING.
Referenced by ast_beep_stop().
|
static |
Definition at line 294 of file func_periodic_hook.c.
References ast_audiohook_attach(), ast_channel_datastore_add(), ast_channel_lock, ast_channel_unlock, ast_datastore_alloc, ast_datastore_free(), hook_state::audiohook, ast_datastore::data, hook_state_alloc(), state, and ast_datastore::uid.
Referenced by hook_on().
|
static |
Definition at line 453 of file func_periodic_hook.c.
References ast_add_extension(), AST_CFE_BOTH, ast_context_find_or_create(), ast_custom_function_register_escalating, ast_log, AST_MODULE, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, beep_exten, context_name, exten_name, LOG_ERROR, NULL, and unload_module().
Referenced by ast_beep_stop().
|
static |
Definition at line 445 of file func_periodic_hook.c.
References ast_context_destroy(), ast_custom_function_unregister(), AST_MODULE, and NULL.
Referenced by ast_beep_stop(), and load_module().
|
static |
Definition at line 523 of file func_periodic_hook.c.
|
static |
Definition at line 523 of file func_periodic_hook.c.
|
static |
Definition at line 96 of file func_periodic_hook.c.
Referenced by ast_beep_start(), and load_module().
|
static |
Definition at line 92 of file func_periodic_hook.c.
Referenced by add_extension(), app_create(), app_dtor(), ast_beep_start(), device_state_notify_callbacks(), load_module(), lua_register_hints(), lua_register_switches(), lua_sort_extensions(), and presence_state_notify_callbacks().
|
static |
Definition at line 93 of file func_periodic_hook.c.
Referenced by device_state_notify_callbacks(), hint_hash(), load_module(), and presence_state_notify_callbacks().
|
static |
Definition at line 94 of file func_periodic_hook.c.
Referenced by hook_launch_thread().
|
static |
Last used hook ID.
This is incremented each time a hook is created to give each hook a unique ID.
Definition at line 104 of file func_periodic_hook.c.
Referenced by hook_read().
|
static |
Definition at line 142 of file func_periodic_hook.c.
|
static |
Definition at line 439 of file func_periodic_hook.c.