Asterisk - The Open Source Telephony Project GIT-master-66c01d8
|
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/test.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 = AST_BUILDOPT_SUM, .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 44 of file func_periodic_hook.c.
|
static |
Definition at line 531 of file func_periodic_hook.c.
|
static |
Definition at line 531 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 505 of file func_periodic_hook.c.
References args, ast_log, AST_MAX_CONTEXT, AST_MAX_EXTENSION, beep_exten, context_name, hook_read(), len(), LOG_WARNING, and NULL.
Referenced by mixmonitor_exec().
int AST_OPTIONAL_API_NAME() ast_beep_stop | ( | struct ast_channel * | chan, |
const char * | beep_id | ||
) |
Definition at line 521 of file func_periodic_hook.c.
References hook_write(), and NULL.
Referenced by stop_mixmonitor_full().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 531 of file func_periodic_hook.c.
|
static |
Definition at line 229 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 251 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::audiohook, do_hook(), LOG_WARNING, name, and ast_audiohook::status.
Referenced by hook_state_alloc().
|
static |
Definition at line 132 of file func_periodic_hook.c.
References ast_audiohook_destroy(), ast_audiohook_detach(), ast_audiohook_lock, ast_audiohook_unlock, and ast_free.
|
static |
Definition at line 172 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_thread_arg::hook_id, hook_thread_arg_destroy(), ast_variable::name, and NULL.
Referenced by do_hook().
|
static |
Definition at line 356 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_datastore, hook_state::hook_id, LOG_WARNING, and state.
Referenced by hook_write().
|
static |
Definition at line 325 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(), ast_test_suite_event_notify, voicemailpwcheck::context, ast_datastore::data, init_hook(), LOG_WARNING, and S_OR.
Referenced by hook_read().
|
static |
Definition at line 398 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_datastore, LOG_WARNING, and state.
Referenced by hook_write().
|
static |
Definition at line 382 of file func_periodic_hook.c.
References ast_atomic_fetchadd_int(), buf, global_hook_id, hook_state::hook_id, hook_on(), and len().
Referenced by ast_beep_start().
|
static |
Definition at line 277 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, voicemailpwcheck::context, hook_state::exten, hook_callback(), hook_state::hook_id, hook_state::interval, NULL, and state.
Referenced by init_hook().
|
static |
Definition at line 194 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_thread_arg::context, hook_thread_arg::exten, hook_thread_arg::hook_id, hook_thread_arg_destroy(), and NULL.
Referenced by do_hook().
|
static |
Definition at line 163 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 424 of file func_periodic_hook.c.
References ast_false(), ast_log, ast_true(), hook_off(), hook_re_enable(), LOG_WARNING, and value.
Referenced by ast_beep_stop().
|
static |
Definition at line 298 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(), voicemailpwcheck::context, ast_datastore::data, hook_datastore, hook_state_alloc(), state, and ast_datastore::uid.
Referenced by hook_on().
|
static |
Definition at line 459 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, hook_function, LOG_ERROR, NULL, and unload_module().
|
static |
Definition at line 451 of file func_periodic_hook.c.
References ast_context_destroy(), ast_custom_function_unregister(), AST_MODULE, hook_function, and NULL.
Referenced by load_module().
|
static |
Definition at line 531 of file func_periodic_hook.c.
|
static |
Definition at line 531 of file func_periodic_hook.c.
|
static |
Definition at line 100 of file func_periodic_hook.c.
Referenced by ast_beep_start(), and load_module().
|
static |
Definition at line 96 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 97 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 98 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 108 of file func_periodic_hook.c.
Referenced by hook_read().
|
static |
Definition at line 146 of file func_periodic_hook.c.
Referenced by hook_off(), hook_re_enable(), and init_hook().
|
static |
Definition at line 445 of file func_periodic_hook.c.
Referenced by load_module(), and unload_module().