Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
RTP (Multicast and Unicast) Media Channel. More...
#include "asterisk.h"
#include "asterisk/channel.h"
#include "asterisk/module.h"
#include "asterisk/pbx.h"
#include "asterisk/acl.h"
#include "asterisk/app.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/causes.h"
#include "asterisk/format_cache.h"
#include "asterisk/multicast_rtp.h"
#include "asterisk/dns_core.h"
Go to the source code of this file.
Enumerations | |
enum | { OPT_RTP_CODEC = (1 << 0) , OPT_RTP_ENGINE = (1 << 1) , OPT_RTP_GLUE = (1 << 2) } |
enum | { OPT_ARG_RTP_CODEC , OPT_ARG_RTP_ENGINE , OPT_ARG_ARRAY_SIZE } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | chan_rtp_get_codec (struct ast_channel *chan, struct ast_format_cap *result) |
Function called by RTP engine to get peer capabilities. More... | |
static enum ast_rtp_glue_result | chan_rtp_get_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
Function called by RTP engine to get local audio RTP peer. More... | |
static enum ast_rtp_glue_result | chan_rtp_get_vrtp_peer (struct ast_channel *chan, struct ast_rtp_instance **instance) |
Function called by RTP engine to get local audio RTP peer. More... | |
static int | chan_rtp_set_rtp_peer (struct ast_channel *chan, struct ast_rtp_instance *rtp, struct ast_rtp_instance *vrtp, struct ast_rtp_instance *tpeer, const struct ast_format_cap *cap, int nat_active) |
Function called by RTP engine to change where the remote party should send media. More... | |
static struct ast_format * | derive_format_from_cap (struct ast_format_cap *cap) |
static int | load_module (void) |
Function called when our module is loaded. More... | |
static struct ast_channel * | multicast_rtp_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause) |
Function called when we should prepare to call the multicast destination. More... | |
static int | rtp_call (struct ast_channel *ast, const char *dest, int timeout) |
Function called when we should actually call the destination. More... | |
static int | rtp_hangup (struct ast_channel *ast) |
Function called when we should hang the channel up. More... | |
static struct ast_frame * | rtp_read (struct ast_channel *ast) |
Function called when we should read a frame from the channel. More... | |
static int | rtp_write (struct ast_channel *ast, struct ast_frame *f) |
Function called when we should write a frame to the channel. More... | |
static struct ast_channel * | unicast_rtp_request (const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause) |
Function called when we should prepare to call the unicast destination. More... | |
static int | unload_module (void) |
Function called when our module is unloaded. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "RTP Media Channel" , .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, .load_pri = AST_MODPRI_CHANNEL_DRIVER, .requires = "res_rtp_multicast", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const struct ast_datastore_info | chan_rtp_datastore_info |
static struct ast_channel_tech | multicast_rtp_tech |
static struct ast_rtp_glue | unicast_rtp_glue |
Local glue for interacting with the RTP engine core. More... | |
static const struct ast_app_option | unicast_rtp_options [128] = { [ 'c' ] = { .flag = OPT_RTP_CODEC , .arg_index = OPT_ARG_RTP_CODEC + 1 }, [ 'e' ] = { .flag = OPT_RTP_ENGINE , .arg_index = OPT_ARG_RTP_ENGINE + 1 }, [ 'g' ] = { .flag = OPT_RTP_GLUE }, } |
static struct ast_channel_tech | unicast_rtp_tech |
RTP (Multicast and Unicast) Media Channel.
Definition in file chan_rtp.c.
anonymous enum |
Enumerator | |
---|---|
OPT_RTP_CODEC | |
OPT_RTP_ENGINE | |
OPT_RTP_GLUE |
Definition at line 250 of file chan_rtp.c.
anonymous enum |
Enumerator | |
---|---|
OPT_ARG_RTP_CODEC | |
OPT_ARG_RTP_ENGINE | |
OPT_ARG_ARRAY_SIZE |
Definition at line 256 of file chan_rtp.c.
|
static |
Definition at line 526 of file chan_rtp.c.
|
static |
Definition at line 526 of file chan_rtp.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 526 of file chan_rtp.c.
|
static |
Function called by RTP engine to get peer capabilities.
Definition at line 420 of file chan_rtp.c.
References ast_channel_name(), ast_channel_nativeformats(), ast_format_cap_append_from_cap(), ast_format_cap_get_names(), AST_FORMAT_CAP_NAMES_LEN, AST_MEDIA_TYPE_UNKNOWN, ast_str_tmp, result, SCOPE_ENTER, and SCOPE_EXIT_RTN.
|
static |
Function called by RTP engine to get local audio RTP peer.
Definition at line 444 of file chan_rtp.c.
References ao2_ref, ast_channel_datastore_find(), ast_channel_tech_pvt(), AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_LOCAL, chan_rtp_datastore_info, and NULL.
|
static |
Function called by RTP engine to get local audio RTP peer.
Definition at line 438 of file chan_rtp.c.
References AST_RTP_GLUE_RESULT_FORBID.
|
static |
Function called by RTP engine to change where the remote party should send media.
chan_rtp is not able to actually update the peer, so this function has no effect.
Definition at line 432 of file chan_rtp.c.
|
static |
Definition at line 122 of file chan_rtp.c.
References ao2_bump, ao2_ref, ast_format_cap_count(), ast_format_cap_get_format(), ast_format_slin, and ast_format_ulaw.
Referenced by multicast_rtp_request(), and unicast_rtp_request().
|
static |
Function called when our module is loaded.
Definition at line 491 of file chan_rtp.c.
References ast_channel_register(), ast_format_cap_alloc, ast_format_cap_append_by_type(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_log, AST_MEDIA_TYPE_UNKNOWN, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_rtp_glue_register, ast_channel_tech::capabilities, LOG_ERROR, multicast_rtp_tech, unicast_rtp_glue, unicast_rtp_tech, and unload_module().
|
static |
Function called when we should prepare to call the multicast destination.
Definition at line 140 of file chan_rtp.c.
References ao2_cleanup, ao2_ref, args, AST_APP_ARG, AST_CAUSE_FAILURE, ast_channel_alloc, ast_channel_nativeformats_set(), ast_channel_set_rawreadformat(), ast_channel_set_rawwriteformat(), ast_channel_set_readformat(), ast_channel_set_writeformat(), ast_channel_tech_pvt_set(), ast_channel_tech_set(), ast_channel_uniqueid(), ast_channel_unlock, AST_DECLARE_APP_ARGS, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_log, ast_multicast_rtp_create_options(), ast_multicast_rtp_free_options(), ast_multicast_rtp_options_get_format(), AST_NONSTANDARD_APP_ARGS, ast_rtp_instance_destroy(), ast_rtp_instance_new(), ast_rtp_instance_set_channel_id(), ast_rtp_instance_set_remote_address, ast_sockaddr_parse(), ast_sockaddr_setnull(), AST_STATE_DOWN, ast_strdupa, ast_strlen_zero(), derive_format_from_cap(), ast_multicast_rtp_options::fmt, LOG_ERROR, multicast_rtp_tech, NULL, options, PARSE_PORT_REQUIRE, and type.
|
static |
Function called when we should actually call the destination.
Definition at line 101 of file chan_rtp.c.
References ast_channel_tech_pvt(), AST_CONTROL_ANSWER, ast_queue_control(), and ast_rtp_instance_activate().
|
static |
Function called when we should hang the channel up.
Definition at line 111 of file chan_rtp.c.
References ast_channel_tech_pvt(), ast_channel_tech_pvt_set(), ast_rtp_instance_destroy(), and NULL.
|
static |
Function called when we should read a frame from the channel.
Definition at line 79 of file chan_rtp.c.
References ast_channel_fdno(), ast_channel_tech_pvt(), ast_null_frame, and ast_rtp_instance_read().
|
static |
Function called when we should write a frame to the channel.
Definition at line 93 of file chan_rtp.c.
References ast_channel_tech_pvt(), and ast_rtp_instance_write().
|
static |
Function called when we should prepare to call the unicast destination.
Definition at line 277 of file chan_rtp.c.
References ao2_cleanup, ao2_ref, args, AST_APP_ARG, ast_app_parse_options(), AST_CAUSE_FAILURE, ast_channel_alloc, ast_channel_datastore_add(), ast_channel_nativeformats_set(), ast_channel_set_fd(), ast_channel_set_rawreadformat(), ast_channel_set_rawwriteformat(), ast_channel_set_readformat(), ast_channel_set_writeformat(), ast_channel_tech_pvt_set(), ast_channel_tech_set(), ast_channel_uniqueid(), ast_channel_unlock, ast_datastore_alloc, AST_DECLARE_APP_ARGS, ast_dns_resolve_ipv6_and_ipv4(), ast_format_cache_get, ast_format_cap_alloc, ast_format_cap_append, AST_FORMAT_CAP_FLAG_DEFAULT, ast_log, AST_NONSTANDARD_APP_ARGS, ast_ouraddrfor(), ast_rtp_instance_destroy(), ast_rtp_instance_fd(), ast_rtp_instance_get_local_address(), ast_rtp_instance_new(), ast_rtp_instance_set_channel_id(), ast_rtp_instance_set_remote_address, ast_sockaddr_copy(), ast_sockaddr_parse(), ast_sockaddr_split_hostport(), ast_sockaddr_stringify_addr(), ast_sockaddr_stringify_port(), AST_STATE_DOWN, ast_strdupa, ast_strlen_zero(), ast_test_flag, chan_rtp_datastore_info, derive_format_from_cap(), LOG_ERROR, NULL, OPT_ARG_ARRAY_SIZE, OPT_ARG_RTP_CODEC, OPT_ARG_RTP_ENGINE, OPT_RTP_CODEC, OPT_RTP_ENGINE, OPT_RTP_GLUE, options, PARSE_PORT_REQUIRE, pbx_builtin_setvar_helper(), S_COR, S_OR, unicast_rtp_options, and unicast_rtp_tech.
|
static |
Function called when our module is unloaded.
Definition at line 475 of file chan_rtp.c.
References ao2_cleanup, ast_channel_unregister(), ast_rtp_glue_unregister(), ast_channel_tech::capabilities, multicast_rtp_tech, NULL, unicast_rtp_glue, and unicast_rtp_tech.
Referenced by load_module().
|
static |
Definition at line 526 of file chan_rtp.c.
|
static |
Definition at line 526 of file chan_rtp.c.
|
static |
Definition at line 272 of file chan_rtp.c.
Referenced by chan_rtp_get_rtp_peer(), and unicast_rtp_request().
|
static |
Definition at line 57 of file chan_rtp.c.
Referenced by load_module(), multicast_rtp_request(), and unload_module().
|
static |
Local glue for interacting with the RTP engine core.
Definition at line 466 of file chan_rtp.c.
Referenced by load_module(), and unload_module().
|
static |
Set the codec to be used for unicast RTP
Set the RTP engine to use for unicast RTP
Provide RTP glue for the channel
Definition at line 270 of file chan_rtp.c.
Referenced by unicast_rtp_request().
|
static |
Definition at line 68 of file chan_rtp.c.
Referenced by load_module(), unicast_rtp_request(), and unload_module().