147 #include <sys/time.h>
169 #include "asterisk/stasis_channels.h"
246 #define MAX_RTP_MIME_TYPES 128
259 } ast_rtp_mime_types[128];
261 static int mime_types_len = 0;
287 #define SET_AST_JSON_OBJ(target, name, obj) ({ \
288 struct ast_json *j_tmp = obj; \
290 ast_json_object_set(target, name, j_tmp); \
298 static void rtp_payload_type_dtor(
void *obj)
302 ao2_cleanup(payload->
format);
327 return rtp_payload_type_alloc(NULL, 0, 0, 0, 0);
336 ast_log(LOG_WARNING,
"RTP Engine '%s' failed sanity check so it was not registered.\n", !ast_strlen_zero(engine->
name) ? engine->
name :
"Unknown");
341 engine->
mod = module;
347 if (!strcmp(current_engine->
name, engine->
name)) {
348 ast_log(LOG_WARNING,
"An RTP engine with the name '%s' has already been registered.\n", engine->
name);
359 ast_verb(5,
"Registered RTP engine '%s'\n", engine->
name);
370 if ((current_engine = AST_RWLIST_REMOVE(&
engines, engine,
entry))) {
371 ast_verb(5,
"Unregistered RTP engine '%s'\n", engine->
name);
376 return current_engine ? 0 : -1;
383 if (ast_strlen_zero(glue->
type)) {
391 AST_RWLIST_TRAVERSE(&
glues, current_glue,
entry) {
392 if (!strcasecmp(current_glue->
type, glue->
type)) {
393 ast_log(LOG_WARNING,
"RTP glue with the name '%s' has already been registered.\n", glue->
type);
403 ast_verb(5,
"Registered RTP glue '%s'\n", glue->
type);
414 if ((current_glue = AST_RWLIST_REMOVE(&
glues, glue,
entry))) {
415 ast_verb(5,
"Unregistered RTP glue '%s'\n", glue->
type);
420 return current_glue ? 0 : -1;
423 static void instance_destructor(
void *obj)
428 if (instance->
data) {
435 ao2_unlock(instance);
438 if (instance->
srtp) {
455 ast_debug(1,
"Destroyed RTP instance '%p'\n", instance);
463 if (ast_debug_rtp_is_allowed) {
472 buffer[0],
sizeof(buffer[0])),
474 buffer[1],
sizeof(buffer[1])),
476 buffer[2],
sizeof(buffer[2])),
478 buffer[3],
sizeof(buffer[3]))
482 ao2_cleanup(instance);
499 if (!ast_strlen_zero(engine_name)) {
501 if (!strcmp(engine->
name, engine_name)) {
506 engine = AST_RWLIST_FIRST(&
engines);
511 ast_log(LOG_ERROR,
"No RTP engine was found. Do you have one loaded?\n");
527 if (!(instance = ao2_alloc(
sizeof(*instance), instance_destructor))) {
548 ast_debug(1,
"Using engine '%s' for RTP instance '%p'\n", engine->
name, instance);
557 if (instance->
engine->
new(instance, sched, &address, data)) {
558 ast_debug(1,
"Engine '%s' failed to setup RTP instance '%p'\n", engine->
name, instance);
559 ao2_unlock(instance);
563 ao2_unlock(instance);
565 ast_debug(1,
"RTP instance '%p' is setup and ready to go\n", instance);
587 return instance->
data;
596 ao2_unlock(instance);
605 frame = instance->
engine->
read(instance, rtcp);
606 ao2_unlock(instance);
615 ao2_unlock(instance);
619 static void rtp_instance_set_incoming_source_address_nolock(
struct ast_rtp_instance *instance,
632 rtp_instance_set_incoming_source_address_nolock(instance, address);
633 ao2_unlock(instance);
644 rtp_instance_set_incoming_source_address_nolock(instance, address);
646 ao2_unlock(instance);
657 ao2_unlock(instance);
660 ao2_unlock(instance);
670 ao2_unlock(instance);
679 ao2_unlock(instance);
682 ao2_unlock(instance);
692 ao2_unlock(instance);
700 ao2_unlock(instance);
708 ao2_unlock(instance);
719 ao2_unlock(instance);
735 ao2_unlock(instance);
744 ao2_unlock(instance);
765 ao2_unlock(instance);
771 ao2_unlock(instance);
783 ao2_unlock(instance);
791 ao2_unlock(instance);
802 ao2_unlock(instance);
806 ao2_unlock(instance);
841 const char *uri,
const char *attributes)
879 ao2_unlock(instance);
886 static const struct rtp_extmap extmap_none = {
905 ao2_unlock(instance);
916 ao2_unlock(instance);
927 ao2_unlock(instance);
947 ao2_unlock(instance);
963 ao2_unlock(instance);
1003 ao2_t_cleanup(type,
"destroying ast_rtp_codec rx mapping");
1009 ao2_t_cleanup(type,
"destroying ast_rtp_codec tx mapping");
1013 ao2_t_cleanup(codecs->
preferred_format,
"destroying ast_rtp_codec preferred format");
1030 ao2_unlock(instance);
1079 *new_type = *current;
1105 "cleaning up rx mapping vector element about to be replaced");
1113 payload_mapping_rx_clear_primary(codecs, new_type);
1129 rtp_codecs_payload_set_rx(codecs, payload, new_type, 1);
1156 ast_debug(2,
"Copying rx payload mapping %d (%p) from %p to %p\n",
1157 idx, type, src, dest);
1158 rtp_codecs_payload_replace_rx(dest, idx, type);
1163 ao2_unlock(instance);
1192 if (current == to_match) {
1242 ast_debug(2,
"Copying tx payload mapping %d (%p) from %p to %p\n",
1243 idx, type, src, dest);
1247 "cleaning up tx mapping vector element about to be replaced");
1257 ao2_unlock(instance);
1283 ao2_t_cleanup(type,
"destroying ast_rtp_codec tx mapping");
1287 rtp_codecs_payloads_copy_rx(src, dest, instance);
1288 rtp_codecs_payloads_copy_tx(src, dest, instance);
1321 ast_debug(2,
"Crossover copying tx to rx payload mapping %d (%p) from %p to %p\n",
1322 idx, type, src, dest);
1323 rtp_codecs_payload_replace_rx(dest, idx, type);
1328 ao2_unlock(instance);
1349 ast_rwlock_rdlock(&static_RTP_PT_lock);
1350 new_type =
ao2_bump(static_RTP_PT[payload]);
1351 ast_rwlock_unlock(&static_RTP_PT_lock);
1353 ast_debug(1,
"Don't have a default tx payload type %d format for m type on %p\n",
1358 ast_debug(1,
"Setting tx payload type %d based on m type on %p\n",
1363 if (!payload_mapping_tx_is_present(codecs, new_type)) {
1366 "cleaning up replaced tx payload type");
1374 ao2_unlock(instance);
1384 char *mimetype,
char *mimesubtype,
1386 unsigned int sample_rate)
1395 ast_rwlock_rdlock(&mime_types_lock);
1398 for (idx = 0; idx < mime_types_len; ++idx) {
1402 if (strcasecmp(mimesubtype, t->
subtype)) {
1406 if (strcasecmp(mimetype, t->
type)) {
1443 if (!payload_mapping_tx_is_present(codecs, new_type)) {
1446 "cleaning up replaced tx payload type");
1454 ao2_unlock(instance);
1464 ast_rwlock_unlock(&mime_types_lock);
1466 return (found ? 0 : -2);
1482 ast_debug(2,
"Unsetting payload %d on %p\n", payload, codecs);
1508 ao2_unlock(instance);
1549 ast_rwlock_rdlock(&static_RTP_PT_lock);
1550 type =
ao2_bump(static_RTP_PT[payload]);
1551 ast_rwlock_unlock(&static_RTP_PT_lock);
1593 if (!payload_mapping_tx_is_present(codecs, type)) {
1642 unsigned int framing;
1700 if (!asterisk_format) {
1702 if (static_RTP_PT[idx]
1703 && !static_RTP_PT[idx]->asterisk_format
1704 && static_RTP_PT[idx]->rtp_code == code) {
1709 }
else if (format) {
1711 if (static_RTP_PT[idx]
1712 && static_RTP_PT[idx]->asterisk_format
1738 static int find_unused_payload_in_range(
const struct ast_rtp_codecs *codecs,
1743 for (x = start; x < end; ++x) {
1772 static int find_unused_payload(
const struct ast_rtp_codecs *codecs)
1777 res = find_unused_payload_in_range(
1783 if (ast_option_rtpusedynamic) {
1791 ignore[101] = static_RTP_PT[101];
1792 ignore[121] = static_RTP_PT[121];
1794 res = find_unused_payload_in_range(
1810 res = find_unused_payload_in_range(
1825 res = find_unused_payload_in_range(
1826 codecs, MAX(ast_option_rtpptdynamic, 20),
1832 return find_unused_payload_in_range(
1833 codecs, MAX(ast_option_rtpptdynamic, 0),
1849 static int rtp_codecs_find_non_primary_dynamic_rx(
struct ast_rtp_codecs *codecs)
1852 struct timeval oldest;
1886 static int rtp_codecs_assign_payload_code_rx(
struct ast_rtp_codecs *codecs,
int asterisk_format,
struct ast_format *format,
int code,
int explicit,
unsigned int sample_rate)
1888 int payload = code, i;
1893 payload = find_static_payload_type(asterisk_format, format, code);
1895 if (payload < 0 && (!asterisk_format || !ast_option_rtpusedynamic)) {
1900 new_type = rtp_payload_type_alloc(format, payload, code, 1, sample_rate);
1910 ignore[i] = static_RTP_PT[i];
1923 rtp_codecs_payload_replace_rx(codecs, payload, new_type);
1924 }
else if (payload > -1 && !
explicit
1932 && (-1 < (payload = find_unused_payload_in_range(codecs, payload, AST_RTP_MAX_PT, ignore)))) {
1945 rtp_codecs_payload_set_rx(codecs, payload, new_type, 0);
1946 }
else if (!
explicit && (-1 < (payload = find_unused_payload(codecs))
1947 || -1 < (payload = rtp_codecs_find_non_primary_dynamic_rx(codecs)))) {
1954 rtp_codecs_payload_replace_rx(codecs, payload, new_type);
1955 }
else if (
explicit) {
1967 ast_log(LOG_WARNING,
"No dynamic RTP payload type values available "
1988 ast_rwlock_rdlock(&static_RTP_PT_lock);
1989 if (!asterisk_format) {
2000 && (sample_rate == 0 || type->
sample_rate == sample_rate)) {
2006 }
else if (format) {
2025 payload = rtp_codecs_assign_payload_code_rx(codecs, asterisk_format, format,
2026 code, 0, sample_rate);
2028 ast_rwlock_unlock(&static_RTP_PT_lock);
2035 return rtp_codecs_assign_payload_code_rx(codecs, 1, format, code, 1, 0);
2040 return rtp_codecs_assign_payload_code_rx(codecs, 1, format, code, 0, sample_rate);
2049 if (!asterisk_format) {
2062 && (sample_rate == 0 || type->
sample_rate == sample_rate)) {
2068 }
else if (format) {
2086 ast_rwlock_rdlock(&static_RTP_PT_lock);
2087 payload = find_static_payload_type(asterisk_format, format, code);
2088 ast_rwlock_unlock(&static_RTP_PT_lock);
2120 const char *res =
"";
2122 ast_rwlock_rdlock(&mime_types_lock);
2123 for (i = 0; i < mime_types_len; i++) {
2124 if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format &&
2131 res = ast_rtp_mime_types[i].
subtype;
2134 }
else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format &&
2137 res = ast_rtp_mime_types[i].
subtype;
2141 ast_rwlock_unlock(&mime_types_lock);
2150 unsigned int res = 0;
2152 ast_rwlock_rdlock(&mime_types_lock);
2153 for (i = 0; i < mime_types_len; ++i) {
2154 if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format &&
2158 }
else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format &&
2164 ast_rwlock_unlock(&mime_types_lock);
2178 if (asterisk_format) {
2190 ast_str_append(&buf, 0,
"0x%x (", (
unsigned int) rtp_capability);
2192 if (rtp_capability & x) {
2212 ao2_unlock(instance);
2226 ao2_unlock(instance);
2233 int ast_rtp_instance_dtmf_end_with_duration(
struct ast_rtp_instance *instance,
char digit,
unsigned int duration)
2237 if (instance->
engine->dtmf_end_with_duration) {
2239 res = instance->
engine->dtmf_end_with_duration(instance, digit, duration);
2240 ao2_unlock(instance);
2254 ao2_unlock(instance);
2268 ao2_unlock(instance);
2280 ao2_unlock(instance);
2289 ao2_unlock(instance);
2299 res = instance->
engine->
qos(instance, tos, cos, desc);
2300 ao2_unlock(instance);
2312 ao2_unlock(instance);
2322 res = instance->
engine->
fd(instance, rtcp);
2323 ao2_unlock(instance);
2337 if (!strcasecmp(glue->
type, type)) {
2364 ao2_unlock(instance);
2372 ao2_unlock(instance);
2378 *vinstance_dst = NULL, *vinstance_src = NULL,
2379 *tinstance_dst = NULL, *tinstance_src = NULL;
2389 if (!cap_src || !cap_dst) {
2395 ast_debug(1,
"Can't find native functions for channel '%s'\n", glue_dst ? ast_channel_name(c_src) : ast_channel_name(c_dst));
2399 audio_glue_dst_res = glue_dst->
get_rtp_info(c_dst, &instance_dst);
2402 audio_glue_src_res = glue_src->
get_rtp_info(c_src, &instance_src);
2431 if (vinstance_dst && vinstance_src) {
2434 if (tinstance_dst && tinstance_src) {
2438 if (glue_dst->
update_peer(c_dst, instance_src, vinstance_src, tinstance_src, cap_src, 0)) {
2439 ast_log(LOG_WARNING,
"Channel '%s' failed to setup early bridge to '%s'\n",
2440 ast_channel_name(c_dst), ast_channel_name(c_src));
2442 ast_debug(1,
"Seeded SDP of '%s' with that of '%s'\n",
2443 ast_channel_name(c_dst), ast_channel_name(c_src));
2447 ast_channel_unlock(c_dst);
2448 ast_channel_unlock(c_src);
2450 ao2_cleanup(cap_dst);
2451 ao2_cleanup(cap_src);
2464 *vinstance0 = NULL, *vinstance1 = NULL,
2465 *tinstance0 = NULL, *tinstance1 = NULL;
2473 if (!c1 || !cap1 || !cap0) {
2484 ast_log(LOG_WARNING,
"Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0));
2519 if (glue0->
update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) {
2520 ast_log(LOG_WARNING,
"Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) :
"<unspecified>");
2524 ast_channel_unlock(c0);
2525 ast_channel_unlock(c1);
2537 ast_debug(1,
"Setting early bridge SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) :
"<unspecified>");
2548 res = instance->
engine->
red_init(instance, buffer_time, payloads, generations);
2549 ao2_unlock(instance);
2563 ao2_unlock(instance);
2574 if (!instance || !instance->
engine || !stats) {
2581 ao2_unlock(instance);
2615 snprintf(buf, size,
"ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;"
2616 "txjitter=%f;txcount=%u;rlp=%u;rtt=%f;rxmes=%f;txmes=%f",
2621 snprintf(buf, size,
"minrxjitter=%010.6f;maxrxjitter=%010.6f;avgrxjitter=%010.6f;stdevrxjitter=%010.6f;mintxjitter=%010.6f;maxtxjitter=%010.6f;avgtxjitter=%010.6f;stdevtxjitter=%010.6f;",
2624 snprintf(buf, size,
" minrxlost=%010.6f; maxrxlost=%010.6f; avgrxlost=%010.6f; stdevrxlost=%010.6f; mintxlost=%010.6f; maxtxlost=%010.6f; avgtxlost=%010.6f; stdevtxlost=%010.6f;",
2627 snprintf(buf, size,
" minrtt=%010.6f; maxrtt=%010.6f; avgrtt=%010.6f; stdevrtt=%010.6f;", stats.
minrtt, stats.
maxrtt, stats.
normdevrtt, stats.
stdevrtt);
2629 snprintf(buf, size,
" minrxmes=%010.6f; maxrxmes=%010.6f; avgrxmes=%010.6f; stdevrxmes=%010.6f; mintxmes=%010.6f; maxtxmes=%010.6f; avgtxmes=%010.6f; stdevtxmes=%010.6f;",
2650 ast_channel_lock(chan);
2655 quality_buf,
sizeof(quality_buf));
2700 ast_channel_unlock(chan);
2703 ast_channel_unlock(bridge);
2715 ao2_unlock(instance);
2729 ao2_unlock(instance);
2747 ast_channel_lock(peer);
2750 ast_channel_unlock(peer);
2755 if (!peer_instance) {
2756 ast_log(LOG_ERROR,
"Unable to get_rtp_info for peer type %s\n", glue->
type);
2757 ast_channel_unlock(peer);
2761 ast_log(LOG_ERROR,
"Peer engine mismatch for type %s\n", glue->
type);
2762 ast_channel_unlock(peer);
2773 ast_channel_unlock(peer);
2776 peer_instance = NULL;
2786 ao2_unlock(instance);
2802 ao2_unlock(instance);
2811 const char *username)
2855 return instance->
glue;
2860 if (res_srtp || res_srtp_policy) {
2863 if (!srtp_res || !policy_res) {
2867 res_srtp = srtp_res;
2868 res_srtp_policy = policy_res;
2873 void ast_rtp_engine_unregister_srtp(
void)
2876 res_srtp_policy = NULL;
2879 int ast_rtp_engine_srtp_is_registered(
void)
2881 return res_srtp && res_srtp_policy;
2898 res = res_srtp->
create(srtp, instance, remote_policy);
2899 }
else if (remote_policy) {
2900 res = res_srtp->replace(srtp, instance, remote_policy);
2903 res = res_srtp->add_stream(*srtp, local_policy);
2906 ao2_unlock(instance);
2916 return instance->
srtp;
2927 ao2_unlock(instance);
2934 static void rtp_ice_wrap_set_authentication(
struct ast_rtp_instance *instance,
const char *ufrag,
const char *password)
2938 ao2_unlock(instance);
2945 ao2_unlock(instance);
2952 ao2_unlock(instance);
2959 ao2_unlock(instance);
2962 static const char *rtp_ice_wrap_get_ufrag(
struct ast_rtp_instance *instance)
2968 ao2_unlock(instance);
2972 static const char *rtp_ice_wrap_get_password(
struct ast_rtp_instance *instance)
2974 const char *password;
2978 ao2_unlock(instance);
2988 ao2_unlock(instance);
2989 return local_candidates;
2996 ao2_unlock(instance);
3004 ao2_unlock(instance);
3009 const char *server,
unsigned int port,
const char *username,
const char *password)
3013 username, password);
3014 ao2_unlock(instance);
3017 static void rtp_ice_wrap_change_components(
struct ast_rtp_instance *instance,
3022 ao2_unlock(instance);
3027 .add_remote_candidate = rtp_ice_wrap_add_remote_candidate,
3028 .start = rtp_ice_wrap_start,
3029 .stop = rtp_ice_wrap_stop,
3030 .get_ufrag = rtp_ice_wrap_get_ufrag,
3031 .get_password = rtp_ice_wrap_get_password,
3032 .get_local_candidates = rtp_ice_wrap_get_local_candidates,
3033 .ice_lite = rtp_ice_wrap_ice_lite,
3034 .set_role = rtp_ice_wrap_set_role,
3035 .turn_request = rtp_ice_wrap_turn_request,
3036 .change_components = rtp_ice_wrap_change_components,
3042 return &rtp_ice_wrappers;
3048 #ifdef TEST_FRAMEWORK
3049 struct ast_rtp_engine_test *ast_rtp_instance_get_test(
struct ast_rtp_instance *instance)
3051 return instance->
engine->test;
3055 static int rtp_dtls_wrap_set_configuration(
struct ast_rtp_instance *instance,
3058 int set_configuration;
3062 ao2_unlock(instance);
3063 return set_configuration;
3072 ao2_unlock(instance);
3080 ao2_unlock(instance);
3087 ao2_unlock(instance);
3096 ao2_unlock(instance);
3097 return get_connection;
3106 ao2_unlock(instance);
3115 ao2_unlock(instance);
3118 static void rtp_dtls_wrap_set_fingerprint(
struct ast_rtp_instance *instance,
3123 ao2_unlock(instance);
3132 ao2_unlock(instance);
3133 return get_fingerprint_hash;
3136 static const char *rtp_dtls_wrap_get_fingerprint(
struct ast_rtp_instance *instance)
3138 const char *get_fingerprint;
3142 ao2_unlock(instance);
3143 return get_fingerprint;
3148 .active = rtp_dtls_wrap_active,
3149 .stop = rtp_dtls_wrap_stop,
3150 .reset = rtp_dtls_wrap_reset,
3151 .get_connection = rtp_dtls_wrap_get_connection,
3152 .get_setup = rtp_dtls_wrap_get_setup,
3153 .set_setup = rtp_dtls_wrap_set_setup,
3154 .set_fingerprint = rtp_dtls_wrap_set_fingerprint,
3155 .get_fingerprint_hash = rtp_dtls_wrap_get_fingerprint_hash,
3156 .get_fingerprint = rtp_dtls_wrap_get_fingerprint,
3162 return &rtp_dtls_wrappers;
3170 if (!strcasecmp(name,
"dtlsenable")) {
3172 }
else if (!strcasecmp(name,
"dtlsverify")) {
3173 if (!strcasecmp(value,
"yes")) {
3175 }
else if (!strcasecmp(value,
"fingerprint")) {
3177 }
else if (!strcasecmp(value,
"certificate")) {
3179 }
else if (!strcasecmp(value,
"no")) {
3184 }
else if (!strcasecmp(name,
"dtlsrekey")) {
3185 if (sscanf(value,
"%30u", &dtls_cfg->
rekey) != 1) {
3188 }
else if (!strcasecmp(name,
"dtlsautogeneratecert")) {
3190 }
else if (!strcasecmp(name,
"dtlscertfile")) {
3192 ast_log(LOG_ERROR,
"%s file %s does not exist or is not readable\n", name, value);
3197 }
else if (!strcasecmp(name,
"dtlsprivatekey")) {
3199 ast_log(LOG_ERROR,
"%s file %s does not exist or is not readable\n", name, value);
3204 }
else if (!strcasecmp(name,
"dtlscipher")) {
3205 ast_free(dtls_cfg->
cipher);
3207 }
else if (!strcasecmp(name,
"dtlscafile")) {
3209 ast_log(LOG_ERROR,
"%s file %s does not exist or is not readable\n", name, value);
3212 ast_free(dtls_cfg->
cafile);
3214 }
else if (!strcasecmp(name,
"dtlscapath") || !strcasecmp(name,
"dtlscadir")) {
3216 ast_log(LOG_ERROR,
"%s file %s does not exist or is not readable\n", name, value);
3219 ast_free(dtls_cfg->
capath);
3221 }
else if (!strcasecmp(name,
"dtlssetup")) {
3222 if (!strcasecmp(value,
"active")) {
3224 }
else if (!strcasecmp(value,
"passive")) {
3226 }
else if (!strcasecmp(value,
"actpass")) {
3229 }
else if (!strcasecmp(name,
"dtlsfingerprint")) {
3230 if (!strcasecmp(value,
"sha-256")) {
3232 }
else if (!strcasecmp(value,
"sha-1")) {
3245 if (!ast_strlen_zero(dtls_cfg->
certfile)) {
3246 ast_log(LOG_ERROR,
"You cannot request automatically generated certificates"
3247 " (dtls_auto_generate_cert) and also specify a certificate file"
3248 " (dtls_cert_file) at the same time\n");
3250 }
else if (!ast_strlen_zero(dtls_cfg->
pvtfile)
3251 || !ast_strlen_zero(dtls_cfg->
cafile)
3252 || !ast_strlen_zero(dtls_cfg->
capath)) {
3253 ast_log(LOG_NOTICE,
"dtls_pvt_file, dtls_cafile, and dtls_ca_path are"
3254 " ignored when dtls_auto_generate_cert is enabled\n");
3285 ast_free(dtls_cfg->
cipher);
3287 ast_free(dtls_cfg->
cafile);
3289 ast_free(dtls_cfg->
capath);
3297 static void rtp_engine_mime_type_cleanup(
int i)
3299 ao2_cleanup(ast_rtp_mime_types[i].payload_type.format);
3303 static void set_next_mime_type(
struct ast_format *format,
int rtp_code,
const char *type,
const char *subtype,
unsigned int sample_rate)
3307 ast_rwlock_wrlock(&mime_types_lock);
3310 if (ARRAY_LEN(ast_rtp_mime_types) <= x) {
3311 ast_rwlock_unlock(&mime_types_lock);
3323 ast_copy_string(ast_rtp_mime_types[x].type, type,
sizeof(ast_rtp_mime_types[x].type));
3324 ast_copy_string(ast_rtp_mime_types[x].subtype, subtype,
sizeof(ast_rtp_mime_types[x].subtype));
3328 ast_rwlock_unlock(&mime_types_lock);
3331 static void add_static_payload(
int payload,
struct ast_format *format,
int rtp_code)
3339 ast_assert(payload < (
int)ARRAY_LEN(static_RTP_PT));
3341 if (ast_option_rtpusedynamic && payload < 0) {
3353 ast_rwlock_wrlock(&static_RTP_PT_lock);
3360 payload = find_unused_payload(NULL);
3362 ast_log(LOG_WARNING,
"No dynamic RTP payload type values available "
3364 ast_rwlock_unlock(&static_RTP_PT_lock);
3369 type = rtp_payload_type_alloc(format, payload, rtp_code, 1, 0);
3371 ao2_cleanup(static_RTP_PT[payload]);
3372 static_RTP_PT[
payload] = type;
3374 ast_rwlock_unlock(&static_RTP_PT_lock);
3383 set_next_mime_type(format,
3388 add_static_payload(-1, format, 0);
3398 ast_rwlock_wrlock(&static_RTP_PT_lock);
3401 if (static_RTP_PT[x]
3403 ao2_ref(static_RTP_PT[x], -1);
3404 static_RTP_PT[x] = NULL;
3407 ast_rwlock_unlock(&static_RTP_PT_lock);
3409 ast_rwlock_wrlock(&mime_types_lock);
3411 for (x = 0; x < mime_types_len; x++) {
3413 rtp_engine_mime_type_cleanup(x);
3417 ast_rtp_mime_types[y] = ast_rtp_mime_types[x];
3422 ast_rwlock_unlock(&mime_types_lock);
3436 static void rtcp_message_payload_dtor(
void *obj)
3440 ao2_cleanup(payload->report);
3441 ao2_cleanup(payload->snapshot);
3450 unsigned int ssrc = payload->report->ssrc;
3451 unsigned int type = payload->report->type;
3452 unsigned int report_count = payload->report->reception_report_count;
3455 if (!packet_string) {
3459 if (payload->snapshot) {
3461 if (!channel_string) {
3466 if (payload->blob) {
3488 ast_str_append(&packet_string, 0,
"ReportCount: %u\r\n", report_count);
3491 (
unsigned long)payload->report->sender_information.ntp_timestamp.tv_sec,
3492 (
unsigned long)payload->report->sender_information.ntp_timestamp.tv_usec);
3494 payload->report->sender_information.rtp_timestamp);
3496 payload->report->sender_information.packet_count);
3498 payload->report->sender_information.octet_count);
3501 for (i = 0; i < report_count; i++) {
3509 if (!report_string) {
3513 ast_str_append(&report_string, 0,
"Report%dSourceSSRC: 0x%.8x\r\n",
3515 ast_str_append(&report_string, 0,
"Report%dFractionLost: %d\r\n",
3516 i, payload->report->
report_block[i]->lost_count.fraction);
3517 ast_str_append(&report_string, 0,
"Report%dCumulativeLost: %u\r\n",
3518 i, payload->report->
report_block[i]->lost_count.packets);
3519 ast_str_append(&report_string, 0,
"Report%dHighestSequence: %u\r\n",
3520 i, payload->report->
report_block[i]->highest_seq_no & 0xffff);
3521 ast_str_append(&report_string, 0,
"Report%dSequenceNumberCycles: %u\r\n",
3522 i, payload->report->
report_block[i]->highest_seq_no >> 16);
3528 i, ((
double)payload->report->
report_block[i]->dlsr) / 65536);
3535 AS_OR(channel_string,
""),
3543 struct ast_json *json_rtcp_report = NULL;
3544 struct ast_json *json_rtcp_report_blocks;
3545 struct ast_json *json_rtcp_sender_info = NULL;
3546 struct ast_json *json_channel = NULL;
3550 if (!json_rtcp_report_blocks) {
3554 for (i = 0; i < payload->report->reception_report_count && payload->report->
report_block[i]; i++) {
3555 struct ast_json *json_report_block;
3558 snprintf(str_lsr,
sizeof(str_lsr),
"%u", payload->report->
report_block[i]->lsr);
3559 json_report_block =
ast_json_pack(
"{s: I, s: I, s: I, s: I, s: I, s: s, s: I}",
3567 if (!json_report_block
3578 snprintf(sec,
sizeof(sec),
"%lu", (
unsigned long)payload->report->sender_information.ntp_timestamp.tv_sec);
3579 snprintf(usec,
sizeof(usec),
"%lu", (
unsigned long)payload->report->sender_information.ntp_timestamp.tv_usec);
3580 json_rtcp_sender_info =
ast_json_pack(
"{s: s, s: s, s: I, s: I, s: I}",
3581 "ntp_timestamp_sec", sec,
3582 "ntp_timestamp_usec", usec,
3583 "rtp_timestamp", (
ast_json_int_t)payload->report->sender_information.rtp_timestamp,
3584 "packets", (
ast_json_int_t)payload->report->sender_information.packet_count,
3585 "octets", (
ast_json_int_t)payload->report->sender_information.octet_count);
3586 if (!json_rtcp_sender_info) {
3592 json_rtcp_report =
ast_json_pack(
"{s: I, s: I, s: i, s: o, s: o}",
3595 "report_count", payload->report->reception_report_count,
3596 "sender_information", json_rtcp_sender_info ?:
ast_json_null(),
3597 "report_blocks", json_rtcp_report_blocks);
3598 if (!json_rtcp_report) {
3602 if (payload->snapshot) {
3604 if (!json_channel) {
3612 "channel", json_channel,
3613 "rtcp_report", json_rtcp_report,
3614 "blob", payload->blob);
3617 static void rtp_rtcp_report_dtor(
void *obj)
3622 for (i = 0; i < rtcp_report->reception_report_count; i++) {
3633 rtp_rtcp_report_dtor);
3646 if (!message_type) {
3650 payload = ao2_alloc(
sizeof(*payload), rtcp_message_payload_dtor);
3651 if (!payload || !report) {
3659 payload->blob = blob;
3663 payload->report = report;
3677 .to_ami = rtcp_report_to_ami,
3678 .to_json = rtcp_report_to_json,);
3680 .to_ami = rtcp_report_to_ami,
3681 .to_json = rtcp_report_to_json,);
3689 static uintmax_t debug_category_rtp_id;
3691 uintmax_t ast_debug_category_rtp_id(
void)
3693 return debug_category_rtp_id;
3696 static uintmax_t debug_category_rtp_packet_id;
3698 uintmax_t ast_debug_category_rtp_packet_id(
void)
3700 return debug_category_rtp_packet_id;
3703 static uintmax_t debug_category_rtcp_id;
3705 uintmax_t ast_debug_category_rtcp_id(
void)
3707 return debug_category_rtcp_id;
3710 static uintmax_t debug_category_rtcp_packet_id;
3712 uintmax_t ast_debug_category_rtcp_packet_id(
void)
3714 return debug_category_rtcp_packet_id;
3717 static uintmax_t debug_category_dtls_id;
3719 uintmax_t ast_debug_category_dtls_id(
void)
3721 return debug_category_dtls_id;
3724 static uintmax_t debug_category_dtls_packet_id;
3726 uintmax_t ast_debug_category_dtls_packet_id(
void)
3728 return debug_category_dtls_packet_id;
3731 static uintmax_t debug_category_ice_id;
3733 uintmax_t ast_debug_category_ice_id(
void)
3735 return debug_category_ice_id;
3743 static void rtp_engine_shutdown(
void)
3747 ao2_cleanup(rtp_topic);
3752 ast_rwlock_wrlock(&static_RTP_PT_lock);
3754 ao2_cleanup(static_RTP_PT[x]);
3755 static_RTP_PT[x] = NULL;
3757 ast_rwlock_unlock(&static_RTP_PT_lock);
3759 ast_rwlock_wrlock(&mime_types_lock);
3760 for (x = 0; x < mime_types_len; x++) {
3761 if (ast_rtp_mime_types[x].payload_type.format) {
3762 rtp_engine_mime_type_cleanup(x);
3766 ast_rwlock_unlock(&mime_types_lock);
3774 static void rtp_engine_atexit(
void)
3776 ast_debug_category_unregister(AST_LOG_CATEGORY_ICE);
3778 ast_debug_category_unregister(AST_LOG_CATEGORY_DTLS_PACKET);
3779 ast_debug_category_unregister(AST_LOG_CATEGORY_DTLS);
3781 ast_debug_category_unregister(AST_LOG_CATEGORY_RTCP_PACKET);
3782 ast_debug_category_unregister(AST_LOG_CATEGORY_RTCP);
3784 ast_debug_category_unregister(AST_LOG_CATEGORY_RTP_PACKET);
3785 ast_debug_category_unregister(AST_LOG_CATEGORY_RTP);
3832 set_next_mime_type(NULL,
AST_RTP_DTMF,
"audio",
"telephone-event", 8000);
3833 set_next_mime_type(NULL,
AST_RTP_DTMF,
"audio",
"telephone-event", 16000);
3834 set_next_mime_type(NULL,
AST_RTP_DTMF,
"audio",
"telephone-event", 24000);
3835 set_next_mime_type(NULL,
AST_RTP_DTMF,
"audio",
"telephone-event", 32000);
3836 set_next_mime_type(NULL,
AST_RTP_DTMF,
"audio",
"telephone-event", 48000);
3837 set_next_mime_type(NULL,
AST_RTP_CISCO_DTMF,
"audio",
"cisco-telephone-event", 8000);
3838 set_next_mime_type(NULL,
AST_RTP_CN,
"audio",
"CN", 8000);
3846 set_next_mime_type(
ast_format_mp4, 0,
"video",
"MP4V-ES", 90000);
3859 #ifdef USE_DEPRECATED_G726
3918 debug_category_rtp_id = ast_debug_category_register(AST_LOG_CATEGORY_RTP);
3919 debug_category_rtp_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_RTP_PACKET);
3920 debug_category_rtcp_id = ast_debug_category_register(AST_LOG_CATEGORY_RTCP);
3921 debug_category_rtcp_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_RTCP_PACKET);
3922 debug_category_dtls_id = ast_debug_category_register(AST_LOG_CATEGORY_DTLS);
3923 debug_category_dtls_packet_id = ast_debug_category_register(AST_LOG_CATEGORY_DTLS_PACKET);
3924 debug_category_ice_id = ast_debug_category_register(AST_LOG_CATEGORY_ICE);
3961 unsigned int ssrc = 0;
3974 const char *cname =
"";
4020 #ifdef TEST_FRAMEWORK
4021 size_t ast_rtp_instance_get_recv_buffer_max(
struct ast_rtp_instance *instance)
4024 struct ast_rtp_engine_test *
test = ast_rtp_instance_get_test(instance);
4027 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4032 res = test->recv_buffer_max(instance);
4033 ao2_unlock(instance);
4038 size_t ast_rtp_instance_get_recv_buffer_count(
struct ast_rtp_instance *instance)
4041 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4044 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4049 res = test->recv_buffer_count(instance);
4050 ao2_unlock(instance);
4055 size_t ast_rtp_instance_get_send_buffer_count(
struct ast_rtp_instance *instance)
4058 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4061 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4066 res = test->send_buffer_count(instance);
4067 ao2_unlock(instance);
4072 void ast_rtp_instance_set_schedid(
struct ast_rtp_instance *instance,
int id)
4074 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4077 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4082 test->set_schedid(instance,
id);
4083 ao2_unlock(instance);
4086 void ast_rtp_instance_drop_packets(
struct ast_rtp_instance *instance,
int num)
4088 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4091 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4095 test->packets_to_drop = num;
4100 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4103 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4107 test->send_report = 1;
4112 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4115 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4119 return test->sdes_received;
4124 struct ast_rtp_engine_test *test = ast_rtp_instance_get_test(instance);
4127 ast_log(LOG_ERROR,
"There is no test engine set up!\n");
4131 test->packets_to_drop = 0;
4132 test->send_report = 0;
4133 test->sdes_received = 0;
4162 ast_log(LOG_WARNING,
"Could not create rtp statistics info. channel: %s\n", stats->
channel_uniqueid);
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
struct stasis_message_type * ast_rtp_rtcp_sent_type(void)
Message type for an RTCP message sent from this Asterisk instance.
int ast_rtp_instance_set_write_format(struct ast_rtp_instance *instance, struct ast_format *format)
Tell underlying RTP engine that audio frames will be provided in a specific format.
struct ast_rtp_engine_ice * ast_rtp_instance_get_ice(struct ast_rtp_instance *instance)
Obtain a pointer to the ICE support present on an RTP instance.
double local_normdevrxploss
int ast_rtp_instance_sendcng(struct ast_rtp_instance *instance, int level)
Send a comfort noise packet to the RTP instance.
int(* activate)(struct ast_rtp_instance *instance)
Struct containing info for an AMI event to send out.
An object that represents data sent during a SR/RR RTCP report.
int ast_rtp_codecs_payloads_initialize(struct ast_rtp_codecs *codecs)
Initialize an RTP codecs structure.
void ast_rtp_instance_extmap_clear(struct ast_rtp_instance *instance)
Clear negotiated RTP extension information.
int ast_rtp_engine_unregister(struct ast_rtp_engine *engine)
Unregister an RTP engine.
Main Channel structure associated with a channel.
char type[16]
The media type.
int(* bundle)(struct ast_rtp_instance *child, struct ast_rtp_instance *parent)
int ast_rtp_red_buffer(struct ast_rtp_instance *instance, struct ast_frame *frame)
Buffer a frame in an RTP instance for RED.
void(* prop_set)(struct ast_rtp_instance *instance, enum ast_rtp_property property, int value)
void(* payload_set)(struct ast_rtp_instance *instance, int payload, int asterisk_format, struct ast_format *format, int code)
void ast_rtp_instance_set_keepalive(struct ast_rtp_instance *instance, int interval)
Set the RTP keepalive interval.
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
static void unref_instance_cond(struct ast_rtp_instance **instance)
Conditionally unref an rtp instance.
int(* set_configuration)(struct ast_rtp_instance *instance, const struct ast_rtp_dtls_cfg *dtls_cfg)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
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 tx payload type to a known MIME media type for a codec with a specific sample rate...
void ast_rtp_codecs_set_framing(struct ast_rtp_codecs *codecs, unsigned int framing)
Set the framing used for a set of codecs.
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.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
int ast_rtp_codecs_payload_set_rx(struct ast_rtp_codecs *codecs, int code, struct ast_format *format)
Set a payload code for use with a specific Asterisk format.
int(* set_write_format)(struct ast_rtp_instance *instance, struct ast_format *format)
struct ast_rtp_engine * ast_rtp_instance_get_engine(struct ast_rtp_instance *instance)
Get the RTP engine in use on an RTP instance.
void *(* extended_prop_get)(struct ast_rtp_instance *instance, int property)
String manipulation functions.
int ast_rtp_engine_unload_format(struct ast_format *format)
Formats requiring the use of a format attribute interface must have that interface registered in orde...
enum ast_rtp_dtmf_mode(* dtmf_mode_get)(struct ast_rtp_instance *instance)
const char *(* get_password)(struct ast_rtp_instance *instance)
const char *(* get_fingerprint)(struct ast_rtp_instance *instance)
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.
int ast_rtp_codecs_payload_code_tx(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code)
Retrieve a tx mapped payload type based on whether it is an Asterisk format and the code...
unsigned int ast_rtp_codecs_get_framing(struct ast_rtp_codecs *codecs)
Get the framing used for a set of codecs.
int(* sendcng)(struct ast_rtp_instance *instance, int level)
double remote_normdevjitter
char subtype[64]
The format type.
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 tx payload type information that was seen in an a=rtpmap: SDP line.
int(* write)(struct ast_rtp_instance *instance, struct ast_frame *frame)
#define ast_channel_unref(c)
Decrease channel reference count.
Support for translation of data formats. translate.c.
enum ast_media_type ast_rtp_codecs_get_stream_type(struct ast_rtp_codecs *codecs)
Determine the type of RTP stream media from the codecs mapped.
static void ast_sockaddr_copy(struct ast_sockaddr *dst, const struct ast_sockaddr *src)
Copies the data from one ast_sockaddr to another.
int ast_rtp_engine_init(void)
initializes the rtp engine arrays
Time-related functions and macros.
struct ast_rtp_instance::@388 extmap_enabled
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
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.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
const char * ast_rtp_instance_get_cname(struct ast_rtp_instance *rtp)
Retrieve the CNAME used in RTCP SDES items.
struct ast_frame *(* read)(struct ast_rtp_instance *instance, int rtcp)
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
enum ast_rtp_extension ast_rtp_instance_extmap_get_extension(struct ast_rtp_instance *instance, int id)
Retrieve the extension for an RTP extension id.
#define AST_RTP_PT_LAST_STATIC
#define ast_rwlock_init(rwlock)
wrapper for rwlock with tracking enabled
int ast_file_is_readable(const char *filename)
Test that a file exists and is readable by the effective user.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
double remote_stdevjitter
AST_JSON_INT_T ast_json_int_t
Primarily used to cast when packing to an "I" type.
int ast_rtp_engine_register2(struct ast_rtp_engine *engine, struct ast_module *module)
Register an RTP engine.
int ast_rtp_codecs_payload_code_tx_sample_rate(struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code, unsigned int sample_rate)
Retrieve a tx mapped payload type based on whether it is an Asterisk format and the code...
struct ast_format * ast_rtp_codecs_get_payload_format(struct ast_rtp_codecs *codecs, int payload)
Retrieve the actual ast_format stored on the codecs structure for a specific tx payload type...
void ast_rtp_instance_stop(struct ast_rtp_instance *instance)
Stop an RTP instance.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
void(* stop)(struct ast_rtp_instance *instance)
const char * ast_codec_media_type2str(enum ast_media_type type)
Conversion function to take a media type and turn it into a string.
void ast_rtp_instance_get_incoming_source_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the incoming source address of the remote endpoint.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
const char * ast_rtp_lookup_mime_subtype2(const int asterisk_format, const struct ast_format *format, int code, enum ast_rtp_options options)
Retrieve mime subtype information on a payload.
Structure representing a snapshot of channel state.
int(* dtmf_end)(struct ast_rtp_instance *instance, char digit)
unsigned int ast_rtp_instance_get_ssrc(struct ast_rtp_instance *rtp)
Retrieve the local SSRC value that we will be using.
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.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
static enum ast_rtp_extension_direction rtp_extmap_negotiate_direction(enum ast_rtp_extension_direction ours, enum ast_rtp_extension_direction theirs)
Helper function which negotiates two RTP extension directions to get our current direction.
struct ast_rtp_rtcp_report_block * report_block[0]
void ast_rtp_codecs_payload_formats(struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats)
Retrieve all formats that were found.
int(* update_peer)(struct ast_channel *chan, struct ast_rtp_instance *instance, struct ast_rtp_instance *vinstance, struct ast_rtp_instance *tinstance, const struct ast_format_cap *cap, int nat_active)
struct stasis_message_type * stasis_message_type(const struct stasis_message *msg)
Get the message type for a stasis_message.
int ast_rtp_instance_get_prop(struct ast_rtp_instance *instance, enum ast_rtp_property property)
Get the value of an RTP instance property.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
const char *(* cname_get)(struct ast_rtp_instance *instance)
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(* change_source)(struct ast_rtp_instance *instance)
void(* change_components)(struct ast_rtp_instance *instance, int num_components)
void(* add_remote_candidate)(struct ast_rtp_instance *instance, const struct ast_rtp_engine_ice_candidate *candidate)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
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...
void(* stop)(struct ast_rtp_instance *instance)
struct ast_rtp_codecs::@280 payload_mapping_rx
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, const struct ast_format *format, int code)
Get the sample rate associated with known RTP payload types.
int ast_rtp_engine_load_format(struct ast_format *format)
Custom formats declared in codecs.conf at startup must be communicated to the rtp_engine so their mim...
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
ast_rtp_extension
Known RTP extensions.
A report block within a SR/RR report.
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.
struct ast_rtp_payload_type * ast_rtp_codecs_get_payload(struct ast_rtp_codecs *codecs, int payload)
Retrieve rx payload mapped information by payload type.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
#define ast_strdup(str)
A wrapper for strdup()
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.
void(* stop)(struct ast_rtp_instance *instance)
#define AST_RTP_PT_FIRST_DYNAMIC
void(* update_source)(struct ast_rtp_instance *instance)
int ast_rtp_instance_fd(struct ast_rtp_instance *instance, int rtcp)
Get the file descriptor for an RTP session (or RTCP)
int ast_sockaddr_cmp(const struct ast_sockaddr *a, const struct ast_sockaddr *b)
Compares two ast_sockaddr structures.
void ast_rtp_dtls_cfg_copy(const struct ast_rtp_dtls_cfg *src_cfg, struct ast_rtp_dtls_cfg *dst_cfg)
Copy contents of a DTLS configuration structure.
void ast_rtp_instance_set_channel_id(struct ast_rtp_instance *instance, const char *uniqueid)
Set the channel that owns this RTP instance.
struct ast_rtp_instance * ast_rtp_instance_new(const char *engine_name, struct ast_sched_context *sched, const struct ast_sockaddr *sa, void *data)
Create a new RTP instance.
int(* make_compatible)(struct ast_channel *chan0, struct ast_rtp_instance *instance0, struct ast_channel *chan1, struct ast_rtp_instance *instance1)
Structure for an ICE candidate.
unsigned int sample_rate
Expected sample rate of the /c subtype.
Socket address structure.
void ast_rtp_codecs_payloads_destroy(struct ast_rtp_codecs *codecs)
Destroy the contents of an RTP codecs structure (but not the structure itself)
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.
enum ast_rtp_dtls_hash(* get_fingerprint_hash)(struct ast_rtp_instance *instance)
struct ast_manager_event_blob * ast_manager_event_blob_create(int event_flags, const char *manager_event, const char *extra_fields_fmt,...)
Construct a ast_manager_event_blob.
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.
int ast_rtp_get_rate(const struct ast_format *format)
Retrieve the sample rate of a format according to RTP specifications.
Structure containing callbacks for Stasis message sanitization.
enum ast_rtp_dtls_setup(* get_setup)(struct ast_rtp_instance *instance)
struct stasis_message_type * ast_rtp_rtcp_received_type(void)
Message type for an RTCP message received from some external source.
time_t ast_rtp_instance_get_last_tx(const struct ast_rtp_instance *rtp)
Get the last RTP transmission time.
void(* remote_address_set)(struct ast_rtp_instance *instance, struct ast_sockaddr *sa)
void(* turn_request)(struct ast_rtp_instance *instance, enum ast_rtp_ice_component_type component, enum ast_transport transport, const char *server, unsigned int port, const char *username, const char *password)
int ast_json_object_set(struct ast_json *object, const char *key, struct ast_json *value)
Set a field in a JSON object.
void ast_translate_available_formats(struct ast_format_cap *dest, struct ast_format_cap *src, struct ast_format_cap *result)
Find available formats.
struct ast_rtp_engine_dtls * ast_rtp_instance_get_dtls(struct ast_rtp_instance *instance)
Obtain a pointer to the DTLS support present on an RTP instance.
enum ast_rtp_extension_direction ast_rtp_instance_extmap_get_direction(struct ast_rtp_instance *instance, int id)
Retrieve the negotiated direction for an RTP extension id.
int ast_rtp_instance_get_timeout(struct ast_rtp_instance *instance)
Get the RTP timeout value.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
struct ast_json * ast_json_null(void)
Get the JSON null value.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
struct ast_frame * ast_rtp_instance_read(struct ast_rtp_instance *instance, int rtcp)
Receive a frame over RTP.
int ast_rtp_glue_register2(struct ast_rtp_glue *glue, struct ast_module *module)
Register RTP glue.
char * ast_rtp_lookup_mime_multiple2(struct ast_str *buf, struct ast_format_cap *ast_format_capability, int rtp_capability, const int asterisk_format, enum ast_rtp_options options)
Convert formats into a string and put them into a buffer.
enum ast_rtp_dtls_connection(* get_connection)(struct ast_rtp_instance *instance)
struct ast_rtp_instance::@390 extmap_unique_ids
struct ast_rtp_codecs * ast_rtp_instance_get_codecs(struct ast_rtp_instance *instance)
Get the codecs structure of an RTP instance.
int(* destroy)(struct ast_rtp_instance *instance)
void ast_rtp_dtls_cfg_free(struct ast_rtp_dtls_cfg *dtls_cfg)
Free contents of a DTLS configuration structure.
int ast_rtp_instance_dtmf_begin(struct ast_rtp_instance *instance, char digit)
Begin sending a DTMF digit.
struct ast_rtp_payload_type payload_type
A mapping object between the Asterisk codec and this RTP payload.
struct ast_rtp_engine_dtls * dtls
void ast_rtp_instance_get_requested_target_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the requested target address of the remote endpoint.
STASIS_MESSAGE_TYPE_DEFN(ast_rtp_rtcp_sent_type,.to_ami=rtcp_report_to_ami,.to_json=rtcp_report_to_json,)
Define RTCP/RTP message types.
int(* red_buffer)(struct ast_rtp_instance *instance, struct ast_frame *frame)
struct ast_rtp_codecs::@281 payload_mapping_tx
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
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...
int ast_rtp_instance_get_keepalive(struct ast_rtp_instance *instance)
Get the RTP keepalive interval.
int ast_rtp_codecs_find_payload_code(struct ast_rtp_codecs *codecs, int payload)
Search for the tx payload type in the ast_rtp_codecs structure.
General Asterisk PBX channel definitions.
Asterisk JSON abstraction layer.
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
int ast_register_cleanup(void(*func)(void))
Register a function to be executed before Asterisk gracefully exits.
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.
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_rtp_payload_type * ast_rtp_engine_alloc_payload_type(void)
Allocation routine for ast_rtp_payload_type.
int ast_rtp_instance_write(struct ast_rtp_instance *instance, struct ast_frame *frame)
Send a frame out over RTP.
struct ast_json * ast_json_string_create(const char *value)
Construct a JSON string from value.
Maximum number of RTP properties supported.
struct stasis_topic * ast_rtp_topic(void)
Stasis Message Bus API topic for RTP and RTCP related messages
void ast_channel_stage_snapshot_done(struct ast_channel *chan)
Clear flag to indicate channel snapshot is being staged, and publish snapshot.
#define ast_strdupa(s)
duplicate a string in memory from the stack
void(* available_formats)(struct ast_rtp_instance *instance, struct ast_format_cap *to_endpoint, struct ast_format_cap *to_asterisk, struct ast_format_cap *result)
ast_rtp_ice_role
ICE role during negotiation.
void(* set_fingerprint)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_hash hash, const char *fingerprint)
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
int ast_rtp_codecs_payload_set_rx_sample_rate(struct ast_rtp_codecs *codecs, int code, struct ast_format *format, unsigned int sample_rate)
Set a payload code with sample rate for use with a specific Asterisk format.
void ast_rtp_instance_set_stream_num(struct ast_rtp_instance *rtp, int stream_num)
Set the stream number for an RTP instance.
struct ast_rtp_glue * glue
Scheduler Routines (derived from cheops)
int(* new)(struct ast_rtp_instance *instance, struct ast_sched_context *sched, struct ast_sockaddr *sa, void *data)
structure to hold extensions
int ast_register_atexit(void(*func)(void))
Register a function to be executed before Asterisk exits.
char channel_uniqueid[MAX_CHANNEL_ID]
ast_rtp_ice_component_type
ICE component types.
void * ast_rtp_instance_get_extended_prop(struct ast_rtp_instance *instance, int property)
Get the value of an RTP instance extended property.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
void ast_rtp_instance_set_timeout(struct ast_rtp_instance *instance, int timeout)
Set the RTP timeout value.
A set of macros to manage forward-linked lists.
enum ast_rtp_dtls_hash hash
struct ast_rtp_glue * ast_rtp_instance_get_glue(const char *type)
Get the RTP glue that binds a channel to the RTP engine.
double local_stdevrxploss
void ast_rtp_instance_update_source(struct ast_rtp_instance *instance)
Indicate that the RTP marker bit should be set on an RTP stream.
void ast_rtp_codecs_payloads_clear(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance)
Clear rx and tx payload mapping information from an RTP instance.
#define ast_debug(level,...)
Log a DEBUG message.
void ast_rtp_instance_set_last_tx(struct ast_rtp_instance *rtp, time_t time)
Set the last RTP transmission time.
#define AST_VECTOR(name, type)
Define a vector structure.
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
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.
unsigned int txoctetcount
int ast_rtp_instance_get_and_cmp_requested_target_address(struct ast_rtp_instance *instance, struct ast_sockaddr *address)
Get the requested target address of the remote endpoint and compare it to the given address...
void(* get_codec)(struct ast_channel *chan, struct ast_format_cap *result_cap)
Callback for retrieving codecs that the channel can do. Result returned in result_cap.
struct ast_str * ast_manager_build_channel_state_string(const struct ast_channel_snapshot *snapshot)
Generate the AMI message body from a channel snapshot.
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
double remote_normdevrxploss
Structure that represents the optional DTLS SRTP support within an RTP engine.
int ast_rtp_instance_bundle(struct ast_rtp_instance *child, struct ast_rtp_instance *parent)
Request that an RTP instance be bundled with another.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
enum ast_rtp_extension_direction direction
static struct stasis_topic * rtp_topic
Stasis Message Bus API topic for RTP related messages
ast_rtp_dtls_setup
DTLS setup types.
struct ast_sockaddr incoming_source_address
static force_inline char * ast_str_to_upper(char *str)
Convert a string to all upper-case.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
void ast_channel_stage_snapshot(struct ast_channel *chan)
Set flag to indicate channel snapshot is being staged.
const char *(* get_ufrag)(struct ast_rtp_instance *instance)
enum ast_rtp_dtls_setup default_setup
struct ast_json * ast_rtp_instance_get_stats_all_json(struct ast_rtp_instance *instance)
Retrieve statistics about an RTP instance in json format.
void(* set_authentication)(struct ast_rtp_instance *instance, const char *ufrag, const char *password)
void ast_rtp_codecs_payloads_unset(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
Remove tx payload type mapped information.
int ast_rtp_instance_dtmf_end(struct ast_rtp_instance *instance, char digit)
Stop sending a DTMF digit.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
int(* dtmf_begin)(struct ast_rtp_instance *instance, char digit)
struct ao2_container *(* get_local_candidates)(struct ast_rtp_instance *instance)
Support for dynamic strings.
unsigned int rxoctetcount
enum ast_rtp_dtls_verify verify
int ast_rtp_glue_unregister(struct ast_rtp_glue *glue)
Unregister RTP glue.
ast_rtp_extension_direction
Directions for RTP extensions.
void(* set_role)(struct ast_rtp_instance *instance, enum ast_rtp_ice_role role)
int(* dtmf_mode_set)(struct ast_rtp_instance *instance, enum ast_rtp_dtmf_mode dtmf_mode)
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
ast_rtp_dtls_connection
DTLS connection states.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
struct ast_rtp_engine_ice * ice
struct ast_format * format
int(* extended_prop_set)(struct ast_rtp_instance *instance, int property, void *value)
unsigned int(* ssrc_get)(struct ast_rtp_instance *instance)
int ast_rtp_dtls_cfg_parse(struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value)
Parse DTLS related configuration options.
enum ast_rtp_extension extension
void(* reset)(struct ast_rtp_instance *instance)
void ast_rtp_instance_available_formats(struct ast_rtp_instance *instance, struct ast_format_cap *to_endpoint, struct ast_format_cap *to_asterisk, struct ast_format_cap *result)
Request the formats that can be transcoded.
ast_rtp_dtls_hash
DTLS fingerprint hashes.
struct ast_bridge * bridge
int properties[AST_RTP_PROPERTY_MAX]
#define AST_RTP_CISCO_DTMF
int ast_rtp_codecs_payload_replace_format(struct ast_rtp_codecs *codecs, int payload, struct ast_format *format)
Update the format associated with a tx payload type in a codecs structure.
void stasis_publish(struct stasis_topic *topic, struct stasis_message *message)
Publish a message to a topic's subscribers.
int ast_rtp_codecs_payload_code(struct ast_rtp_codecs *codecs, int asterisk_format, struct ast_format *format, int code)
Retrieve a rx mapped payload type based on whether it is an Asterisk format and the code...
static struct ast_rtp_payload_type * static_RTP_PT[AST_RTP_MAX_PT]
Mapping between Asterisk codecs and rtp payload types.
void(* start)(struct ast_rtp_instance *instance)
void ast_rtp_instance_set_remote_ssrc(struct ast_rtp_instance *rtp, unsigned int ssrc)
Set the remote SSRC for an RTP instance.
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.
struct ast_srtp * rtcp_srtp
void(* set_setup)(struct ast_rtp_instance *instance, enum ast_rtp_dtls_setup setup)
double ast_json_real_get(const struct ast_json *real)
Get the value from a JSON real number.
Support for logging to various files, console and syslog Configuration in file logger.conf.
Prototypes for public functions only of internal interest,.
int(* qos)(struct ast_rtp_instance *instance, int tos, int cos, const char *desc)
Vector container support.
struct ast_sockaddr local_address
void(* set_remote_ssrc)(struct ast_rtp_instance *instance, unsigned int ssrc)
int ast_rtp_instance_add_srtp_policy(struct ast_rtp_instance *instance, struct ast_srtp_policy *remote_policy, struct ast_srtp_policy *local_policy, int rtcp)
Add or replace the SRTP policies for the given RTP instance.
unsigned int ephemeral_cert
void ast_rtp_codecs_payloads_set_m_type(struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload)
Record tx payload type information that was seen in an m= SDP line.
void(* set_stream_num)(struct ast_rtp_instance *instance, int stream_num)
int ast_rtp_codecs_payload_code_sample_rate(struct ast_rtp_codecs *codecs, int asterisk_format, struct ast_format *format, int code, unsigned int sample_rate)
Retrieve a rx mapped payload type based on whether it is an Asterisk format, the code and the sample ...
int ast_rtp_instance_set_incoming_source_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the incoming source address of the remote endpoint that we are sending RTP to.
void ast_rtp_instance_set_last_rx(struct ast_rtp_instance *rtp, time_t time)
Set the last RTP reception time.
void(* stun_request)(struct ast_rtp_instance *instance, struct ast_sockaddr *suggestion, const char *username)
int ast_rtp_instance_set_requested_target_address(struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
Set the requested target address of the remote endpoint.
struct ast_sockaddr requested_target_address
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.
struct ast_rtp_instance * bridged
#define ast_module_unref(mod)
Release a reference to the module.
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...
#define ast_module_running_ref(mod)
Hold a reference to the module if it is running.
int(* set_read_format)(struct ast_rtp_instance *instance, struct ast_format *format)
struct ast_rtp_rtcp_report * ast_rtp_rtcp_report_alloc(unsigned int report_blocks)
Allocate an ao2 ref counted instance of ast_rtp_rtcp_report.
#define ast_channel_lock_both(chan1, chan2)
Lock two channels.
const char * ast_rtp_instance_get_channel_id(struct ast_rtp_instance *instance)
Get the unique ID of the channel that owns this RTP instance.
struct ast_json * ast_json_object_create(void)
Create a new JSON object.
int(* active)(struct ast_rtp_instance *instance)
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.
ast_rtp_instance_stat_field
#define AST_VECTOR_GET(vec, idx)
Get an element from a vector.
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.
char channel_uniqueid[AST_MAX_UNIQUEID]
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
struct ast_channel_snapshot * ast_channel_snapshot_get_latest(const char *uniqueid)
Obtain the latest ast_channel_snapshot from the Stasis Message Bus API cache. This is an ao2 object...
struct ast_json * ast_json_real_create(double value)
Create a JSON real number.
#define ast_debug_rtp(sublevel,...)
Log debug level RTP information.
Structure for rwlock and tracking information.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
struct ast_channel * ast_channel_bridge_peer(struct ast_channel *chan)
Get the channel's bridge peer only if the bridge is two-party.
void ast_rtp_codecs_payloads_xover(struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance)
Crossover copy the tx payload mapping of src to the rx payload mapping of dest.
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_rtp_instance::@389 extmap_negotiated
#define AST_VECTOR_REPLACE(vec, idx, elem)
Replace an element at a specific position in a vector, growing the vector if needed.
Data structure associated with a single frame of data.
#define AST_RTP_PT_LAST_REASSIGN
enum ast_srtp_suite suite
double remote_stdevrxploss
Structure that represents the optional ICE support within an RTP engine.
Abstract JSON element (object, array, string, int, ...).
struct ast_rtp_engine * engine
int ast_rtp_instance_extmap_get_id(struct ast_rtp_instance *instance, enum ast_rtp_extension extension)
Retrieve the id for an RTP extension.
struct ast_srtp * ast_rtp_instance_get_srtp(struct ast_rtp_instance *instance, int rtcp)
Obtain the SRTP instance associated with an RTP instance.
struct ast_json * ast_rtp_convert_stats_json(const struct ast_rtp_instance_stats *stats)
Convert given stat instance into json format.
Options provided by main asterisk program.
void ast_rtp_instance_set_data(struct ast_rtp_instance *instance, void *data)
Set the data portion of an RTP instance.
struct ast_format * ast_rtp_codecs_get_preferred_format(struct ast_rtp_codecs *codecs)
Retrieve rx preferred format.
int(* red_init)(struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations)
ast_media_type
Types of media.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
struct ast_format * preferred_format
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.
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.
double local_normdevjitter
int ast_rtp_dtls_cfg_validate(struct ast_rtp_dtls_cfg *dtls_cfg)
Validates DTLS related configuration options.
int ast_rtp_instance_set_read_format(struct ast_rtp_instance *instance, struct ast_format *format)
Request that the underlying RTP engine provide audio frames in a specific format. ...
struct ast_json * ast_channel_snapshot_to_json(const struct ast_channel_snapshot *snapshot, const struct stasis_message_sanitizer *sanitize)
Build a JSON object from a ast_channel_snapshot.
unsigned int primary_mapping
struct timeval when_retired
size_t ast_rtp_instance_extmap_count(struct ast_rtp_instance *instance)
Get the number of known unique identifiers.
time_t ast_rtp_instance_get_last_rx(const struct ast_rtp_instance *rtp)
Get the last RTP reception time.
void * ast_rtp_instance_get_data(struct ast_rtp_instance *instance)
Get the data portion of an RTP instance.
Pluggable RTP Architecture.
int ast_rtp_instance_extmap_negotiate(struct ast_rtp_instance *instance, int id, enum ast_rtp_extension_direction direction, const char *uri, const char *attributes)
Negotiate received RTP extension information.
int(* extension_enable)(struct ast_rtp_instance *instance, enum ast_rtp_extension extension)
Asterisk module definitions.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
void(* destroy)(struct ast_srtp *srtp)
void ast_rtp_publish_rtcp_message(struct ast_rtp_instance *rtp, struct stasis_message_type *message_type, struct ast_rtp_rtcp_report *report, struct ast_json *blob)
Publish an RTCP message to Stasis Message Bus API.
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.
int ast_rtp_codecs_set_preferred_format(struct ast_rtp_codecs *codecs, struct ast_format *format)
Set the preferred format.
const char * ast_rtp_instance_extmap_get_uri(struct ast_rtp_instance *instance, int id)
Retrieve the URI for an RTP extension id.
static const char *const rtp_extension_uris[AST_RTP_EXTENSION_MAX]
URIs for known RTP extensions.
int(* fd)(struct ast_rtp_instance *instance, int rtcp)
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
int ast_rtp_instance_extmap_enable(struct ast_rtp_instance *instance, int id, enum ast_rtp_extension extension, enum ast_rtp_extension_direction direction)
Enable support for an RTP extension on an instance.
struct ast_rtp_codecs codecs
int ast_rtp_instance_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
Early bridge two channels that use RTP instances.
#define SET_AST_JSON_OBJ(target, name, obj)
Set given json object into target with name.
DTLS configuration structure.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
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.
int(* get_stat)(struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat)
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.
int(* create)(struct ast_srtp **srtp, struct ast_rtp_instance *rtp, struct ast_srtp_policy *policy)
void ast_rtp_instance_set_bridged(struct ast_rtp_instance *instance, struct ast_rtp_instance *bridged)
Set the other RTP instance that an instance is bridged to.
struct ast_json * ast_json_integer_create(intmax_t value)
Create a JSON integer.
void(* ice_lite)(struct ast_rtp_instance *instance)
#define AST_MAX_USER_FIELD