Asterisk - The Open Source Telephony Project
21.4.1
|
Stasis application snoop control support. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/stasis_app_impl.h"
#include "asterisk/stasis_app_snoop.h"
#include "asterisk/audiohook.h"
#include "asterisk/pbx.h"
#include "asterisk/timing.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/json.h"
#include "asterisk/format_cache.h"
Go to the source code of this file.
Data Structures | |
struct | stasis_app_snoop |
Structure which contains all of the snoop information. More... | |
Macros | |
#define | SNOOP_INTERVAL 20 |
The interval (in milliseconds) that the Snoop timer is triggered, also controls length of audio within frames. | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static int | load_module (void) |
static void | publish_chanspy_message (struct stasis_app_snoop *snoop, int start) |
static void | snoop_destroy (void *obj) |
Destructor for snoop structure. | |
static void | snoop_determine_format (struct ast_channel *chan, struct stasis_app_snoop *snoop) |
Helper function which gets the format for a Snoop channel based on the channel being snooped on. | |
static int | snoop_fixup (struct ast_channel *oldchan, struct ast_channel *newchan) |
static int | snoop_hangup (struct ast_channel *chan) |
Callback function for hanging up a Snoop channel. | |
static struct ast_frame * | snoop_read (struct ast_channel *chan) |
Callback function for reading from a Snoop channel. | |
static int | snoop_setup_audiohook (struct ast_channel *chan, enum ast_audiohook_type type, enum stasis_app_snoop_direction requested_direction, enum ast_audiohook_direction *direction, struct ast_audiohook *audiohook) |
Internal helper function which sets up and attaches a snoop audiohook. | |
static void * | snoop_stasis_thread (void *obj) |
Thread used for running the Stasis application. | |
static int | snoop_write (struct ast_channel *chan, struct ast_frame *frame) |
Callback function for writing to a Snoop whisper audiohook. | |
struct ast_channel * | stasis_app_control_snoop (struct ast_channel *chan, enum stasis_app_snoop_direction spy, enum stasis_app_snoop_direction whisper, const char *app, const char *app_args, const char *snoop_id) |
Create a snoop on the provided channel. More... | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS , .description = "Stasis application snoop support" , .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 = "res_stasis", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static unsigned int | chan_idx |
Index used to keep Snoop channel names unique. | |
static struct ast_channel_tech | snoop_tech |
Channel interface declaration. | |
Stasis application snoop control support.
Definition in file res_stasis_snoop.c.
struct ast_channel* stasis_app_control_snoop | ( | struct ast_channel * | chan, |
enum stasis_app_snoop_direction | spy, | ||
enum stasis_app_snoop_direction | whisper, | ||
const char * | app, | ||
const char * | app_args, | ||
const char * | snoop_id | ||
) |
Create a snoop on the provided channel.
chan | Channel to snoop on. |
spy | Direction of media that should be spied on. |
whisper | Direction of media that should be whispered into. |
app | Stasis application to execute on the snoop channel. |
app_args | Stasis application arguments. |
snoop_id |
NULL | if snoop channel couldn't be created. |
Definition at line 303 of file res_stasis_snoop.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_ref, stasis_app_snoop::app, ast_atomic_fetchadd_int(), AST_AUDIOHOOK_TYPE_SPY, AST_AUDIOHOOK_TYPE_WHISPER, ast_calloc, ast_channel_alloc, ast_channel_ref, ast_channel_set_fd(), ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_get_sample_rate(), AST_FRAME_VOICE, ast_hangup(), AST_STATE_UP, ast_str_append(), ast_str_create, ast_str_set(), ast_timer_fd(), ast_timer_open(), ast_timer_set_rate(), stasis_app_snoop::chan, chan_idx, ast_frame::data, ast_frame::datalen, ast_frame_subclass::format, ast_frame::frametype, ast_frame::mallocd, ast_frame::offset, RAII_VAR, ast_frame::samples, stasis_app_snoop::silence, snoop_destroy(), snoop_determine_format(), SNOOP_INTERVAL, snoop_setup_audiohook(), snoop_stasis_thread(), stasis_app_snoop::spy, stasis_app_snoop::spy_active, stasis_app_snoop::spy_direction, stasis_app_snoop::spy_format, stasis_app_snoop::spy_samples, stasis_app_snoop::spyee_chan, ast_frame::src, STASIS_SNOOP_DIRECTION_NONE, ast_frame::subclass, thread, stasis_app_snoop::timer, stasis_app_snoop::whisper, stasis_app_snoop::whisper_active, and stasis_app_snoop::whisper_direction.