149 #ifdef USE_DEPRECATED_G726
199 engine->
mod = module;
205 if (!strcmp(current_engine->
name, engine->
name)) {
217 ast_verb(2,
"Registered RTP engine '%s'\n", engine->
name);
229 ast_verb(2,
"Unregistered RTP engine '%s'\n", engine->
name);
234 return current_engine ? 0 : -1;
250 if (!strcasecmp(current_glue->
type, glue->
type)) {
273 ast_verb(2,
"Unregistered RTP glue '%s'\n", glue->
type);
278 return current_glue ? 0 : -1;
287 ast_debug(1,
"Engine '%s' failed to destroy RTP instance '%p'\n", instance->
engine->
name, instance);
291 if (instance->
srtp) {
298 ast_debug(1,
"Destroyed RTP instance '%p'\n", instance);
321 if (!strcmp(engine->
name, engine_name)) {
346 instance->
engine = engine;
350 ast_debug(1,
"Using engine '%s' for RTP instance '%p'\n", engine->
name, instance);
353 if (instance->
engine->
new(instance, sched, &address, data)) {
354 ast_debug(1,
"Engine '%s' failed to setup RTP instance '%p'\n", engine->
name, instance);
359 ast_debug(1,
"RTP instance '%p' is setup and ready to go\n", instance);
366 instance->
data = data;
371 return instance->
data;
381 return instance->
engine->
read(instance, rtcp);
506 if (static_RTP_PT[i].code) {
522 ast_debug(2,
"Copying payload %d from %p to %p\n", i, src, dest);
534 if (payload < 0 || payload >=
AST_RTP_MAX_PT || !static_RTP_PT[payload].code) {
541 ast_debug(1,
"Setting payload %d based on m type on %p\n", payload, codecs);
549 char *mimetype,
char *mimesubtype,
551 unsigned int sample_rate)
562 if (strcasecmp(mimesubtype, t->
subtype)) {
566 if (strcasecmp(mimetype, t->
type)) {
594 return (found ? 0 : -2);
608 ast_debug(2,
"Unsetting payload %d on %p\n", payload, codecs);
627 result.
code = codecs->payloads[payload].
code;
630 result = static_RTP_PT[payload];
640 *astformats = *nonastformats = 0;
644 ast_debug(1,
"Incorporating payload %d on %p\n", i, codecs);
665 if (static_RTP_PT[i].asterisk_format == asterisk_format && static_RTP_PT[i].code == code) {
712 ast_str_append(&buf, 0,
"0x%llx (", (
unsigned long long) capability);
714 for (format = 1; format <=
AST_RTP_MAX; format <<= 1) {
715 if (capability & format) {
798 if (!strcasecmp(glue->
type, type)) {
811 struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
813 struct timeval start;
817 ast_debug(1,
"Failed to locally bridge %s to %s, backing out.\n", c0->
name, c1->
name);
823 ast_debug(1,
"Failed to locally bridge %s to %s, backing out.\n", c1->
name, c0->
name);
835 instance0->
bridged = instance1;
836 instance1->
bridged = instance0;
849 ast_debug(1,
"rtp-engine-local-bridge: Oooh, formats changed, backing out\n");
859 ast_debug(1,
"rtp-engine-local-bridge: Oooh, something is weird, backing out\n");
877 ast_debug(2,
"rtp-engine-local-bridge: Ooh, empty read...\n");
885 other = (who == c0) ? c1 : c0;
893 ast_debug(1,
"rtp-engine-local-bridge: Ooh, got a %s\n", fr ?
"digit" :
"hangup");
920 instance0->
bridged = instance1;
921 instance1->
bridged = instance0;
987 struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
988 format_t oldcodec0 = codec0, oldcodec1 = codec1;
989 struct ast_sockaddr ac1 = {{0,}}, vac1 = {{0,}}, tac1 = {{0,}}, ac0 = {{0,}}, vac0 = {{0,}}, tac0 = {{0,}};
990 struct ast_sockaddr t1 = {{0,}}, vt1 = {{0,}}, tt1 = {{0,}}, t0 = {{0,}}, vt0 = {{0,}}, tt0 = {{0,}};
992 struct timeval start;
995 if (!(glue0->
update_peer(c0, instance1, vinstance1, tinstance1, codec1, 0))) {
1008 if (!(glue1->
update_peer(c1, instance0, vinstance0, tinstance0, codec0, 0))) {
1023 instance0->
bridged = instance1;
1024 instance1->
bridged = instance0;
1041 ast_debug(1,
"Oooh, something is weird, backing out\n");
1076 (codec1 != oldcodec1)) {
1077 ast_debug(1,
"Oooh, '%s' changed end address to %s (format %s)\n",
1080 ast_debug(1,
"Oooh, '%s' changed end vaddress to %s (format %s)\n",
1083 ast_debug(1,
"Oooh, '%s' changed end taddress to %s (format %s)\n",
1086 ast_debug(1,
"Oooh, '%s' was %s/(format %s)\n",
1089 ast_debug(1,
"Oooh, '%s' was %s/(format %s)\n",
1092 ast_debug(1,
"Oooh, '%s' was %s/(format %s)\n",
1110 (codec0 != oldcodec0)) {
1111 ast_debug(1,
"Oooh, '%s' changed end address to %s (format %s)\n",
1114 ast_debug(1,
"Oooh, '%s' was %s/(format %s)\n",
1117 if (glue1->
update_peer(c1, t0.len ? instance0 : NULL,
1118 vt0.len ? vinstance0 : NULL,
1119 tt0.len ? tinstance0 : NULL,
1143 other = (who == c0) ? c1 : c0;
1150 ast_debug(1,
"Oooh, got a %s\n", fr ?
"digit" :
"hangup");
1172 glue1->
update_peer(c1, instance0, vinstance0, tinstance0, codec0, 0);
1174 glue0->
update_peer(c0, instance1, vinstance1, tinstance1, codec1, 0);
1186 oldcodec0 = codec0 = glue0->
get_codec(c0);
1191 oldcodec1 = codec1 = glue1->
get_codec(c1);
1237 ast_debug(1,
"Channel '%s' Zombie cleardown from bridge\n", c0->
name);
1239 ast_debug(1,
"Channel c0->'%s' pvt changed, in bridge with c1->'%s'\n", c0->
name, c1->
name);
1241 ast_debug(1,
"Channel c0->'%s' technology changed, in bridge with c1->'%s'\n", c0->
name, c1->
name);
1242 }
else if (glue0->
update_peer(c0, NULL, NULL, NULL, 0, 0)) {
1246 ast_debug(1,
"Channel '%s' Zombie cleardown from bridge\n", c1->
name);
1248 ast_debug(1,
"Channel c1->'%s' pvt changed, in bridge with c0->'%s'\n", c1->
name, c0->
name);
1250 ast_debug(1,
"Channel c1->'%s' technology changed, in bridge with c0->'%s'\n", c1->
name, c0->
name);
1251 }
else if (glue1->
update_peer(c1, NULL, NULL, NULL, 0, 0)) {
1277 *vinstance0 = NULL, *vinstance1 = NULL,
1278 *tinstance0 = NULL, *tinstance1 = NULL;
1280 struct ast_sockaddr addr1 = { {0, }, }, addr2 = { {0, }, };
1286 int unlock_chans = 1;
1287 int read_ptime0, read_ptime1, write_ptime0, write_ptime1;
1305 ast_debug(1,
"Can't find native functions for channel '%s'\n", glue0 ? c1->
name : c0->
name);
1334 if (addr1.
ss.ss_family != addr2.ss.ss_family ||
1361 if (codec0 && codec1 && !(codec0 & codec1)) {
1372 if (read_ptime0 != write_ptime1 || read_ptime1 != write_ptime0) {
1373 ast_debug(1,
"Packetization differs between RTP streams (%d != %d or %d != %d). Cannot native bridge in RTP\n",
1374 read_ptime0, write_ptime1, read_ptime1, write_ptime0);
1379 instance0->
glue = glue0;
1380 instance1->glue = glue1;
1381 instance0->
chan = c0;
1382 instance1->chan = c1;
1391 tinstance0, tinstance1, glue0, glue1, codec0, codec1, timeoutms, flags,
1395 instance0->
glue = NULL;
1396 instance1->glue = NULL;
1397 instance0->
chan = NULL;
1398 instance1->chan = NULL;
1426 *vinstance_dst = NULL, *vinstance_src = NULL,
1427 *tinstance_dst = NULL, *tinstance_src = NULL;
1431 format_t codec_dst = 0, codec_src = 0;
1444 ast_debug(1,
"Can't find native functions for channel '%s'\n", glue_dst ? c_src->
name : c_dst->
name);
1448 audio_glue_dst_res = glue_dst->
get_rtp_info(c_dst, &instance_dst);
1451 audio_glue_src_res = glue_src->
get_rtp_info(c_src, &instance_src);
1474 if (!(codec_dst & codec_src)) {
1480 if (vinstance_dst && vinstance_src) {
1483 if (tinstance_dst && tinstance_src) {
1487 if (glue_dst->
update_peer(c_dst, instance_src, vinstance_src, tinstance_src, codec_src, 0)) {
1488 ast_log(
LOG_WARNING,
"Channel '%s' failed to setup early bridge to '%s'\n", c_dst->
name, c_src ? c_src->
name :
"<unspecified>");
1505 ast_debug(1,
"Seeded SDP of '%s' with that of '%s'\n", c_dst->
name, c_src ? c_src->
name :
"<unspecified>");
1512 *vinstance0 = NULL, *vinstance1 = NULL,
1513 *tinstance0 = NULL, *tinstance1 = NULL;
1565 if (!(codec0 & codec1)) {
1570 if (glue0->
update_peer(c0, instance1, vinstance1, tinstance1, codec1, 0)) {
1588 ast_debug(1,
"Setting early bridge SDP of '%s' with that of '%s'\n", c0->
name, c1 ? c1->
name :
"<unspecified>");
1634 snprintf(buf, size,
"ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f",
1637 snprintf(buf, size,
"minrxjitter=%f;maxrxjitter=%f;avgrxjitter=%f;stdevrxjitter=%f;reported_minjitter=%f;reported_maxjitter=%f;reported_avgjitter=%f;reported_stdevjitter=%f;",
1640 snprintf(buf, size,
"minrxlost=%f;maxrxlost=%f;avgrxlost=%f;stdevrxlost=%f;reported_minlost=%f;reported_maxlost=%f;reported_avglost=%f;reported_stdevlost=%f;",
1711 if (!peer_instance) {
1728 peer_instance = NULL;
1751 const char *username)
1795 return instance->
glue;
1800 return instance->
chan;
1805 if (res_srtp || res_srtp_policy) {
1808 if (!srtp_res || !policy_res) {
1821 res_srtp_policy = NULL;
1837 if (!instance->
srtp) {
1838 res = res_srtp->
create(&instance->
srtp, instance, remote_policy);
1840 res = res_srtp->
replace(&instance->
srtp, instance, remote_policy);
1851 return instance->
srtp;
struct ast_codec_pref pref
void ast_rtp_codecs_packetization_set(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs)
Set codec packetization preferences.
int(* qos)(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
struct ast_channel * ast_waitfor_n(struct ast_channel **chan, int n, int *ms)
Waits for input on a group of channels Wait for input on an array of channels for a given # of millis...
double local_normdevrxploss
union ast_frame_subclass subclass
int ast_rtp_instance_activate(struct ast_rtp_instance *instance)
Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance...
struct sockaddr_storage ss
enum ast_rtp_dtmf_mode(* dtmf_mode_get)(struct ast_rtp_instance *instance)
struct ast_channel * masqr
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
int(* activate)(struct ast_rtp_instance *instance)
int ast_rtp_red_init(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations)
Initialize RED support on an RTP instance.
struct ast_channel * masq
static void unref_instance_cond(struct ast_rtp_instance **instance)
Conditionally unref an rtp instance.
struct ast_srtp_policy_res * res_srtp_policy
Asterisk main include file. File version handling, generic pbx functions.
void(* stun_request)(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username)
void ast_poll_channel_add(struct ast_channel *chan0, struct ast_channel *chan1)
#define AST_BRIDGE_IGNORE_SIGS
Ignore all signal frames except NULL.
void ast_module_unref(struct ast_module *)
void * ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property)
Get the value of an RTP instance extended property.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
int(* set_write_format)(struct ast_rtp_instance *instance, format_t format)
int ast_rtp_instance_dtmf_mode_set(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode)
Set the DTMF mode that should be used.
#define AST_MAX_USER_FIELD
struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup(struct ast_rtp_codecs *codecs, int payload)
Retrieve payload information by payload.
void ast_rtp_instance_change_source(struct ast_rtp_instance *instance)
Indicate a new source of audio has dropped in and the ssrc should change.
int(* dtmf_end)(struct ast_rtp_instance *instance, char digit)
void(* stop)(struct ast_rtp_instance *instance)
int ast_rtp_instance_get_stats(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
Retrieve statistics about an RTP instance.
static struct formats formats
int(* red_buffer)(struct ast_rtp_instance *instance, struct ast_frame *frame)
double remote_normdevjitter
#define ast_test_flag(p, flag)
Support for translation of data formats. translate.c.
static void ast_sockaddr_copy(struct ast_sockaddr *dst, const struct ast_sockaddr *src)
Copies the data from one ast_sockaddr to another.
#define AST_FORMAT_G723_1
static struct ast_rtp_payload_type static_RTP_PT[AST_RTP_MAX_PT]
Mapping between Asterisk codecs and rtp payload types.
int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance)
Get the RTP timeout value.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module)
Register RTP glue.
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
int ast_framehook_list_is_empty(struct ast_framehook_list *framehooks)
Determine if an framehook list is empty or not.
struct ast_rtp_glue * ast_rtp_instance_get_active_glue(struct ast_rtp_instance *instance)
Get the RTP glue in use on an RTP instance.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
double remote_stdevjitter
int ast_rtp_instance_set_alt_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the address of an an alternate RTP address to receive from.
static void instance_destructor(void *obj)
int(* extended_prop_set)(struct ast_rtp_instance *instance, int property, void *value)
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
int(* new)(struct ast_rtp_instance *instance, struct sched_context *sched, struct ast_sockaddr *sa, void *data)
int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Early bridge two channels that use RTP instances.
int ast_rtp_instance_set_qos(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
Set QoS parameters on an RTP session.
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
#define AST_FORMAT_H263_PLUS
int(* write)(struct ast_rtp_instance *instance, struct ast_frame *frame)
struct ast_rtp_payload_type payloads[AST_RTP_MAX_PT]
void(* remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa)
int ast_indicate_data(struct ast_channel *chan, int condition, const void *data, size_t datalen)
Indicates condition of channel, with payload.
int(* destroy)(struct ast_rtp_instance *instance)
int(* dtmf_begin)(struct ast_rtp_instance *instance, char digit)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout)
Set the RTP timeout value.
int(* create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy)
int(* dtmf_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1)
int ast_rtp_instance_make_compatible(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_channel *peer)
Request that the underlying RTP engine make two RTP instances compatible with eachother.
int(* make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1)
int ast_rtp_instance_add_srtp_policy(struct ast_rtp_instance *instance, struct ast_srtp_policy *remote_policy, struct ast_srtp_policy *local_policy)
Add or replace the SRTP policies for the given RTP instance.
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame)
Run a connected line interception macro and update a channel's connected line information.
int(* get_stat)(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
int ast_sockaddr_cmp(const struct ast_sockaddr *a, const struct ast_sockaddr *b)
Compares two ast_sockaddr structures.
int(* sendcng)(struct ast_rtp_instance *instance, int level)
static struct ast_srtp_res srtp_res
struct ast_srtp * ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance)
Obtain the SRTP instance associated with an RTP instance.
Socket address structure.
#define ast_verb(level,...)
void ast_rtp_engine_unregister_srtp(void)
int(* dtmf_end_with_duration)(struct ast_rtp_instance *instance, char digit, unsigned int duration)
int(* update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, format_t codecs, int nat_active)
struct ast_frame *(* read)(struct ast_rtp_instance *instance, int rtcp)
void ast_rtp_instance_stun_request(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username)
Request that the underlying RTP engine send a STUN BIND request.
static int ast_sockaddr_isnull(const struct ast_sockaddr *addr)
Checks if the ast_sockaddr is null. "null" in this sense essentially means uninitialized, or having a 0 length.
void(* destroy)(struct ast_srtp *srtp)
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
struct ast_format_list ast_codec_pref_getsize(struct ast_codec_pref *pref, format_t format)
Get packet size for codec.
struct ast_rtp_payload_type payload_type
#define ast_debug(level,...)
Log a DEBUG message.
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
int(* replace)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy)
enum ast_rtp_glue_result(* get_vrtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance)
Callback for retrieving the RTP instance carrying video.
void(* payload_set)(struct ast_rtp_instance *instance, int payload, int astformat, format_t format)
General Asterisk PBX channel definitions.
int ast_rtp_engine_unregister(struct ast_rtp_engine *engine)
Unregister an RTP engine.
void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data)
Set the data portion of an RTP instance.
Maximum number of RTP properties supported.
#define AST_FORMAT_T140RED
static force_inline int attribute_pure ast_strlen_zero(const char *s)
struct ast_audiohook_list * audiohooks
Asterisk internal frame definitions.
#define AST_RWLIST_TRAVERSE
struct ast_rtp_glue * glue
int(* dtmf_mode_set)(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode)
#define AST_FORMAT_G726_AAL2
#define ao2_ref(o, delta)
int ast_rtp_instance_set_remote_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the address of the remote endpoint that we are sending RTP to.
#define AST_BRIDGE_DTMF_CHANNEL_1
Report DTMF on channel 1.
struct ast_channel * chan
struct ast_rtp_engine * ast_rtp_instance_get_engine(struct ast_rtp_instance *instance)
Get the RTP engine in use on an RTP instance.
double local_stdevrxploss
void(* packetization_set)(struct ast_rtp_instance *instance, struct ast_codec_pref *pref)
void ast_rtp_instance_set_extended_prop(struct ast_rtp_instance *instance, int property, void *value)
Set the value of an RTP instance extended property.
int(* add_stream)(struct ast_srtp *srtp, struct ast_srtp_policy *policy)
char * ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_rtp_instance_stat_field field, char *buf, size_t size)
Retrieve quality statistics about an RTP instance.
static struct ast_srtp_policy_res policy_res
int ast_rtp_codecs_payloads_set_rtpmap_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload, char *mimetype, char *mimesubtype, enum ast_rtp_options options)
Record payload information that was seen in an a=rtpmap: SDP line.
#define AST_FORMAT_SLINEAR16
format_t ast_translate_available_formats(format_t dest, format_t src)
Mask off unavailable formats from a format bitmask.
Core PBX routines and definitions.
double remote_normdevrxploss
int ast_check_hangup(struct ast_channel *chan)
Check to see if a channel is needing hang up.
int ast_rtp_instance_set_local_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the address that we are expecting to receive RTP on.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
int ast_rtp_engine_register_srtp(struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res)
int ast_rtp_instance_get_hold_timeout(struct ast_rtp_instance *instance)
Get the RTP timeout value for when an RTP instance is on hold.
char * ast_getformatname(format_t format)
Get the name of a format.
int(* local_bridge)(struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1)
#define AST_FORMAT_SIREN7
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
int ast_rtp_instance_sendcng(struct ast_rtp_instance *instance, int level)
Send a comfort noise packet to the RTP instance.
static struct ast_codec_pref prefs
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
int(* red_init)(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations)
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, format_t code)
Get the sample rate associated with known RTP payload types.
void(* prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
struct ast_framehook_list * framehooks
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
Begin sending a DTMF digit.
static char * ast_sockaddr_stringify(const struct ast_sockaddr *addr)
Wrapper around ast_sockaddr_stringify_fmt() with default format.
const ast_string_field name
void(* change_source)(struct ast_rtp_instance *instance)
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
#define ao2_alloc(data_size, destructor_fn)
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, format_t format)
Request that the underlying RTP engine provide audio frames in a specific format. ...
int(* set_read_format)(struct ast_rtp_instance *instance, format_t format)
struct ast_bridge * bridge
int properties[AST_RTP_PROPERTY_MAX]
struct ast_channel * ast_rtp_instance_get_chan(struct ast_rtp_instance *instance)
Get the channel that is associated with an RTP instance while in a bridge.
#define ast_channel_unlock(chan)
#define AST_RTP_CISCO_DTMF
void * ast_rtp_instance_get_data(struct ast_rtp_instance *instance)
Get the data portion of an RTP instance.
struct ast_srtp_res * res_srtp
void ast_rtp_instance_get_remote_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the address of the remote endpoint that we are sending RTP to.
#define AST_FORMAT_SIREN14
void ast_rtp_instance_set_hold_timeout(struct ast_rtp_instance *instance, int timeout)
Set the RTP timeout value for when the instance is on hold.
int ast_write(struct ast_channel *chan, struct ast_frame *frame)
Write a frame to a channel This function writes the given frame to the indicated channel.
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
static format_t capability
int ast_sockaddr_is_ipv4_mapped(const struct ast_sockaddr *addr)
Determine if this is an IPv4-mapped IPv6 address.
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
struct ast_sockaddr local_address
const char * ast_rtp_lookup_mime_subtype2(const int asterisk_format, const format_t code, enum ast_rtp_options options)
Retrieve mime subtype information on a payload.
void(* update_source)(struct ast_rtp_instance *instance)
void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance)
Clear payload information from an RTP instance.
void ast_rtp_instance_get_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the local address that we are expecting RTP on.
int ast_rtp_instance_destroy(struct ast_rtp_instance *instance)
Destroy an RTP instance.
void ast_rtp_instance_set_keepalive(struct ast_rtp_instance *instance, int timeout)
Set the RTP keepalive interval.
struct ast_rtp_instance * bridged
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
void ast_rtp_codecs_payloads_copy(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
Copy payload information from one RTP instance to another.
struct ast_sockaddr remote_address
#define AST_RWLIST_INSERT_TAIL
void ast_poll_channel_del(struct ast_channel *chan0, struct ast_channel *chan1)
ast_rtp_instance_stat_field
static struct ast_rtp_mime_type ast_rtp_mime_types[]
int(* fd)(struct ast_rtp_instance *instance, int rtcp)
format_t ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk)
Request the formats that can be transcoded.
format_t(* get_codec)(struct ast_channel *chan)
#define AST_FORMAT_SLINEAR
static enum ast_bridge_result remote_bridge_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1, struct ast_rtp_instance *vinstance0, struct ast_rtp_instance *vinstance1, struct ast_rtp_instance *tinstance0, struct ast_rtp_instance *tinstance1, struct ast_rtp_glue *glue0, struct ast_rtp_glue *glue1, format_t codec0, format_t codec1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
void *(* extended_prop_get)(struct ast_rtp_instance *instance, int property)
int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame)
Buffer a frame in an RTP instance for RED.
void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
Remove payload information.
struct ast_rtp_instance * ast_rtp_instance_get_bridged(struct ast_rtp_instance *instance)
Get the other RTP instance that an instance is bridged to.
int ast_rtp_engine_srtp_is_registered(void)
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property)
Get the value of an RTP instance property.
format_t(* available_formats)(struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk)
int ast_rtp_codecs_payloads_set_rtpmap_type_rate(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int pt, char *mimetype, char *mimesubtype, enum ast_rtp_options options, unsigned int sample_rate)
Set payload type to a known MIME media type for a codec with a specific sample rate.
enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get(struct ast_rtp_instance *instance)
Get the DTMF mode of an RTP instance.
void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance)
Set standard statistics from an RTP instance on a channel.
Data structure associated with a single frame of data.
int ast_rtp_instance_get_keepalive(struct ast_rtp_instance *instance)
Get the RTP keepalive interval.
double remote_stdevrxploss
int ast_rtp_instance_get_and_cmp_local_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the address of the local endpoint that we are sending RTP to, comparing its address to another...
struct ast_rtp_engine * engine
Options provided by main asterisk program.
#define AST_RWLIST_REMOVE
void ast_rtp_instance_set_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
Set the value of an RTP instance property.
int ast_rtp_instance_get_and_cmp_remote_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the address of the remote endpoint that we are sending RTP to, comparing its address to another...
static enum ast_bridge_result local_bridge_loop(struct ast_channel *c0, struct ast_channel *c1, struct ast_rtp_instance *instance0, struct ast_rtp_instance *instance1, int timeoutms, int flags, struct ast_frame **fo, struct ast_channel **rc, void *pvt0, void *pvt1)
enum ast_frame_type frametype
struct ast_sockaddr alt_remote_address
#define ast_channel_trylock(chan)
void(* alt_remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa)
double local_normdevjitter
int ast_rtp_instance_dtmf_end_with_duration(struct ast_rtp_instance *instance, char digit, unsigned int duration)
struct ast_channel_monitor * monitor
#define AST_FORMAT_MP4_VIDEO
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, format_t format)
Tell underlying RTP engine that audio frames will be provided in a specific format.
struct ast_rtp_glue * ast_rtp_instance_get_glue(const char *type)
Get the RTP glue that binds a channel to the RTP engine.
void ast_rtp_instance_early_bridge_make_compatible(struct ast_channel *c_dst, struct ast_channel *c_src)
Make two channels compatible for early bridging.
Pluggable RTP Architecture.
char * ast_rtp_lookup_mime_multiple2(struct ast_str *buf, const format_t capability, const int asterisk_format, enum ast_rtp_options options)
Convert formats into a string and put them into a buffer.
void ast_rtp_instance_update_source(struct ast_rtp_instance *instance)
Indicate that the RTP marker bit should be set on an RTP stream.
Asterisk module definitions.
static snd_pcm_format_t format
union ast_frame::@172 data
struct ast_channel_tech * tech
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code)
Retrieve a payload based on whether it is an Asterisk format and the code.
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
Record payload information that was seen in an m= SDP line.
void ast_rtp_codecs_payloads_default(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance)
Set payload information on an RTP instance to the default.
int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module)
Register an RTP engine.
#define AST_BRIDGE_DTMF_CHANNEL_0
Report DTMF on channel 0.
struct ast_rtp_codecs codecs
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats)
Retrieve all formats that were found.
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
#define ASTERISK_FILE_VERSION(file, version)
Register/unregister a source code file with the core.
int ast_channel_redirecting_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *redirecting_info, int is_caller, int is_frame)
Run a redirecting interception macro and update a channel's redirecting information.
enum ast_bridge_result ast_rtp_instance_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms)
Bridge two channels that use RTP instances.
#define AST_FORMAT_SPEEX16
enum ast_rtp_glue_result(* get_rtp_info)(struct ast_channel *chan, struct ast_rtp_instance **instance)
Callback for retrieving the RTP instance carrying audio.
struct ast_module * ast_module_ref(struct ast_module *)
int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit)
Stop sending a DTMF digit.