Asterisk - The Open Source Telephony Project
18.5.0
|
Pluggable RTP Architecture. More...
#include "asterisk.h"
#include <math.h>
#include <sched.h>
#include <sys/time.h>
#include <time.h>
#include "asterisk/_private.h"
#include "asterisk/astobj2.h"
#include "asterisk/channel.h"
#include "asterisk/codec.h"
#include "asterisk/format.h"
#include "asterisk/format_cache.h"
#include "asterisk/format_cap.h"
#include "asterisk/json.h"
#include "asterisk/linkedlists.h"
#include "asterisk/lock.h"
#include "asterisk/logger.h"
#include "asterisk/manager.h"
#include "asterisk/module.h"
#include "asterisk/netsock2.h"
#include "asterisk/options.h"
#include "asterisk/pbx.h"
#include "asterisk/res_srtp.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/strings.h"
#include "asterisk/translate.h"
#include "asterisk/utils.h"
#include "asterisk/vector.h"
Go to the source code of this file.
Data Structures | |
struct | ast_rtp_instance |
struct | ast_rtp_mime_type |
struct | engines |
struct | glues |
struct | rtcp_message_payload |
struct | rtp_extmap |
Macros | |
#define | MAX_RTP_MIME_TYPES 128 |
#define | SET_AST_JSON_OBJ(target, name, obj) |
Set given json object into target with name. More... | |
Functions | |
static void | add_static_payload (int payload, struct ast_format *format, int rtp_code) |
uintmax_t | ast_debug_category_dtls_id (void) |
uintmax_t | ast_debug_category_dtls_packet_id (void) |
uintmax_t | ast_debug_category_ice_id (void) |
uintmax_t | ast_debug_category_rtcp_id (void) |
uintmax_t | ast_debug_category_rtcp_packet_id (void) |
uintmax_t | ast_debug_category_rtp_id (void) |
uintmax_t | ast_debug_category_rtp_packet_id (void) |
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. More... | |
unsigned int | ast_rtp_codecs_get_framing (struct ast_rtp_codecs *codecs) |
Get the framing used for a set of codecs. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ast_rtp_codecs_payload_formats (struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats) |
Retrieve all formats that were found. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ast_rtp_codecs_payloads_destroy (struct ast_rtp_codecs *codecs) |
Destroy the contents of an RTP codecs structure (but not the structure itself) More... | |
int | ast_rtp_codecs_payloads_initialize (struct ast_rtp_codecs *codecs) |
Initialize an RTP codecs structure. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ast_rtp_codecs_payloads_unset (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload) |
Remove tx payload type mapped information. More... | |
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. More... | |
void | ast_rtp_codecs_set_framing (struct ast_rtp_codecs *codecs, unsigned int framing) |
Set the framing used for a set of codecs. More... | |
struct ast_json * | ast_rtp_convert_stats_json (const struct ast_rtp_instance_stats *stats) |
Convert given stat instance into json format. More... | |
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. More... | |
void | ast_rtp_dtls_cfg_free (struct ast_rtp_dtls_cfg *dtls_cfg) |
Free contents of a DTLS configuration structure. More... | |
int | ast_rtp_dtls_cfg_parse (struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value) |
Parse DTLS related configuration options. More... | |
int | ast_rtp_dtls_cfg_validate (struct ast_rtp_dtls_cfg *dtls_cfg) |
Validates DTLS related configuration options. More... | |
struct ast_rtp_payload_type * | ast_rtp_engine_alloc_payload_type (void) |
Allocation routine for ast_rtp_payload_type. More... | |
int | ast_rtp_engine_init (void) |
initializes the rtp engine arrays More... | |
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 mime type can payload number can be initialized. More... | |
int | ast_rtp_engine_register2 (struct ast_rtp_engine *engine, struct ast_module *module) |
Register an RTP engine. More... | |
int | ast_rtp_engine_register_srtp (struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res) |
int | ast_rtp_engine_srtp_is_registered (void) |
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 order for the rtp engine to handle it correctly. If an attribute interface is unloaded, this function must be called to notify the rtp_engine. More... | |
int | ast_rtp_engine_unregister (struct ast_rtp_engine *engine) |
Unregister an RTP engine. More... | |
void | ast_rtp_engine_unregister_srtp (void) |
int | ast_rtp_get_rate (const struct ast_format *format) |
Retrieve the sample rate of a format according to RTP specifications. More... | |
int | ast_rtp_glue_register2 (struct ast_rtp_glue *glue, struct ast_module *module) |
Register RTP glue. More... | |
int | ast_rtp_glue_unregister (struct ast_rtp_glue *glue) |
Unregister RTP glue. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_rtp_instance_bundle (struct ast_rtp_instance *child, struct ast_rtp_instance *parent) |
Request that an RTP instance be bundled with another. More... | |
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. More... | |
int | ast_rtp_instance_destroy (struct ast_rtp_instance *instance) |
Destroy an RTP instance. More... | |
void | ast_rtp_instance_drop_packets (struct ast_rtp_instance *instance, int num) |
Set the number of packets to drop on RTP read. More... | |
int | ast_rtp_instance_dtmf_begin (struct ast_rtp_instance *instance, char digit) |
Begin sending a DTMF digit. More... | |
int | ast_rtp_instance_dtmf_end (struct ast_rtp_instance *instance, char digit) |
Stop sending a DTMF digit. More... | |
int | ast_rtp_instance_dtmf_end_with_duration (struct ast_rtp_instance *instance, char digit, unsigned int duration) |
enum ast_rtp_dtmf_mode | ast_rtp_instance_dtmf_mode_get (struct ast_rtp_instance *instance) |
Get the DTMF mode of an RTP instance. More... | |
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. More... | |
int | ast_rtp_instance_early_bridge (struct ast_channel *c0, struct ast_channel *c1) |
Early bridge two channels that use RTP instances. More... | |
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. More... | |
void | ast_rtp_instance_extmap_clear (struct ast_rtp_instance *instance) |
Clear negotiated RTP extension information. More... | |
size_t | ast_rtp_instance_extmap_count (struct ast_rtp_instance *instance) |
Get the number of known unique identifiers. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_rtp_instance_extmap_get_id (struct ast_rtp_instance *instance, enum ast_rtp_extension extension) |
Retrieve the id for an RTP extension. More... | |
const char * | ast_rtp_instance_extmap_get_uri (struct ast_rtp_instance *instance, int id) |
Retrieve the URI for an RTP extension id. More... | |
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. More... | |
int | ast_rtp_instance_fd (struct ast_rtp_instance *instance, int rtcp) |
Get the file descriptor for an RTP session (or RTCP) More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
const char * | ast_rtp_instance_get_cname (struct ast_rtp_instance *rtp) |
Retrieve the CNAME used in RTCP SDES items. More... | |
struct ast_rtp_codecs * | ast_rtp_instance_get_codecs (struct ast_rtp_instance *instance) |
Get the codecs structure of an RTP instance. More... | |
void * | ast_rtp_instance_get_data (struct ast_rtp_instance *instance) |
Get the data portion of an RTP instance. More... | |
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. More... | |
struct ast_rtp_engine * | ast_rtp_instance_get_engine (struct ast_rtp_instance *instance) |
Get the RTP engine in use on an RTP instance. More... | |
void * | ast_rtp_instance_get_extended_prop (struct ast_rtp_instance *instance, int property) |
Get the value of an RTP instance extended property. More... | |
struct ast_rtp_glue * | ast_rtp_instance_get_glue (const char *type) |
Get the RTP glue that binds a channel to the RTP engine. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_rtp_instance_get_keepalive (struct ast_rtp_instance *instance) |
Get the RTP keepalive interval. More... | |
time_t | ast_rtp_instance_get_last_rx (const struct ast_rtp_instance *rtp) |
time_t | ast_rtp_instance_get_last_tx (const struct ast_rtp_instance *rtp) |
Get the last RTP transmission time. More... | |
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. More... | |
int | ast_rtp_instance_get_prop (struct ast_rtp_instance *instance, enum ast_rtp_property property) |
Get the value of an RTP instance property. More... | |
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. More... | |
size_t | ast_rtp_instance_get_recv_buffer_count (struct ast_rtp_instance *instance) |
Get the current size of the receive buffer. More... | |
size_t | ast_rtp_instance_get_recv_buffer_max (struct ast_rtp_instance *instance) |
Get the maximum size of the receive buffer. More... | |
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. More... | |
int | ast_rtp_instance_get_sdes_received (struct ast_rtp_instance *instance) |
Get the value of sdes_received on the test engine. More... | |
size_t | ast_rtp_instance_get_send_buffer_count (struct ast_rtp_instance *instance) |
Get the current size of the send buffer. More... | |
struct ast_srtp * | ast_rtp_instance_get_srtp (struct ast_rtp_instance *instance, int rtcp) |
Obtain the SRTP instance associated with an RTP instance. More... | |
unsigned int | ast_rtp_instance_get_ssrc (struct ast_rtp_instance *rtp) |
Retrieve the local SSRC value that we will be using. More... | |
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. More... | |
struct ast_json * | ast_rtp_instance_get_stats_all_json (struct ast_rtp_instance *instance) |
Retrieve statistics about an RTP instance in json format. More... | |
struct ast_rtp_engine_test * | ast_rtp_instance_get_test (struct ast_rtp_instance *instance) |
Obtain a pointer to the test callbacks on an RTP instance. More... | |
int | ast_rtp_instance_get_timeout (struct ast_rtp_instance *instance) |
Get the RTP timeout value. More... | |
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. More... | |
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. More... | |
void | ast_rtp_instance_queue_report (struct ast_rtp_instance *instance) |
Sends a SR/RR report the next time RTP would be sent. More... | |
struct ast_frame * | ast_rtp_instance_read (struct ast_rtp_instance *instance, int rtcp) |
Receive a frame over RTP. More... | |
void | ast_rtp_instance_reset_test_engine (struct ast_rtp_instance *instance) |
Resets all the fields to default values for the test engine. More... | |
int | ast_rtp_instance_sendcng (struct ast_rtp_instance *instance, int level) |
Send a comfort noise packet to the RTP instance. More... | |
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. More... | |
void | ast_rtp_instance_set_channel_id (struct ast_rtp_instance *instance, const char *uniqueid) |
Set the channel that owns this RTP instance. More... | |
void | ast_rtp_instance_set_data (struct ast_rtp_instance *instance, void *data) |
Set the data portion of an RTP instance. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ast_rtp_instance_set_keepalive (struct ast_rtp_instance *instance, int interval) |
Set the RTP keepalive interval. More... | |
void | ast_rtp_instance_set_last_rx (struct ast_rtp_instance *rtp, time_t time) |
Set the last RTP reception time. More... | |
void | ast_rtp_instance_set_last_tx (struct ast_rtp_instance *rtp, time_t time) |
Set the last RTP transmission time. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | ast_rtp_instance_set_remote_ssrc (struct ast_rtp_instance *rtp, unsigned int ssrc) |
Set the remote SSRC for an RTP instance. More... | |
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. More... | |
void | ast_rtp_instance_set_schedid (struct ast_rtp_instance *instance, int id) |
Set the schedid for RTCP. More... | |
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. More... | |
void | ast_rtp_instance_set_stream_num (struct ast_rtp_instance *rtp, int stream_num) |
Set the stream number for an RTP instance. More... | |
void | ast_rtp_instance_set_timeout (struct ast_rtp_instance *instance, int timeout) |
Set the RTP timeout value. More... | |
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. More... | |
void | ast_rtp_instance_stop (struct ast_rtp_instance *instance) |
Stop an RTP instance. More... | |
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. More... | |
void | ast_rtp_instance_update_source (struct ast_rtp_instance *instance) |
Indicate that the RTP marker bit should be set on an RTP stream. More... | |
int | ast_rtp_instance_write (struct ast_rtp_instance *instance, struct ast_frame *frame) |
Send a frame out over RTP. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_rtp_red_buffer (struct ast_rtp_instance *instance, struct ast_frame *frame) |
Buffer a frame in an RTP instance for RED. More... | |
int | ast_rtp_red_init (struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations) |
Initialize RED support on an RTP instance. More... | |
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. More... | |
struct stasis_topic * | ast_rtp_topic (void) |
Stasis Message Bus API topic for RTP and RTCP related messages More... | |
static int | find_static_payload_type (int asterisk_format, const struct ast_format *format, int code) |
static int | find_unused_payload (const struct ast_rtp_codecs *codecs) |
static int | find_unused_payload_in_range (const struct ast_rtp_codecs *codecs, int start, int end, struct ast_rtp_payload_type *ignore[]) |
static void | instance_destructor (void *obj) |
static void | payload_mapping_rx_clear_primary (struct ast_rtp_codecs *codecs, struct ast_rtp_payload_type *to_match) |
static int | payload_mapping_tx_is_present (const struct ast_rtp_codecs *codecs, const struct ast_rtp_payload_type *to_match) |
static void | rtcp_message_payload_dtor (void *obj) |
static struct ast_manager_event_blob * | rtcp_report_to_ami (struct stasis_message *msg) |
static struct ast_json * | rtcp_report_to_json (struct stasis_message *msg, const struct stasis_message_sanitizer *sanitize) |
static int | rtp_codecs_assign_payload_code_rx (struct ast_rtp_codecs *codecs, int asterisk_format, struct ast_format *format, int code, int explicit) |
static int | rtp_codecs_find_non_primary_dynamic_rx (struct ast_rtp_codecs *codecs) |
static void | rtp_codecs_payload_replace_rx (struct ast_rtp_codecs *codecs, int payload, struct ast_rtp_payload_type *new_type) |
static void | rtp_codecs_payloads_copy_rx (struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance) |
static void | rtp_codecs_payloads_copy_tx (struct ast_rtp_codecs *src, struct ast_rtp_codecs *dest, struct ast_rtp_instance *instance) |
static int | rtp_dtls_wrap_active (struct ast_rtp_instance *instance) |
static enum ast_rtp_dtls_connection | rtp_dtls_wrap_get_connection (struct ast_rtp_instance *instance) |
static const char * | rtp_dtls_wrap_get_fingerprint (struct ast_rtp_instance *instance) |
static enum ast_rtp_dtls_hash | rtp_dtls_wrap_get_fingerprint_hash (struct ast_rtp_instance *instance) |
static enum ast_rtp_dtls_setup | rtp_dtls_wrap_get_setup (struct ast_rtp_instance *instance) |
static void | rtp_dtls_wrap_reset (struct ast_rtp_instance *instance) |
static int | rtp_dtls_wrap_set_configuration (struct ast_rtp_instance *instance, const struct ast_rtp_dtls_cfg *dtls_cfg) |
static void | rtp_dtls_wrap_set_fingerprint (struct ast_rtp_instance *instance, enum ast_rtp_dtls_hash hash, const char *fingerprint) |
static void | rtp_dtls_wrap_set_setup (struct ast_rtp_instance *instance, enum ast_rtp_dtls_setup setup) |
static void | rtp_dtls_wrap_stop (struct ast_rtp_instance *instance) |
static void | rtp_engine_mime_type_cleanup (int i) |
static void | rtp_engine_shutdown (void) |
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. More... | |
static void | rtp_ice_wrap_add_remote_candidate (struct ast_rtp_instance *instance, const struct ast_rtp_engine_ice_candidate *candidate) |
static void | rtp_ice_wrap_change_components (struct ast_rtp_instance *instance, int num_components) |
static struct ao2_container * | rtp_ice_wrap_get_local_candidates (struct ast_rtp_instance *instance) |
static const char * | rtp_ice_wrap_get_password (struct ast_rtp_instance *instance) |
static const char * | rtp_ice_wrap_get_ufrag (struct ast_rtp_instance *instance) |
static void | rtp_ice_wrap_ice_lite (struct ast_rtp_instance *instance) |
static void | rtp_ice_wrap_set_authentication (struct ast_rtp_instance *instance, const char *ufrag, const char *password) |
static void | rtp_ice_wrap_set_role (struct ast_rtp_instance *instance, enum ast_rtp_ice_role role) |
static void | rtp_ice_wrap_start (struct ast_rtp_instance *instance) |
static void | rtp_ice_wrap_stop (struct ast_rtp_instance *instance) |
static void | rtp_ice_wrap_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) |
static void | rtp_instance_set_incoming_source_address_nolock (struct ast_rtp_instance *instance, const struct ast_sockaddr *address) |
static struct ast_rtp_payload_type * | rtp_payload_type_alloc (struct ast_format *format, int payload, int rtp_code, int primary_mapping) |
static void | rtp_payload_type_dtor (void *obj) |
static void | rtp_rtcp_report_dtor (void *obj) |
static void | set_next_mime_type (struct ast_format *format, int rtp_code, const char *type, const char *subtype, unsigned int sample_rate) |
static void | unref_instance_cond (struct ast_rtp_instance **instance) |
Conditionally unref an rtp instance. More... | |
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. More... | |
STASIS_MESSAGE_TYPE_DEFN (ast_rtp_rtcp_received_type,.to_ami=rtcp_report_to_ami,.to_json=rtcp_report_to_json,) | |
Pluggable RTP Architecture.
Definition in file rtp_engine.c.
#define MAX_RTP_MIME_TYPES 128 |
Definition at line 247 of file rtp_engine.c.
#define SET_AST_JSON_OBJ | ( | target, | |
name, | |||
obj | |||
) |
Set given json object into target with name.
target | Target json. |
name | key of given object. |
obj | Json value will be set. |
Definition at line 288 of file rtp_engine.c.
Referenced by ast_rtp_convert_stats_json().
|
static |
Definition at line 3183 of file rtp_engine.c.
References ao2_cleanup, ARRAY_LEN, ast_assert, ast_format_get_name(), ast_log, ast_option_rtpusedynamic, ast_rwlock_unlock, ast_rwlock_wrlock, find_unused_payload(), LOG_WARNING, NULL, ast_rtp_payload_type::payload, rtp_payload_type_alloc(), and type.
Referenced by ast_rtp_engine_init(), and ast_rtp_engine_load_format().
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.
codecs | Codecs structure to look in |
payload | The payload type format to look for |
Numerical | payload type or -1 if unable to find payload in codecs |
Example usage:
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 1975 of file rtp_engine.c.
References ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::payload, and type.
Referenced by bridge_p2p_rtp_write().
unsigned int ast_rtp_codecs_get_framing | ( | struct ast_rtp_codecs * | codecs | ) |
Get the framing used for a set of codecs.
codecs | Codecs structure to get the framing from |
The | framing to be used for the media stream associated with these codecs |
Definition at line 1569 of file rtp_engine.c.
References ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.
Referenced by ast_rtp_write(), create_outgoing_sdp_stream(), multicast_rtp_write(), native_rtp_bridge_compatible_check(), and process_sdp().
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.
codecs | Codecs structure to look in |
payload | Numerical payload to look up |
Payload | information. |
NULL | if payload does not exist. |
Example usage:
This looks up the information for payload '0' from the codecs structure.
Definition at line 1479 of file rtp_engine.c.
References ao2_bump, AST_RTP_MAX_PT, AST_RTP_PT_LAST_STATIC, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, NULL, and type.
Referenced by ast_rtp_interpret(), and bridge_p2p_rtp_write().
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.
codecs | Codecs structure to look in |
payload | Numerical payload type to look up |
pointer | to format structure on success |
NULL | on failure |
Definition at line 1537 of file rtp_engine.c.
References ao2_bump, AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, format, ast_rtp_payload_type::format, NULL, and type.
Referenced by get_codecs(), process_sdp_a_audio(), and process_sdp_a_video().
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.
codecs | Codecs structure to look in |
Definition at line 1460 of file rtp_engine.c.
References ast_format_get_type(), AST_MEDIA_TYPE_UNKNOWN, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, ast_rtp_payload_type::payload, and type.
Referenced by ast_rtp_read().
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.
codecs | Codecs structure to look in |
asterisk_format | Non-zero if the given Asterisk format is present |
format | Asterisk format to look for |
code | The format to look for |
Find the currently assigned rx mapped payload type based on whether it is an Asterisk format or non-format code. If one is currently not assigned then create a rx payload type mapping.
Numerical | payload type |
-1 | if could not assign. |
Example usage:
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 1873 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, ast_rtp_payload_type::payload, ast_rtp_payload_type::primary_mapping, ast_rtp_payload_type::rtp_code, rtp_codecs_assign_payload_code_rx(), and type.
Referenced by add_codec_to_sdp(), add_noncodec_to_sdp(), add_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), apply_cap_to_bundled(), create_outgoing_sdp_stream(), and jingle_add_payloads_to_description().
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.
codecs | Codecs structure to look in |
asterisk_format | Non-zero if the given Asterisk format is present |
format | Asterisk format to look for |
code | The format to look for |
Numerical | payload type |
-1 | if not found. |
Definition at line 1928 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, find_static_payload_type(), ast_rtp_payload_type::format, ast_rtp_payload_type::payload, ast_rtp_payload_type::rtp_code, and type.
Referenced by ast_rtp_dtmf_begin(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), multicast_rtp_write(), and send_start_rtp().
void ast_rtp_codecs_payload_formats | ( | struct ast_rtp_codecs * | codecs, |
struct ast_format_cap * | astformats, | ||
int * | nonastformats | ||
) |
Retrieve all formats that were found.
codecs | Codecs structure to look in |
astformats | A capabilities structure to put the Asterisk formats in. |
nonastformats | An integer to put the non-Asterisk formats in |
Example usage:
This retrieves all the formats known about in the codecs structure and puts the Asterisk ones in the integer pointed to by astformats and the non-Asterisk ones in the integer pointed to by nonastformats.
Definition at line 1580 of file rtp_engine.c.
References ast_format_cap_append, ast_format_cap_remove_by_type(), ast_format_cap_set_framing(), AST_MEDIA_TYPE_UNKNOWN, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, ast_rtp_codecs::framing, ast_rtp_payload_type::rtp_code, and type.
Referenced by jingle_interpret_description(), process_sdp(), set_caps(), and set_incoming_call_offer_cap().
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.
codecs | Codecs structure to operate on |
payload | Numerical payload type to look up |
format | The format to replace the existing one |
0 | success |
-1 | failure |
Definition at line 1503 of file rtp_engine.c.
References ao2_cleanup, ao2_ref, ast_rtp_engine_alloc_payload_type(), AST_RTP_MAX_PT, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, format, ast_rtp_payload_type::format, ast_rtp_payload_type::payload, payload_mapping_tx_is_present(), ast_rtp_payload_type::primary_mapping, and type.
Referenced by get_codecs(), process_sdp_a_audio(), and process_sdp_a_video().
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.
codecs | Codecs structure to manipulate |
code | The payload code |
format | Asterisk format |
0 | Payload was set to the given format |
-1 | Payload was in use or could not be set |
Definition at line 1923 of file rtp_engine.c.
References rtp_codecs_assign_payload_code_rx().
Referenced by apply_cap_to_bundled(), and create_outgoing_sdp_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.
codecs | The codecs structure that payloads will be cleared from |
instance | Optionally the instance that the codecs structure belongs to |
Example usage:
This clears the codecs structure and puts it into a pristine state.
Definition at line 994 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_codecs_payloads_destroy(), ast_rtp_codecs_payloads_initialize(), AST_RTP_MAX_PT, ast_rtp_instance::engine, NULL, and ast_rtp_engine::payload_set.
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.
src | The source codecs structure |
dest | The destination codecs structure that the values from src will be copied to |
instance | Optionally the instance that the dst codecs structure belongs to |
Example usage:
This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.
Definition at line 1224 of file rtp_engine.c.
References ao2_t_cleanup, ast_rwlock_tryrdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_codecs::framing, NULL, rtp_codecs_payloads_copy_rx(), rtp_codecs_payloads_copy_tx(), and type.
Referenced by jingle_interpret_description(), process_sdp(), set_caps(), and set_incoming_call_offer_cap().
void ast_rtp_codecs_payloads_destroy | ( | struct ast_rtp_codecs * | codecs | ) |
Destroy the contents of an RTP codecs structure (but not the structure itself)
codecs | The codecs structure to destroy the contents of |
Example usage:
Definition at line 974 of file rtp_engine.c.
References ao2_t_cleanup, ast_rwlock_destroy, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, and type.
Referenced by ast_rtp_codecs_payloads_clear(), ast_stream_free(), ast_stream_set_rtp_codecs(), instance_destructor(), jingle_interpret_description(), process_sdp(), set_caps(), and set_incoming_call_offer_cap().
int ast_rtp_codecs_payloads_initialize | ( | struct ast_rtp_codecs * | codecs | ) |
Initialize an RTP codecs structure.
codecs | The codecs structure to initialize |
0 | success |
-1 | failure |
Example usage:
Definition at line 958 of file rtp_engine.c.
References AST_RTP_MAX_PT, ast_rwlock_init, AST_VECTOR_FREE, AST_VECTOR_INIT, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.
Referenced by ast_rtp_codecs_payloads_clear(), ast_rtp_instance_new(), get_codecs(), jingle_interpret_description(), and process_sdp().
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.
codecs | The codecs structure to muck with |
instance | Optionally the instance that the codecs structure belongs to |
payload | Numerical payload that was seen in the m= SDP line |
Example usage:
This records that the numerical payload '0' was seen in the codecs structure.
Definition at line 1301 of file rtp_engine.c.
References ao2_bump, ao2_lock, ao2_ref, ao2_t_cleanup, ao2_unlock, ast_debug, AST_RTP_MAX_PT, AST_RTP_PT_LAST_STATIC, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, ast_rtp_payload_type::format, 10aedae86a32_add_outgoing_enum_va::new_type, payload_mapping_tx_is_present(), ast_rtp_engine::payload_set, and ast_rtp_payload_type::rtp_code.
Referenced by get_codecs(), and process_sdp().
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.
codecs | The codecs structure to muck with |
instance | Optionally the instance that the codecs structure belongs to |
payload | Numerical payload that was seen in the a=rtpmap: SDP line |
mimetype | The string mime type that was seen |
mimesubtype | The strin mime sub type that was seen |
options | Optional options that may change the behavior of this specific payload |
0 | success |
-1 | failure, invalid payload numbe |
-2 | failure, unknown mimetype |
Example usage:
This records that the numerical payload '0' was seen with mime type 'audio' and sub mime type 'PCMU' in the codecs structure.
Definition at line 1428 of file rtp_engine.c.
References ast_rtp_codecs_payloads_set_rtpmap_type_rate().
Referenced by configure_local_rtp(), jingle_interpret_description(), ooh323_set_write_format(), process_sdp(), and setup_rtp_connection().
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.
codecs | RTP structure to modify |
instance | Optionally the instance that the codecs structure belongs to |
pt | Payload type entry to modify |
mimetype | top-level MIME type of media stream (typically "audio", "video", "text", etc.) |
mimesubtype | MIME subtype of media stream (typically a codec name) |
options | Zero or more flags from the ast_rtp_options enum |
sample_rate | The sample rate of the media stream |
This function 'fills in' an entry in the list of possible formats for a media stream associated with an RTP structure.
0 | on success |
-1 | if the payload type is out of range |
-2 | if the mimeType/mimeSubtype combination was not found |
Definition at line 1343 of file rtp_engine.c.
References ao2_lock, ao2_ref, ao2_t_cleanup, ao2_unlock, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_g726, ast_format_g726_aal2, ast_format_parse_sdp_fmtp(), ast_rtp_engine_alloc_payload_type(), AST_RTP_MAX_PT, ast_rtp_mime_types, AST_RTP_OPT_G726_NONSTANDARD, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, ast_rtp_payload_type::format, mime_types_len, 10aedae86a32_add_outgoing_enum_va::new_type, ast_rtp_payload_type::payload, payload_mapping_tx_is_present(), ast_rtp_engine::payload_set, ast_rtp_mime_type::payload_type, ast_rtp_payload_type::primary_mapping, ast_rtp_payload_type::rtp_code, ast_rtp_mime_type::sample_rate, ast_rtp_mime_type::subtype, and ast_rtp_mime_type::type.
Referenced by ast_rtp_codecs_payloads_set_rtpmap_type(), get_codecs(), jingle_interpret_description(), process_sdp_a_audio(), process_sdp_a_text(), and process_sdp_a_video().
void ast_rtp_codecs_payloads_unset | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance, | ||
int | payload | ||
) |
Remove tx payload type mapped information.
codecs | The codecs structure to muck with |
instance | Optionally the instance that the codecs structure belongs to |
payload | Numerical payload to unset |
Example usage:
This clears the payload '0' from the codecs structure. It will be as if it was never set.
Definition at line 1433 of file rtp_engine.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_debug, AST_RTP_MAX_PT, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, NULL, ast_rtp_engine::payload_set, and type.
Referenced by process_sdp_a_audio(), and process_sdp_a_video().
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.
src | The source codecs structure |
dest | The destination codecs structure that the values from src will be copied to |
instance | Optionally the instance that the dst codecs structure belongs to |
Definition at line 1257 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_assert, ast_debug, ast_rwlock_tryrdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, ast_rtp_payload_type::format, ast_rtp_codecs::framing, ast_rtp_engine::payload_set, ast_rtp_payload_type::primary_mapping, ast_rtp_payload_type::rtp_code, rtp_codecs_payload_replace_rx(), and type.
Referenced by ast_rtp_instance_early_bridge_make_compatible(), process_sdp(), set_caps(), and set_incoming_call_offer_cap().
void ast_rtp_codecs_set_framing | ( | struct ast_rtp_codecs * | codecs, |
unsigned int | framing | ||
) |
Set the framing used for a set of codecs.
codecs | Codecs structure to set framing on |
framing | The framing value to set on the codecs |
Definition at line 1558 of file rtp_engine.c.
References ast_rwlock_unlock, ast_rwlock_wrlock, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.
Referenced by add_sdp(), check_peer_ok(), configure_local_rtp(), create_addr_from_peer(), get_codecs(), jingle_enable_video(), jingle_new(), process_sdp(), process_sdp_a_audio(), and start_rtp().
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.
src_cfg | source DTLS configuration structure |
dst_cfg | destination DTLS configuration structure |
Definition at line 3113 of file rtp_engine.c.
References ast_rtp_dtls_cfg_free(), ast_strdup, ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::cipher, ast_rtp_dtls_cfg::default_setup, ast_rtp_dtls_cfg::enabled, ast_rtp_dtls_cfg::ephemeral_cert, ast_rtp_dtls_cfg::hash, ast_rtp_dtls_cfg::pvtfile, ast_rtp_dtls_cfg::rekey, ast_rtp_dtls_cfg::suite, and ast_rtp_dtls_cfg::verify.
Referenced by build_peer(), check_peer_ok(), and create_addr_from_peer().
void ast_rtp_dtls_cfg_free | ( | struct ast_rtp_dtls_cfg * | dtls_cfg | ) |
Free contents of a DTLS configuration structure.
dtls_cfg | a DTLS configuration structure |
Definition at line 3131 of file rtp_engine.c.
References ast_free, ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::cipher, NULL, and ast_rtp_dtls_cfg::pvtfile.
Referenced by ast_rtp_dtls_cfg_copy(), build_peer(), media_configuration_destroy(), reload_config(), sip_destroy_peer(), sip_pvt_dtor(), and unload_module().
int ast_rtp_dtls_cfg_parse | ( | struct ast_rtp_dtls_cfg * | dtls_cfg, |
const char * | name, | ||
const char * | value | ||
) |
Parse DTLS related configuration options.
dtls_cfg | a DTLS configuration structure |
name | name of the configuration option |
value | value of the configuration option |
0 | if handled |
-1 | if not handled |
Definition at line 3020 of file rtp_engine.c.
References ast_file_is_readable(), ast_free, ast_log, AST_RTP_DTLS_HASH_SHA1, AST_RTP_DTLS_HASH_SHA256, AST_RTP_DTLS_SETUP_ACTIVE, AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_SETUP_PASSIVE, AST_RTP_DTLS_VERIFY_CERTIFICATE, AST_RTP_DTLS_VERIFY_FINGERPRINT, AST_RTP_DTLS_VERIFY_NONE, ast_strdup, ast_strlen_zero, ast_true(), ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::cipher, ast_rtp_dtls_cfg::default_setup, ast_rtp_dtls_cfg::enabled, ast_rtp_dtls_cfg::ephemeral_cert, ast_rtp_dtls_cfg::hash, LOG_ERROR, ast_rtp_dtls_cfg::pvtfile, ast_rtp_dtls_cfg::rekey, and ast_rtp_dtls_cfg::verify.
Referenced by build_peer(), dtls_handler(), media_encryption_handler(), and reload_config().
int ast_rtp_dtls_cfg_validate | ( | struct ast_rtp_dtls_cfg * | dtls_cfg | ) |
Validates DTLS related configuration options.
dtls_cfg | a DTLS configuration structure |
0 | if valid |
-1 | if invalid |
Definition at line 3094 of file rtp_engine.c.
References ast_log, ast_strlen_zero, ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::ephemeral_cert, LOG_ERROR, LOG_NOTICE, and ast_rtp_dtls_cfg::pvtfile.
Referenced by build_peer(), reload_config(), and sip_endpoint_apply_handler().
struct ast_rtp_payload_type* ast_rtp_engine_alloc_payload_type | ( | void | ) |
Allocation routine for ast_rtp_payload_type.
NULL | on error |
An | ao2 ref counted ast_rtp_payload_type on success. |
ast_rtp_payload_type
returned by this function is an ao2 ref counted object. Definition at line 325 of file rtp_engine.c.
References NULL, and rtp_payload_type_alloc().
Referenced by ast_rtp_codecs_payload_replace_format(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), and payload_mapping_rx_clear_primary().
int ast_rtp_engine_init | ( | void | ) |
initializes the rtp engine arrays
Definition at line 3622 of file rtp_engine.c.
References add_static_payload(), ast_debug_category_register(), ast_format_adpcm, ast_format_alaw, ast_format_g719, ast_format_g722, ast_format_g723, ast_format_g726, ast_format_g726_aal2, ast_format_g729, ast_format_gsm, ast_format_h261, ast_format_h263, ast_format_h263p, ast_format_h264, ast_format_h265, ast_format_ilbc, ast_format_jpeg, ast_format_lpc10, ast_format_mp4, ast_format_opus, ast_format_png, ast_format_siren14, ast_format_siren7, ast_format_slin, ast_format_slin12, ast_format_slin16, ast_format_slin192, ast_format_slin24, ast_format_slin32, ast_format_slin44, ast_format_slin48, ast_format_slin96, ast_format_speex, ast_format_speex16, ast_format_speex32, ast_format_t140, ast_format_t140_red, ast_format_ulaw, ast_format_vp8, ast_format_vp9, AST_LOG_CATEGORY_DTLS, AST_LOG_CATEGORY_DTLS_PACKET, AST_LOG_CATEGORY_ICE, AST_LOG_CATEGORY_RTCP, AST_LOG_CATEGORY_RTCP_PACKET, AST_LOG_CATEGORY_RTP, AST_LOG_CATEGORY_RTP_PACKET, ast_register_cleanup(), AST_RTP_CISCO_DTMF, AST_RTP_CN, AST_RTP_DTMF, ast_rtp_rtcp_received_type(), ast_rtp_rtcp_sent_type(), ast_rwlock_init, debug_category_dtls_id, debug_category_dtls_packet_id, debug_category_ice_id, debug_category_rtcp_id, debug_category_rtcp_packet_id, debug_category_rtp_id, debug_category_rtp_packet_id, NULL, rtp_engine_shutdown(), set_next_mime_type(), STASIS_MESSAGE_TYPE_INIT, and stasis_topic_create().
Referenced by asterisk_daemon().
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 mime type can payload number can be initialized.
Definition at line 3229 of file rtp_engine.c.
References add_static_payload(), ast_codec_media_type2str(), ast_format_get_codec_name(), ast_format_get_sample_rate(), ast_format_get_type(), ast_str_to_upper(), ast_strdupa, and set_next_mime_type().
Referenced by load_module().
int ast_rtp_engine_register2 | ( | struct ast_rtp_engine * | engine, |
struct ast_module * | module | ||
) |
Register an RTP engine.
engine | Structure of the RTP engine to register |
module | Module that the RTP engine is part of |
0 | success |
-1 | failure |
Example usage:
This registers the RTP engine declared as example_rtp_engine with the RTP engine core, but does not associate a module with it.
Definition at line 330 of file rtp_engine.c.
References ast_log, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero, ast_verb, ast_rtp_engine::destroy, LOG_WARNING, ast_rtp_engine::mod, ast_rtp_engine::name, ast_rtp_engine::new, ast_rtp_engine::read, and ast_rtp_engine::write.
int ast_rtp_engine_register_srtp | ( | struct ast_srtp_res * | srtp_res, |
struct ast_srtp_policy_res * | policy_res | ||
) |
Definition at line 2710 of file rtp_engine.c.
References policy_res, and srtp_res.
Referenced by res_srtp_init().
int ast_rtp_engine_srtp_is_registered | ( | void | ) |
Definition at line 2731 of file rtp_engine.c.
References res_srtp_policy.
Referenced by ast_sdp_srtp_alloc(), and dialog_initialize_dtls_srtp().
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 order for the rtp engine to handle it correctly. If an attribute interface is unloaded, this function must be called to notify the rtp_engine.
Definition at line 3245 of file rtp_engine.c.
References ao2_ref, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_RTP_MAX_PT, ast_rtp_mime_types, ast_rwlock_unlock, ast_rwlock_wrlock, mime_types_len, NULL, and rtp_engine_mime_type_cleanup().
Referenced by unload_module().
int ast_rtp_engine_unregister | ( | struct ast_rtp_engine * | engine | ) |
Unregister an RTP engine.
engine | Structure of the RTP engine to unregister |
0 | success |
-1 | failure |
Example usage:
This unregisters the RTP engine declared as example_rtp_engine from the RTP engine core. If a module reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
Definition at line 364 of file rtp_engine.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_rtp_engine::name, and NULL.
Referenced by AST_TEST_DEFINE(), load_module(), and unload_module().
void ast_rtp_engine_unregister_srtp | ( | void | ) |
int ast_rtp_glue_register2 | ( | struct ast_rtp_glue * | glue, |
struct ast_module * | module | ||
) |
Register RTP glue.
glue | The glue to register |
module | Module that the RTP glue is part of |
0 | success |
-1 | failure |
Example usage:
This registers the RTP glue declared as example_rtp_glue with the RTP engine core, but does not associate a module with it.
Definition at line 379 of file rtp_engine.c.
References ast_log, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero, ast_verb, LOG_WARNING, ast_rtp_glue::mod, NULL, and ast_rtp_glue::type.
int ast_rtp_glue_unregister | ( | struct ast_rtp_glue * | glue | ) |
Unregister RTP glue.
glue | The glue to unregister |
0 | success |
-1 | failure |
Example usage:
This unregisters the RTP glue declared as example_rtp_gkue from the RTP engine core. If a module reference was provided when it was registered then this will only be called once the RTP engine is no longer in use.
Definition at line 408 of file rtp_engine.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, NULL, and ast_rtp_glue::type.
Referenced by load_module(), and unload_module().
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.
instance | The RTP instance |
0 | success |
-1 | failure |
Example usage:
This tells the underlying RTP engine of instance that packets will now flow.
Definition at line 2647 of file rtp_engine.c.
References ast_rtp_engine::activate, ao2_lock, ao2_unlock, and ast_rtp_instance::engine.
Referenced by apply_negotiated_sdp_stream(), handle_response_invite(), rtp_call(), test_init_rtp_instances(), and transmit_response_with_sdp().
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.
instance | the RTP instance |
remote_policy | the remote endpoint's policy |
local_policy | our policy for this RTP instance's remote endpoint |
rtcp | 1 for dedicated RTCP policies |
0 | Success |
non-zero | Failure |
Definition at line 2736 of file rtp_engine.c.
References ast_srtp_res::add_stream, ao2_lock, ao2_unlock, ast_srtp_res::create, ast_srtp_res::replace, ast_rtp_instance::rtcp_srtp, and ast_rtp_instance::srtp.
Referenced by crypto_activate(), and rtcp_debug_test_addr().
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.
instance | The RTP instance |
to_endpoint | Formats being sent/received towards the endpoint |
to_asterisk | Formats being sent/received towards Asterisk |
result | capabilities structure to store and return supported formats in. |
Example usage:
This sees if it is possible to have ulaw communicated to the endpoint but signed linear received into Asterisk.
Definition at line 2633 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_format_cap_count(), ast_translate_available_formats(), ast_rtp_engine::available_formats, and ast_rtp_instance::engine.
Referenced by sip_call().
int ast_rtp_instance_bundle | ( | struct ast_rtp_instance * | child, |
struct ast_rtp_instance * | parent | ||
) |
Request that an RTP instance be bundled with another.
child | The child RTP instance |
parent | The parent RTP instance the child should be bundled with |
0 | success |
-1 | failure |
Definition at line 3804 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::bundle, and ast_rtp_instance::engine.
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
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.
instance | Instance that the new media source is feeding into |
Example usage:
This indicates that the source of media that is feeding the instance pointed to by instance has changed and that the marker bit should be set and the SSRC updated.
Definition at line 2160 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::change_source, and ast_rtp_instance::engine.
Referenced by create_outgoing_sdp_stream(), jingle_indicate(), mgcp_indicate(), ooh323_indicate(), sip_indicate(), skinny_indicate(), and unistim_indicate().
int ast_rtp_instance_destroy | ( | struct ast_rtp_instance * | instance | ) |
Destroy an RTP instance.
instance | The RTP instance to destroy |
0 | success |
-1 | failure |
Example usage:
This destroys the RTP instance pointed to by instance. Once this function returns instance no longer points to valid memory and may not be used again.
Definition at line 458 of file rtp_engine.c.
References ao2_cleanup.
Referenced by AST_TEST_DEFINE(), destroy_endpoint(), destroy_rtp(), dialog_clean_rtp(), jingle_session_destructor(), mgcp_hangup(), multicast_rtp_request(), ooh323_destroy(), rtp_hangup(), sip_new(), start_rtp(), stream_destroy(), unalloc_sub(), unicast_rtp_request(), and unistim_hangup_clean().
int ast_rtp_instance_dtmf_begin | ( | struct ast_rtp_instance * | instance, |
char | digit | ||
) |
Begin sending a DTMF digit.
instance | The RTP instance to send the DTMF on |
digit | What DTMF digit to send |
0 | success |
-1 | failure |
Example usage:
This starts sending the DTMF '1' on the RTP instance pointed to by instance. It will continue being sent until it is ended.
Definition at line 2081 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::dtmf_begin, and ast_rtp_instance::engine.
Referenced by chan_pjsip_digit_begin(), jingle_digit_begin(), mgcp_senddigit_begin(), ooh323_digit_begin(), and sip_senddigit_begin().
int ast_rtp_instance_dtmf_end | ( | struct ast_rtp_instance * | instance, |
char | digit | ||
) |
Stop sending a DTMF digit.
instance | The RTP instance to stop the DTMF on |
digit | What DTMF digit to stop |
0 | success |
-1 | failure |
Example usage:
This stops sending the DTMF '1' on the RTP instance pointed to by instance.
Definition at line 2095 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::dtmf_end, and ast_rtp_instance::engine.
Referenced by mgcp_senddigit_end(), and ooh323_digit_end().
int ast_rtp_instance_dtmf_end_with_duration | ( | struct ast_rtp_instance * | instance, |
char | digit, | ||
unsigned int | duration | ||
) |
Definition at line 2109 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::dtmf_end_with_duration, and ast_rtp_instance::engine.
Referenced by chan_pjsip_digit_end(), jingle_digit_end(), and sip_senddigit_end().
enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get | ( | struct ast_rtp_instance * | instance | ) |
Get the DTMF mode of an RTP instance.
instance | The RTP instance to get the DTMF mode of |
DTMF | mode |
Example usage:
This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
Definition at line 2137 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::dtmf_mode_get, and ast_rtp_instance::engine.
Referenced by chan_pjsip_digit_begin(), chan_pjsip_digit_end(), native_rtp_bridge_compatible_check(), pjsip_acf_dtmf_mode_write(), and set_caps().
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.
instance | the RTP instance to set DTMF mode on |
dtmf_mode | The DTMF mode that is in use |
0 | success |
-1 | failure |
Example usage:
This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.
Definition at line 2123 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::dtmf_mode_set, and ast_rtp_instance::engine.
Referenced by create_rtp(), enable_dsp_detect(), get_codecs(), pjsip_acf_dtmf_mode_write(), and sip_new().
int ast_rtp_instance_early_bridge | ( | struct ast_channel * | c0, |
struct ast_channel * | c1 | ||
) |
Early bridge two channels that use RTP instances.
c0 | First channel part of the bridge |
c1 | Second channel part of the bridge |
0 | success |
-1 | failure |
Definition at line 2337 of file rtp_engine.c.
References ao2_cleanup, ast_channel_lock_both, ast_channel_name(), ast_channel_tech(), ast_channel_unlock, ast_debug, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_iscompatible(), ast_log, AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_REMOTE, ast_rtp_instance_get_glue(), done, ast_rtp_glue::get_codec, ast_rtp_glue::get_rtp_info, ast_rtp_glue::get_vrtp_info, LOG_WARNING, NULL, type, unref_instance_cond(), and ast_rtp_glue::update_peer.
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.
c_dst | Destination channel to copy to |
c_src | Source channel to copy from |
Definition at line 2251 of file rtp_engine.c.
References ao2_cleanup, ast_channel_lock_both, ast_channel_name(), ast_channel_tech(), ast_channel_unlock, ast_debug, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_iscompatible(), ast_log, ast_rtp_codecs_payloads_xover(), AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_REMOTE, ast_rtp_instance_get_glue(), ast_rtp_instance::codecs, done, ast_rtp_glue::get_codec, ast_rtp_glue::get_rtp_info, ast_rtp_glue::get_vrtp_info, LOG_WARNING, NULL, type, unref_instance_cond(), and ast_rtp_glue::update_peer.
Referenced by dial_exec_full(), and do_forward().
void ast_rtp_instance_extmap_clear | ( | struct ast_rtp_instance * | instance | ) |
Clear negotiated RTP extension information.
instance | The RTP instance to clear negotiated extension information on |
Definition at line 862 of file rtp_engine.c.
References ao2_lock, ao2_unlock, AST_RTP_EXTENSION_DIRECTION_NONE, AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, and rtp_extmap::extension.
Referenced by process_extmap_attributes().
size_t ast_rtp_instance_extmap_count | ( | struct ast_rtp_instance * | instance | ) |
Get the number of known unique identifiers.
instance | The RTP instance to retrieve the count from |
Definition at line 899 of file rtp_engine.c.
References ao2_lock, ao2_unlock, and AST_VECTOR_SIZE.
Referenced by add_extmap_to_stream(), and enable_rtp_extension().
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.
instance | The RTP instance to enable the extension on |
id | The unique local identifier to use for this extension (-1 to have one auto selected) |
extension | The RTP extension |
direction | The initial direction that the RTP extension should be used in |
0 | success |
-1 | failure |
Definition at line 732 of file rtp_engine.c.
References ao2_lock, ao2_unlock, AST_RTP_EXTENSION_DIRECTION_NONE, AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_APPEND, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, rtp_extmap::direction, ast_rtp_instance::engine, rtp_extmap::extension, and ast_rtp_engine::extension_enable.
Referenced by enable_rtp_extension().
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.
instance | The RTP instance to retrieve the direction from |
id | The negotiated RTP extension id |
direction | the direction that has been negotiated |
Definition at line 930 of file rtp_engine.c.
References ao2_lock, ao2_unlock, AST_RTP_EXTENSION_DIRECTION_NONE, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, and rtp_extmap::direction.
Referenced by add_extmap_to_stream().
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.
instance | The RTP instance to retrieve the extension from |
id | The negotiated RTP extension id |
extension | the extension that maps to the id |
Definition at line 910 of file rtp_engine.c.
References ao2_lock, ao2_unlock, AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, and rtp_extmap::extension.
Referenced by add_extmap_to_stream(), and ast_rtp_instance_extmap_get_uri().
int ast_rtp_instance_extmap_get_id | ( | struct ast_rtp_instance * | instance, |
enum ast_rtp_extension | extension | ||
) |
Retrieve the id for an RTP extension.
instance | The RTP instance to retrieve the id from |
extension | The RTP extension |
-1 | not negotiated |
id | if negotiated |
Definition at line 886 of file rtp_engine.c.
References ao2_lock, ao2_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, and id.
Referenced by ast_rtp_rtcp_handle_nack(), enable_rtp_extension(), rtp_instance_parse_extmap_extensions(), and rtp_raw_write().
const char* ast_rtp_instance_extmap_get_uri | ( | struct ast_rtp_instance * | instance, |
int | id | ||
) |
Retrieve the URI for an RTP extension id.
instance | The RTP instance to retrieve the direction from |
id | The negotiated RTP extension id |
uri | The URI for the RTP extension |
Definition at line 946 of file rtp_engine.c.
References ARRAY_LEN, AST_RTP_EXTENSION_UNSUPPORTED, ast_rtp_instance_extmap_get_extension(), rtp_extmap::extension, NULL, and rtp_extension_uris.
Referenced by add_extmap_to_stream().
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.
instance | The RTP instance to set the extension on |
id | The local identifier for the extension |
direction | The direction that the extension should be used in |
uri | The unique URI for the extension |
attributes | Attributes specific to this extension (if NULL or empty then no attributes) |
0 | success |
-1 | failure |
Definition at line 818 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ARRAY_LEN, AST_RTP_EXTENSION_DIRECTION_NONE, AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, rtp_extmap::direction, rtp_extmap::extension, rtp_extension_uris, and rtp_extmap_negotiate_direction().
Referenced by process_extmap_attributes().
int ast_rtp_instance_fd | ( | struct ast_rtp_instance * | instance, |
int | rtcp | ||
) |
Get the file descriptor for an RTP session (or RTCP)
instance | Instance to get the file descriptor for |
rtcp | Whether to retrieve the file descriptor for RTCP or not |
fd | success |
-1 | failure |
Example usage:
This retrieves the file descriptor for the socket carrying media on the instance pointed to by instance.
Definition at line 2192 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_instance::engine, and ast_rtp_engine::fd.
Referenced by apply_negotiated_sdp_stream(), check_for_rtp_changes(), configure_local_rtp(), configure_rtcp(), jingle_enable_video(), jingle_new(), mgcp_new(), rtp_find_rtcp_fd_position(), sip_new(), sip_set_rtp_peer(), skinny_new(), start_rtp(), transmit_reinvite_with_sdp(), unicast_rtp_request(), and unistim_new().
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.
instance | The RTP instance |
pointer | to the glue |
Example:
This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
Definition at line 2705 of file rtp_engine.c.
References ast_rtp_instance::glue.
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.
instance | The instance that we want to get the local address for |
address | An initialized address that may be overwritten if the local address is different |
0 | address was not changed |
1 | address was changed Example usage: |
This retrieves the current local address set on the instance pointed to by instance and puts the value into the address structure.
Definition at line 629 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::local_address.
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.
instance | The instance that we want to get the remote address for |
address | An initialized address that may be overwritten addresses differ |
0 | address was not changed |
1 | address was changed |
Definition at line 651 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::requested_target_address.
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.
instance | The RTP instance that we want |
non-NULL | success |
NULL | failure |
Example usage:
This gets the RTP instance that instance0 is bridged to.
Definition at line 2234 of file rtp_engine.c.
References ao2_lock, ao2_unlock, and ast_rtp_instance::bridged.
Referenced by ast_rtp_interpret(), and dialog_needdestroy().
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.
Note that this should remain valid for the lifetime of the RTP instance.
instance | The RTP instance |
The | unique ID of the channel |
Empty | string if no channel owns this RTP instance |
Definition at line 548 of file rtp_engine.c.
References ast_rtp_instance::channel_uniqueid.
Referenced by ast_rtp_get_stat(), rtp_check_timeout(), and rtp_transport_wide_cc_feedback_produce().
const char* ast_rtp_instance_get_cname | ( | struct ast_rtp_instance * | rtp | ) |
Retrieve the CNAME used in RTCP SDES items.
This is a pointer directly into the RTP struct, not a copy.
rtp | The RTP instance |
Definition at line 3791 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_engine::cname_get, and ast_rtp_instance::engine.
Referenced by add_ssrc_to_stream().
struct ast_rtp_codecs* ast_rtp_instance_get_codecs | ( | struct ast_rtp_instance * | instance | ) |
Get the codecs structure of an RTP instance.
instance | The RTP instance to get the codecs structure from |
Example usage:
This gets the codecs structure on the RTP instance pointed to by 'instance'.
Definition at line 727 of file rtp_engine.c.
References ast_rtp_instance::codecs.
Referenced by add_codec_to_sdp(), add_noncodec_to_sdp(), add_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), apply_cap_to_bundled(), ast_rtp_dtmf_begin(), ast_rtp_interpret(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), check_peer_ok(), configure_local_rtp(), create_addr_from_peer(), create_outgoing_sdp_stream(), jingle_add_payloads_to_description(), jingle_enable_video(), jingle_interpret_description(), jingle_new(), multicast_rtp_write(), native_rtp_bridge_compatible_check(), ooh323_set_write_format(), process_sdp(), send_start_rtp(), set_caps(), set_incoming_call_offer_cap(), setup_rtp_connection(), and start_rtp().
void* ast_rtp_instance_get_data | ( | struct ast_rtp_instance * | instance | ) |
Get the data portion of an RTP instance.
instance | The RTP instance we want the data portion from |
Example usage:
This gets the data pointer on the RTP instance pointed to by 'instance'.
Definition at line 563 of file rtp_engine.c.
References ast_rtp_instance::data.
Referenced by __rtp_recvfrom(), __rtp_sendto(), ast_rtcp_calculate_sr_rr_statistics(), ast_rtcp_generate_nack(), ast_rtcp_generate_report(), ast_rtcp_generate_sdes(), ast_rtcp_interpret(), ast_rtcp_read(), ast_rtcp_write(), ast_rtp_bundle(), ast_rtp_change_source(), ast_rtp_destroy(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_continuation(), ast_rtp_dtmf_end_with_duration(), ast_rtp_dtmf_mode_get(), ast_rtp_dtmf_mode_set(), ast_rtp_fd(), ast_rtp_get_cname(), ast_rtp_get_ssrc(), ast_rtp_get_stat(), ast_rtp_ice_add_remote_candidate(), ast_rtp_ice_change_components(), ast_rtp_ice_get_local_candidates(), ast_rtp_ice_get_password(), ast_rtp_ice_get_ufrag(), ast_rtp_ice_lite(), ast_rtp_ice_set_authentication(), ast_rtp_ice_set_role(), ast_rtp_ice_start(), ast_rtp_ice_start_media(), ast_rtp_ice_stop(), ast_rtp_ice_turn_request(), ast_rtp_interpret(), ast_rtp_local_bridge(), ast_rtp_on_ice_rx_data(), ast_rtp_on_ice_tx_pkt(), ast_rtp_on_turn_rtcp_state(), ast_rtp_on_turn_rtp_state(), ast_rtp_on_turn_rx_rtcp_data(), ast_rtp_on_turn_rx_rtp_data(), ast_rtp_prop_set(), ast_rtp_qos_set(), ast_rtp_read(), ast_rtp_remote_address_set(), ast_rtp_rtcp_handle_nack(), ast_rtp_sendcng(), ast_rtp_set_remote_ssrc(), ast_rtp_set_stream_num(), ast_rtp_stop(), ast_rtp_stun_request(), ast_rtp_update_source(), ast_rtp_write(), bridge_p2p_rtp_write(), create_dtmf_frame(), get_recv_buffer_count(), get_recv_buffer_max(), get_send_buffer_count(), ice_create(), ice_reset_session(), multicast_rtp_activate(), multicast_rtp_destroy(), multicast_rtp_write(), process_cn_rfc3389(), process_dtmf_cisco(), process_dtmf_rfc2833(), red_write(), rtcp_debug_test_addr(), rtp_instance_parse_transport_wide_cc(), rtp_raw_write(), rtp_red_buffer(), rtp_red_init(), rtp_sendto(), rtp_transport_wide_cc_feedback_produce(), set_rtp_rtcp_schedid(), and test_sip_rtpqos_1_get_stat().
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.
instance | the RTP instance |
DTLS | support if present |
NULL | if no DTLS support available |
Definition at line 3011 of file rtp_engine.c.
References ast_rtp_engine::dtls, ast_rtp_instance::engine, NULL, and rtp_dtls_wrappers.
Referenced by add_crypto_to_stream(), add_dtls_to_sdp(), apply_dtls_attrib(), ast_sdp_get_rtp_profile(), dialog_initialize_dtls_srtp(), process_crypto(), process_sdp(), process_sdp_a_dtls(), and setup_dtls_srtp().
struct ast_rtp_engine* ast_rtp_instance_get_engine | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP engine in use on an RTP instance.
instance | The RTP instance |
pointer | to the engine |
Example usage:
This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
Definition at line 2700 of file rtp_engine.c.
References ast_rtp_instance::engine.
Referenced by native_rtp_bridge_compatible_check(), native_rtp_bridge_start(), and native_rtp_bridge_stop().
void* ast_rtp_instance_get_extended_prop | ( | struct ast_rtp_instance * | instance, |
int | property | ||
) |
Get the value of an RTP instance extended property.
instance | The RTP instance to get the extended property on |
property | The extended property to get |
Definition at line 690 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_rtp_instance::engine, ast_rtp_engine::extended_prop_get, and NULL.
struct ast_rtp_glue* ast_rtp_instance_get_glue | ( | const char * | type | ) |
Get the RTP glue that binds a channel to the RTP engine.
type | Name of the glue we want |
non-NULL | success |
NULL | failure |
Example usage:
This retrieves the RTP glue that has the name 'Example'.
Definition at line 2206 of file rtp_engine.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, NULL, and ast_rtp_glue::type.
Referenced by ast_ari_channels_rtpstatistics(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_rtp_instance_make_compatible(), and rtp_glue_data_get().
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.
instance | The RTP instance |
timeout | value |
Example usage:
This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
Definition at line 2690 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout.
Referenced by check_rtp_timeout().
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.
instance | the RTP instance |
ICE | support if present |
NULL | if no ICE support available |
Definition at line 2891 of file rtp_engine.c.
References ast_rtp_instance::engine, ast_rtp_engine::ice, NULL, and rtp_ice_wrappers.
Referenced by add_ice_to_sdp(), add_ice_to_stream(), check_ice_support(), create_rtp(), dialog_initialize_rtp(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_enable_video(), jingle_interpret_google_transport(), jingle_interpret_ice_udp_transport(), jingle_new(), jingle_outgoing_hook(), jingle_request(), process_ice_attributes(), process_ice_auth_attrb(), process_sdp_a_ice(), set_ice_components(), and start_ice().
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.
This returns the remote address the engine is sending RTP to. Usually this will be the same as the requested target address, however in the case where the engine "learns" the address (for instance, symmetric RTP enabled) this will then contain the learned address.
instance | The instance that we want to get the incoming source address for |
address | A structure to put the address into |
Definition at line 665 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_sockaddr_copy(), and ast_rtp_instance::incoming_source_address.
int ast_rtp_instance_get_keepalive | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP keepalive interval.
instance | The RTP instance |
period | Keepalive interval value |
Example usage:
This gets the RTP keepalive interval value for the RTP instance pointed to by 'instance'.
Definition at line 2695 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
Referenced by check_rtp_timeout(), and send_keepalive().
time_t ast_rtp_instance_get_last_rx | ( | const struct ast_rtp_instance * | rtp | ) |
Definition at line 3768 of file rtp_engine.c.
References ast_rtp_instance::last_rx.
Referenced by rtp_check_timeout().
time_t ast_rtp_instance_get_last_tx | ( | const struct ast_rtp_instance * | rtp | ) |
Get the last RTP transmission time.
rtp | The instance from which to get the last transmission time |
Definition at line 3758 of file rtp_engine.c.
References ast_rtp_instance::last_tx.
Referenced by send_keepalive().
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.
instance | The RTP instance to get the address from |
address | The variable to store the address in |
Example usage:
This gets the local address that we are expecting RTP on and stores it in the 'address' structure.
Definition at line 643 of file rtp_engine.c.
References ao2_lock, ao2_unlock, ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by add_sdp(), ast_rtp_ice_turn_request(), ast_rtp_prop_set(), ast_rtp_remote_address_set(), channel_read_rtp(), configure_local_rtp(), create_outgoing_sdp_stream(), get_our_media_address(), handle_open_receive_channel_ack_message(), multicast_send_control_packet(), send_start_rtp(), sip_acf_channel_read(), sip_allow_anyrtp_remote(), skinny_set_rtp_peer(), test_init_rtp_instances(), unicast_rtp_request(), and unistim_set_rtp_peer().
int ast_rtp_instance_get_prop | ( | struct ast_rtp_instance * | instance, |
enum ast_rtp_property | property | ||
) |
Get the value of an RTP instance property.
instance | The RTP instance to get the property from |
property | The property to get |
Current | value of the property |
Example usage:
This returns the current value of the NAT property on the instance pointed to by instance.
Definition at line 716 of file rtp_engine.c.
References ao2_lock, ao2_unlock, and ast_rtp_instance::properties.
Referenced by ast_rtcp_interpret(), ast_rtp_dtmf_compatible(), ast_rtp_read(), bridge_p2p_rtp_write(), process_dtmf_cisco(), process_dtmf_rfc2833(), rtp_raw_write(), and rtp_write_rtcp_psfb().
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.
instance | Instance to get statistics on |
field | What quality statistic to retrieve |
buf | What buffer to put the result into |
size | Size of the above buffer |
non-NULL | success |
NULL | failure |
Example usage:
This retrieves general quality statistics and places a text representation into the buf pointed to by buf.
Definition at line 2460 of file rtp_engine.c.
References ast_rtp_instance_get_stats(), AST_RTP_INSTANCE_STAT_ALL, AST_RTP_INSTANCE_STAT_COMBINED_JITTER, AST_RTP_INSTANCE_STAT_COMBINED_LOSS, AST_RTP_INSTANCE_STAT_COMBINED_RTT, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, buf, ast_rtp_instance_stats::local_maxjitter, ast_rtp_instance_stats::local_maxrxploss, ast_rtp_instance_stats::local_minjitter, ast_rtp_instance_stats::local_minrxploss, ast_rtp_instance_stats::local_normdevjitter, ast_rtp_instance_stats::local_normdevrxploss, ast_rtp_instance_stats::local_ssrc, ast_rtp_instance_stats::local_stdevjitter, ast_rtp_instance_stats::local_stdevrxploss, ast_rtp_instance_stats::maxrtt, ast_rtp_instance_stats::minrtt, ast_rtp_instance_stats::normdevrtt, NULL, ast_rtp_instance_stats::remote_maxjitter, ast_rtp_instance_stats::remote_maxrxploss, ast_rtp_instance_stats::remote_minjitter, ast_rtp_instance_stats::remote_minrxploss, ast_rtp_instance_stats::remote_normdevjitter, ast_rtp_instance_stats::remote_normdevrxploss, ast_rtp_instance_stats::remote_ssrc, ast_rtp_instance_stats::remote_stdevjitter, ast_rtp_instance_stats::remote_stdevrxploss, ast_rtp_instance_stats::rtt, ast_rtp_instance_stats::rxcount, ast_rtp_instance_stats::rxjitter, ast_rtp_instance_stats::rxploss, ast_rtp_instance_stats::stdevrtt, ast_rtp_instance_stats::txcount, ast_rtp_insta