Asterisk - The Open Source Telephony Project
21.4.1
|
res_stasis recording support. More...
#include "asterisk.h"
#include "asterisk/dsp.h"
#include "asterisk/file.h"
#include "asterisk/module.h"
#include "asterisk/paths.h"
#include "asterisk/stasis_app_impl.h"
#include "asterisk/stasis_app_recording.h"
#include "asterisk/stasis_channels.h"
Go to the source code of this file.
Data Structures | |
struct | stasis_app_recording |
Macros | |
#define | RECORDING_BUCKETS 127 |
#define | RECORDING_CHECK 0 |
#define | RECORDING_COMMENT NULL |
Typedefs | |
typedef int(* | recording_operation_cb) (struct stasis_app_recording *recording) |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static enum stasis_app_control_channel_result | check_rule_recording (const struct stasis_app_control *control) |
static int | load_module (void) |
static int | record_file (struct stasis_app_control *control, struct ast_channel *chan, void *data) |
static int | recording_cancel (struct stasis_app_recording *recording) |
static void | recording_cleanup (void *data) |
static int | recording_cmp (void *obj, void *arg, int flags) |
static int | recording_disregard (struct stasis_app_recording *recording) |
static void | recording_dtor (void *obj) |
static void | recording_fail (struct stasis_app_control *control, struct stasis_app_recording *recording, const char *cause) |
static int | recording_hash (const void *obj, int flags) |
static int | recording_mute (struct stasis_app_recording *recording) |
static int | recording_noop (struct stasis_app_recording *recording) |
static void | recording_options_dtor (void *obj) |
static int | recording_pause (struct stasis_app_recording *recording) |
static void | recording_publish (struct stasis_app_recording *recording, const char *cause) |
static void | recording_set_state (struct stasis_app_recording *recording, enum stasis_app_recording_state state, const char *cause) |
static int | recording_stop (struct stasis_app_recording *recording) |
static struct ast_json * | recording_to_json (struct stasis_message *message, const struct stasis_message_sanitizer *sanitize) |
static int | recording_unmute (struct stasis_app_recording *recording) |
static int | recording_unpause (struct stasis_app_recording *recording) |
struct stasis_app_recording * | stasis_app_control_record (struct stasis_app_control *control, struct stasis_app_recording_options *options) |
Record media from a channel. More... | |
struct stasis_app_recording * | stasis_app_recording_find_by_name (const char *name) |
Finds the recording object with the given name. More... | |
const char * | stasis_app_recording_get_name (struct stasis_app_recording *recording) |
Gets the unique name of a recording object. More... | |
enum stasis_app_recording_state | stasis_app_recording_get_state (struct stasis_app_recording *recording) |
Gets the current state of a recording operation. More... | |
enum ast_record_if_exists | stasis_app_recording_if_exists_parse (const char *str) |
Parse a string into the if_exists enum. More... | |
enum stasis_app_recording_oper_results | stasis_app_recording_operation (struct stasis_app_recording *recording, enum stasis_app_recording_media_operation operation) |
Controls the media for a given recording operation. More... | |
struct stasis_app_recording_options * | stasis_app_recording_options_create (const char *name, const char *format) |
Allocate a recording options object. More... | |
char | stasis_app_recording_termination_parse (const char *str) |
Parse a string into the recording termination enum. More... | |
struct ast_json * | stasis_app_recording_to_json (const struct stasis_app_recording *recording) |
Construct a JSON model of a recording. More... | |
STASIS_MESSAGE_TYPE_DEFN (stasis_app_recording_snapshot_type,.to_json=recording_to_json,) | |
static const char * | state_to_string (enum stasis_app_recording_state state) |
static int | toggle_recording_mute (struct stasis_app_recording *recording, int desired_mute_state) |
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 = "Stasis application recording 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", .load_pri = AST_MODPRI_APP_DEPEND } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
recording_operation_cb | operations [STASIS_APP_RECORDING_STATE_MAX][STASIS_APP_RECORDING_OPER_MAX] |
static struct ao2_container * | recordings |
static struct stasis_app_control_rule | rule_recording |
res_stasis recording support.
Definition in file res_stasis_recording.c.
#define RECORDING_BUCKETS 127 |
Number of hash buckets for recording container. Keep it prime!
Definition at line 42 of file res_stasis_recording.c.
#define RECORDING_CHECK 0 |
Recording check is unimplemented. le sigh
Definition at line 48 of file res_stasis_recording.c.
#define RECORDING_COMMENT NULL |
Comment is ignored by most formats, so we will ignore it, too.
Definition at line 45 of file res_stasis_recording.c.
struct stasis_app_recording* stasis_app_control_record | ( | struct stasis_app_control * | control, |
struct stasis_app_recording_options * | options | ||
) |
Record media from a channel.
A reference to the options object may be kept, so it MUST NOT be modified after calling this function.
On error, errno
is set to indicate the failure reason.
EINVAL:
Invalid input.EEXIST:
A recording with that name is in session.ENOMEM:
Out of memory.control | Control for res_stasis . |
options | Recording options. |
NULL | on error. |
Definition at line 370 of file res_stasis_recording.c.
References stasis_app_recording::absolute_name, ao2_bump, ao2_link, ao2_ref, ast_asprintf, ast_debug, ast_fileexists(), AST_RECORD_IF_EXISTS_FAIL, ast_safe_mkdir(), stasis_app_recording::control, stasis_app_recording::duration, stasis_app_recording::energy_only, stasis_app_recording_options::format, stasis_app_recording_options::if_exists, lock, stasis_app_recording_options::max_duration_seconds, stasis_app_recording_options::max_silence_seconds, stasis_app_recording_options::name, OBJ_KEY, OBJ_NOLOCK, stasis_app_recording::options, RAII_VAR, SCOPED_AO2LOCK, stasis_app_control_get_channel_id(), stasis_app_control_register_add_rule(), STASIS_APP_RECORDING_STATE_QUEUED, stasis_app_send_command_async(), stasis_app_recording::state, and stasis_app_recording::total.
Referenced by ast_ari_bridges_record(), and ast_ari_channels_record().
struct stasis_app_recording* stasis_app_recording_find_by_name | ( | const char * | name | ) |
Finds the recording object with the given name.
name | Name of the recording object to find. |
NULL | if name not found. |
Definition at line 473 of file res_stasis_recording.c.
References OBJ_KEY.
Referenced by ast_ari_recordings_get_live().
const char* stasis_app_recording_get_name | ( | struct stasis_app_recording * | recording | ) |
Gets the unique name of a recording object.
recording | Recording control object. |
NULL | if recording ic NULL |
Definition at line 467 of file res_stasis_recording.c.
References stasis_app_recording_options::name, and stasis_app_recording::options.
enum stasis_app_recording_state stasis_app_recording_get_state | ( | struct stasis_app_recording * | recording | ) |
Gets the current state of a recording operation.
recording | Recording control object. |
Definition at line 461 of file res_stasis_recording.c.
References stasis_app_recording::state.
enum ast_record_if_exists stasis_app_recording_if_exists_parse | ( | const char * | str | ) |
Parse a string into the if_exists enum.
str | String to parse. |
Definition at line 194 of file res_stasis_recording.c.
References AST_RECORD_IF_EXISTS_APPEND, AST_RECORD_IF_EXISTS_ERROR, AST_RECORD_IF_EXISTS_FAIL, and AST_RECORD_IF_EXISTS_OVERWRITE.
Referenced by ast_ari_bridges_record(), and ast_ari_channels_record().
enum stasis_app_recording_oper_results stasis_app_recording_operation | ( | struct stasis_app_recording * | recording, |
enum stasis_app_recording_media_operation | operation | ||
) |
Controls the media for a given recording operation.
recording | Recording control object. |
operation | Media control operation. |
STASIS_APP_RECORDING_OPER_OK | on success. |
Definition at line 590 of file res_stasis_recording.c.
References lock, SCOPED_AO2LOCK, STASIS_APP_RECORDING_OPER_FAILED, STASIS_APP_RECORDING_OPER_MAX, STASIS_APP_RECORDING_OPER_NOT_RECORDING, STASIS_APP_RECORDING_OPER_OK, STASIS_APP_RECORDING_STATE_MAX, STASIS_APP_RECORDING_STATE_RECORDING, and stasis_app_recording::state.
struct stasis_app_recording_options* stasis_app_recording_options_create | ( | const char * | name, |
const char * | format | ||
) |
Allocate a recording options object.
Clean up with ao2_cleanup().
name | Name of the recording. |
format | Format to record in. |
NULL | on error. |
Definition at line 151 of file res_stasis_recording.c.
References ao2_ref, ast_string_field_init, ast_string_field_set, and RAII_VAR.
Referenced by ast_ari_bridges_record(), and ast_ari_channels_record().
char stasis_app_recording_termination_parse | ( | const char * | str | ) |
Parse a string into the recording termination enum.
str | String to parse. |
STASIS_APP_RECORDING_TERMINATE_NONE | to not terminate on DTMF. |
STASIS_APP_RECORDING_TERMINATE_ANY | to terminate on any DTMF. |
STASIS_APP_RECORDING_TERMINATE_INVALID | if input was invalid. |
Definition at line 169 of file res_stasis_recording.c.
Referenced by ast_ari_bridges_record(), and ast_ari_channels_record().
struct ast_json* stasis_app_recording_to_json | ( | const struct stasis_app_recording * | recording | ) |
Construct a JSON model of a recording.
recording | Recording to conver. |
NULL | on error. |
Definition at line 478 of file res_stasis_recording.c.
References ast_json_integer_create(), ast_json_object_set(), ast_json_pack(), ast_json_ref(), ast_json_unref(), stasis_app_recording::duration, stasis_app_recording::energy_only, stasis_app_recording_options::format, stasis_app_recording_options::name, stasis_app_recording::options, RAII_VAR, stasis_app_recording::state, stasis_app_recording_options::target, and stasis_app_recording::total.
Referenced by ast_ari_bridges_record(), ast_ari_channels_record(), and ast_ari_recordings_get_live().
|
static |
Container of all current recordings
Definition at line 51 of file res_stasis_recording.c.
|
static |
Definition at line 273 of file res_stasis_recording.c.