Asterisk - The Open Source Telephony Project
21.4.1
|
Multicast RTP Engine. More...
#include "asterisk.h"
#include <sys/time.h>
#include <signal.h>
#include <fcntl.h>
#include <math.h>
#include "asterisk/pbx.h"
#include "asterisk/frame.h"
#include "asterisk/channel.h"
#include "asterisk/acl.h"
#include "asterisk/config.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/cli.h"
#include "asterisk/manager.h"
#include "asterisk/unaligned.h"
#include "asterisk/module.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/format_cache.h"
#include "asterisk/multicast_rtp.h"
#include "asterisk/app.h"
#include "asterisk/smoother.h"
Go to the source code of this file.
Data Structures | |
struct | ast_multicast_rtp_options |
struct | multicast_control_packet |
Structure for a Linksys control packet. More... | |
struct | multicast_rtp |
Structure for a multicast paging instance. More... | |
Macros | |
#define | LINKSYS_MCAST_STARTCMD 6 |
#define | LINKSYS_MCAST_STOPCMD 7 |
#define | MAX_TIMESTAMP_SKEW 640 |
Enumerations | |
enum | { OPT_CODEC = (1 << 0), OPT_LOOP = (1 << 1), OPT_TTL = (1 << 2), OPT_IF = (1 << 3) } |
enum | { OPT_ARG_CODEC = 0, OPT_ARG_LOOP, OPT_ARG_TTL, OPT_ARG_IF, OPT_ARG_ARRAY_SIZE } |
enum | multicast_type { MULTICAST_TYPE_UNSPECIFIED = 0, MULTICAST_TYPE_BASIC, MULTICAST_TYPE_LINKSYS } |
Type of paging to do. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
struct ast_multicast_rtp_options * | ast_multicast_rtp_create_options (const char *type, const char *options) |
Create multicast RTP options. More... | |
void | ast_multicast_rtp_free_options (struct ast_multicast_rtp_options *mcast_options) |
Free multicast RTP options. More... | |
struct ast_format * | ast_multicast_rtp_options_get_format (struct ast_multicast_rtp_options *mcast_options) |
Get format specified in multicast options. More... | |
static unsigned int | calc_txstamp (struct multicast_rtp *rtp, struct timeval *delivery) |
static int | load_module (void) |
static int | multicast_rtp_activate (struct ast_rtp_instance *instance) |
Function called to indicate that audio is now going to flow. | |
static int | multicast_rtp_destroy (struct ast_rtp_instance *instance) |
Function called to destroy a multicast instance. | |
static int | multicast_rtp_new (struct ast_rtp_instance *instance, struct ast_sched_context *sched, struct ast_sockaddr *addr, void *data) |
Function called to create a new multicast instance. | |
static struct ast_frame * | multicast_rtp_read (struct ast_rtp_instance *instance, int rtcp) |
Function called to read from a multicast instance. | |
static int | multicast_rtp_write (struct ast_rtp_instance *instance, struct ast_frame *frame) |
Function called to broadcast some audio on a multicast instance. | |
static int | multicast_send_control_packet (struct ast_rtp_instance *instance, struct multicast_rtp *multicast, int command) |
Helper function which populates a control packet with useful information and sends it. | |
static int | rtp_get_rate (struct ast_format *format) |
static int | rtp_raw_write (struct ast_rtp_instance *instance, struct ast_frame *frame, int codec) |
static void | set_if (int sock, const char *if_str) |
static void | set_loop (int sock, const char *loop_str) |
static void | set_ttl (int sock, const char *ttl_str) |
static int | set_type (struct multicast_rtp *multicast, const char *type) |
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 = "Multicast RTP Engine" , .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_DEPEND, } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_rtp_engine | multicast_rtp_engine |
static const struct ast_app_option | multicast_rtp_options [128] = { [ 'c' ] = { .flag = OPT_CODEC , .arg_index = OPT_ARG_CODEC + 1 }, [ 'l' ] = { .flag = OPT_LOOP , .arg_index = OPT_ARG_LOOP + 1 }, [ 't' ] = { .flag = OPT_TTL , .arg_index = OPT_ARG_TTL + 1 }, [ 'i' ] = { .flag = OPT_IF , .arg_index = OPT_ARG_IF + 1 }, } |
Multicast RTP Engine.
Definition in file res_rtp_multicast.c.
#define LINKSYS_MCAST_STARTCMD 6 |
Command value used for Linksys paging to indicate we are starting
Definition at line 60 of file res_rtp_multicast.c.
Referenced by multicast_rtp_activate().
#define LINKSYS_MCAST_STOPCMD 7 |
Command value used for Linksys paging to indicate we are stopping
Definition at line 63 of file res_rtp_multicast.c.
Referenced by multicast_rtp_destroy().
enum multicast_type |
Type of paging to do.
Definition at line 66 of file res_rtp_multicast.c.
struct ast_multicast_rtp_options* ast_multicast_rtp_create_options | ( | const char * | type, |
const char * | options | ||
) |
Create multicast RTP options.
These are passed to the multicast RTP engine on its creation.
type | The type of multicast RTP, either "basic" or "linksys" |
options | Miscellaneous options |
NULL | Failure |
non-NULL | success |
Definition at line 140 of file res_rtp_multicast.c.
References ast_app_parse_options(), ast_calloc, ast_multicast_rtp_free_options(), ast_multicast_rtp_options::buf, and S_OR.
Referenced by multicast_rtp_request().
void ast_multicast_rtp_free_options | ( | struct ast_multicast_rtp_options * | mcast_options | ) |
Free multicast RTP options.
This function is NULL-tolerant
mcast_options | Options to free |
Definition at line 175 of file res_rtp_multicast.c.
Referenced by ast_multicast_rtp_create_options(), and multicast_rtp_request().
struct ast_format* ast_multicast_rtp_options_get_format | ( | struct ast_multicast_rtp_options * | mcast_options | ) |
Get format specified in multicast options.
Multicast options allow for a format to be selected. This function accesses the selected format and creates an ast_format structure for it.
mcast_options | The options where a codec was specified |
NULL | No format specified in the options |
non-NULL | The format to use for communication |
Definition at line 180 of file res_rtp_multicast.c.
References ast_format_cache_get.
Referenced by multicast_rtp_request().