Asterisk - The Open Source Telephony Project
21.4.1
|
Pluggable RTP Architecture. More...
#include "asterisk.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... | |
struct ast_format * | ast_rtp_codecs_get_preferred_format (struct ast_rtp_codecs *codecs) |
Retrieve rx preferred format. 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_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 rate. 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... | |
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. 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... | |
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. 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... | |
int | ast_rtp_codecs_set_preferred_format (struct ast_rtp_codecs *codecs, struct ast_format *format) |
Set the preferred format. 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 | |
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. | |
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. | |
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... | |
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) |
Get the last RTP reception time. More... | |
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... | |
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... | |
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... | |
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... | |
struct ast_frame * | ast_rtp_instance_read (struct ast_rtp_instance *instance, int rtcp) |
Receive a frame over RTP. 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_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, unsigned int sample_rate) |
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_payload_set_rx (struct ast_rtp_codecs *codecs, int payload, struct ast_rtp_payload_type *new_type, int replace) |
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_atexit (void) |
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. | |
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, unsigned int sample_rate) |
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. | |
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. | |
STASIS_MESSAGE_TYPE_DEFN (ast_rtp_rtcp_received_type,.to_ami=rtcp_report_to_ami,.to_json=rtcp_report_to_json,) | |
Variables | |
static struct ast_rtp_mime_type | ast_rtp_mime_types [128] |
static uintmax_t | debug_category_dtls_id |
static uintmax_t | debug_category_dtls_packet_id |
static uintmax_t | debug_category_ice_id |
static uintmax_t | debug_category_rtcp_id |
static uintmax_t | debug_category_rtcp_packet_id |
static uintmax_t | debug_category_rtp_id |
static uintmax_t | debug_category_rtp_packet_id |
static struct engines | engines = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static struct glues | glues = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static int | mime_types_len = 0 |
static ast_rwlock_t | mime_types_lock |
struct ast_srtp_res * | res_srtp = NULL |
struct ast_srtp_policy_res * | res_srtp_policy = NULL |
static struct ast_rtp_engine_dtls | rtp_dtls_wrappers |
static const char *const | rtp_extension_uris [AST_RTP_EXTENSION_MAX] |
URIs for known RTP extensions. More... | |
static struct ast_rtp_engine_ice | rtp_ice_wrappers |
static struct stasis_topic * | rtp_topic |
Stasis Message Bus API topic for RTP related messages | |
static struct ast_rtp_payload_type * | static_RTP_PT [AST_RTP_MAX_PT] |
Mapping between Asterisk codecs and rtp payload types. More... | |
static ast_rwlock_t | static_RTP_PT_lock |
Pluggable RTP Architecture.
Definition in 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 287 of file rtp_engine.c.
Referenced by ast_rtp_convert_stats_json().
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 |
Example usage:
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 2099 of file rtp_engine.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::payload, and ast_rtp_codecs::payload_mapping_tx.
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 |
Definition at line 1640 of file rtp_engine.c.
References ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.
Referenced by ast_rtp_write(), create_outgoing_sdp_stream(), and multicast_rtp_write().
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 |
NULL | if payload does not exist. |
Example usage:
This looks up the information for payload '0' from the codecs structure.
Definition at line 1533 of file rtp_engine.c.
References ao2_bump, AST_RTP_MAX_PT, AST_RTP_PT_LAST_STATIC, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::payload_mapping_rx.
Referenced by 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 |
NULL | on failure |
Definition at line 1608 of file rtp_engine.c.
References ao2_bump, AST_RTP_MAX_PT, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, and ast_rtp_codecs::payload_mapping_tx.
struct ast_format* ast_rtp_codecs_get_preferred_format | ( | struct ast_rtp_codecs * | codecs | ) |
Retrieve rx preferred format.
codecs | Codecs structure to look in |
NULL | if format does not exist. |
Example usage:
This looks up the preferred format on the codec
Definition at line 1557 of file rtp_engine.c.
References ao2_bump, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::preferred_format.
Referenced by ast_rtp_dtmf_begin().
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 1514 of file rtp_engine.c.
References ast_format_get_type(), 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 ast_rtp_codecs::payload_mapping_rx.
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.
-1 | if could not assign. |
Example usage:
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 1977 of file rtp_engine.c.
References ast_rtp_codecs_payload_code_sample_rate().
Referenced by create_outgoing_sdp_stream(), and jingle_add_payloads_to_description().
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 rate.
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 |
sample_rate | Non-zero if we want to also match on sample rate. |
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.
-1 | if could not assign. |
Example usage:
This looks for the numerical payload for a DTMF type with a sample rate of 8kHz in the codecs structure.
Definition at line 1982 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, 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_codecs::payload_mapping_rx, ast_rtp_payload_type::primary_mapping, ast_rtp_payload_type::rtp_code, and ast_rtp_payload_type::sample_rate.
Referenced by ast_rtp_codecs_payload_code(), and create_outgoing_sdp_stream().
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 |
-1 | if not found. |
Definition at line 2094 of file rtp_engine.c.
References ast_rtp_codecs_payload_code_tx_sample_rate().
Referenced by ast_rtp_dtmf_begin(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), and multicast_rtp_write().
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.
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 |
sample_rate | The sample rate to look for, zero if we don't care |
-1 | if not found. |
Definition at line 2043 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, 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_codecs::payload_mapping_tx, ast_rtp_payload_type::rtp_code, and ast_rtp_payload_type::sample_rate.
Referenced by ast_rtp_codecs_payload_code_tx(), and ast_rtp_dtmf_begin().
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 1651 of file rtp_engine.c.
References ast_format_cap_append, ast_format_cap_remove_by_type(), ast_format_cap_set_framing(), 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_codecs::payload_mapping_tx, and ast_rtp_payload_type::rtp_code.
Referenced by jingle_interpret_description().
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 1574 of file rtp_engine.c.
References ao2_ref, ast_rtp_engine_alloc_payload_type(), AST_RTP_MAX_PT, AST_VECTOR_GET, AST_VECTOR_REPLACE, 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_codecs::payload_mapping_tx, and ast_rtp_payload_type::primary_mapping.
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 2033 of file rtp_engine.c.
Referenced by create_outgoing_sdp_stream().
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.
codecs | Codecs structure to manipulate |
code | The payload code |
format | Asterisk format |
sample_rate | Sample rate of the format, 0 to use the format's default |
0 | Payload was set to the given format |
-1 | Payload was in use or could not be set |
Definition at line 2038 of file rtp_engine.c.
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 1018 of file rtp_engine.c.
References ast_rtp_codecs_payloads_destroy(), ast_rtp_codecs_payloads_initialize(), AST_RTP_MAX_PT, ast_rtp_instance::engine, 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 1262 of file rtp_engine.c.
References ao2_replace, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_codecs::framing, ast_rtp_codecs::payload_mapping_tx, and ast_rtp_codecs::preferred_format.
Referenced by jingle_interpret_description().
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 996 of file rtp_engine.c.
References AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_codecs::payload_mapping_rx, ast_rtp_codecs::payload_mapping_tx, and ast_rtp_codecs::preferred_format.
Referenced by ast_rtp_codecs_payloads_clear(), ast_stream_free(), ast_stream_set_rtp_codecs(), and jingle_interpret_description().
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 980 of file rtp_engine.c.
References AST_RTP_MAX_PT, ast_rwlock_init, AST_VECTOR_FREE, AST_VECTOR_INIT, ast_rtp_codecs::codecs_lock, ast_rtp_codecs::framing, ast_rtp_codecs::payload_mapping_rx, and ast_rtp_codecs::payload_mapping_tx.
Referenced by ast_rtp_codecs_payloads_clear(), ast_rtp_instance_new(), and jingle_interpret_description().
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 1341 of file rtp_engine.c.
References ao2_bump, ao2_ref, ast_debug, AST_RTP_MAX_PT, AST_RTP_PT_LAST_STATIC, 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, ast_rtp_codecs::payload_mapping_tx, ast_rtp_engine::payload_set, and ast_rtp_payload_type::rtp_code.
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 string 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 1469 of file rtp_engine.c.
References ast_rtp_codecs_payloads_set_rtpmap_type_rate().
Referenced by jingle_interpret_description().
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 1383 of file rtp_engine.c.
References ao2_ref, 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_OPT_G726_NONSTANDARD, 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, ast_rtp_payload_type::payload, ast_rtp_codecs::payload_mapping_tx, 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_payload_type::sample_rate, ast_rtp_mime_type::subtype, and ast_rtp_mime_type::type.
Referenced by ast_rtp_codecs_payloads_set_rtpmap_type(), and jingle_interpret_description().
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 1474 of file rtp_engine.c.
References ao2_ref, ao2_replace, ast_debug, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_RTP_MAX_PT, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, ast_rtp_payload_type::format, ast_rtp_codecs::payload_mapping_tx, ast_rtp_engine::payload_set, and ast_rtp_codecs::preferred_format.
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 1296 of file rtp_engine.c.
References ao2_replace, ast_debug, 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_codecs::payload_mapping_tx, ast_rtp_engine::payload_set, ast_rtp_codecs::preferred_format, ast_rtp_payload_type::primary_mapping, and ast_rtp_payload_type::rtp_code.
Referenced by ast_rtp_instance_early_bridge_make_compatible().
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 1629 of file rtp_engine.c.
References ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.
Referenced by jingle_enable_video(), and jingle_new().
int ast_rtp_codecs_set_preferred_format | ( | struct ast_rtp_codecs * | codecs, |
struct ast_format * | format | ||
) |
Set the preferred format.
codecs | Codecs structure to set the preferred format in |
format | Preferred format to set. |
Example usage:
This sets the first joint format as the preferred format.
Definition at line 1566 of file rtp_engine.c.
References ao2_replace, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::preferred_format.
struct ast_json* ast_rtp_convert_stats_json | ( | const struct ast_rtp_instance_stats * | stats | ) |
Convert given stat instance into json format.
stats |
Definition at line 4137 of file rtp_engine.c.
References ast_json_integer_create(), ast_json_object_create(), ast_json_object_set(), ast_json_real_create(), ast_json_string_create(), ast_json_unref(), ast_rtp_instance_stats::channel_uniqueid, ast_rtp_instance_stats::local_maxjitter, ast_rtp_instance_stats::local_maxmes, ast_rtp_instance_stats::local_maxrxploss, ast_rtp_instance_stats::local_minjitter, ast_rtp_instance_stats::local_minmes, ast_rtp_instance_stats::local_minrxploss, ast_rtp_instance_stats::local_normdevjitter, ast_rtp_instance_stats::local_normdevmes, ast_rtp_instance_stats::local_normdevrxploss, ast_rtp_instance_stats::local_ssrc, ast_rtp_instance_stats::local_stdevjitter, ast_rtp_instance_stats::local_stdevmes, ast_rtp_instance_stats::local_stdevrxploss, ast_rtp_instance_stats::maxrtt, ast_rtp_instance_stats::minrtt, ast_rtp_instance_stats::normdevrtt, ast_rtp_instance_stats::remote_maxjitter, ast_rtp_instance_stats::remote_maxmes, ast_rtp_instance_stats::remote_maxrxploss, ast_rtp_instance_stats::remote_minjitter, ast_rtp_instance_stats::remote_minmes, ast_rtp_instance_stats::remote_minrxploss, ast_rtp_instance_stats::remote_normdevjitter, ast_rtp_instance_stats::remote_normdevmes, ast_rtp_instance_stats::remote_normdevrxploss, ast_rtp_instance_stats::remote_ssrc, ast_rtp_instance_stats::remote_stdevjitter, ast_rtp_instance_stats::remote_stdevmes, 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::rxmes, ast_rtp_instance_stats::rxoctetcount, ast_rtp_instance_stats::rxploss, SET_AST_JSON_OBJ, ast_rtp_instance_stats::stdevrtt, ast_rtp_instance_stats::txcount, ast_rtp_instance_stats::txjitter, ast_rtp_instance_stats::txmes, ast_rtp_instance_stats::txoctetcount, and ast_rtp_instance_stats::txploss.
Referenced by ast_rtp_instance_get_stats_all_json().
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 3261 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.
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 3279 of file rtp_engine.c.
References ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::cipher, and ast_rtp_dtls_cfg::pvtfile.
Referenced by ast_rtp_dtls_cfg_copy().
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 3168 of file rtp_engine.c.
References ast_file_is_readable(), 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_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, ast_rtp_dtls_cfg::pvtfile, ast_rtp_dtls_cfg::rekey, and ast_rtp_dtls_cfg::verify.
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 3242 of file rtp_engine.c.
References ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::ephemeral_cert, and ast_rtp_dtls_cfg::pvtfile.
struct ast_rtp_payload_type* ast_rtp_engine_alloc_payload_type | ( | void | ) |
Allocation routine for ast_rtp_payload_type.
NULL | on error |
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.
Referenced by ast_rtp_codecs_payload_replace_format(), and ast_rtp_codecs_payloads_set_rtpmap_type_rate().
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_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_rtp_engine::destroy, 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_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_UNLOCK, AST_RWLIST_WRLOCK, and ast_rtp_engine::name.
Referenced by rtp_reload().
int ast_rtp_get_rate | ( | const struct ast_format * | format | ) |
Retrieve the sample rate of a format according to RTP specifications.
format | The media format |
Definition at line 4224 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_g722, and ast_format_get_sample_rate().
Referenced by ast_rtcp_interpret(), ast_rtp_dtmf_end_with_duration(), and rtp_raw_write().
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_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_rtp_glue::mod, 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_UNLOCK, AST_RWLIST_WRLOCK, 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 2795 of file rtp_engine.c.
References ast_rtp_engine::activate, and ast_rtp_instance::engine.
Referenced by rtp_call().
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 2884 of file rtp_engine.c.
References ast_srtp_res::create, ast_rtp_instance::rtcp_srtp, and ast_rtp_instance::srtp.
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 2781 of file rtp_engine.c.
References ast_format_cap_count(), ast_translate_available_formats(), ast_rtp_engine::available_formats, and ast_rtp_instance::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.
child | The child RTP instance |
parent | The parent RTP instance the child should be bundled with |
0 | success |
-1 | failure |
Definition at line 3985 of file rtp_engine.c.
References ast_rtp_engine::bundle, and ast_rtp_instance::engine.
Referenced by 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 2284 of file rtp_engine.c.
References ast_rtp_engine::change_source, and ast_rtp_instance::engine.
Referenced by create_outgoing_sdp_stream(), and jingle_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 ast_debug_rtp, ast_rtp_instance_get_quality(), AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_MES, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, and ast_rtp_instance::channel_uniqueid.
Referenced by jingle_session_destructor(), multicast_rtp_request(), rtp_hangup(), stream_destroy(), and unicast_rtp_request().
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 2205 of file rtp_engine.c.
References ast_rtp_engine::dtmf_begin, and ast_rtp_instance::engine.
Referenced by chan_pjsip_digit_begin(), and jingle_digit_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 2219 of file rtp_engine.c.
References ast_rtp_engine::dtmf_end, and ast_rtp_instance::engine.
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 |
Example usage:
This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
Definition at line 2261 of file rtp_engine.c.
References ast_rtp_engine::dtmf_mode_get, and ast_rtp_instance::engine.
Referenced by chan_pjsip_digit_begin(), chan_pjsip_digit_end(), and pjsip_acf_dtmf_mode_write().
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 2247 of file rtp_engine.c.
References ast_rtp_engine::dtmf_mode_set, and ast_rtp_instance::engine.
Referenced by create_rtp(), and pjsip_acf_dtmf_mode_write().
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 2461 of file rtp_engine.c.
References ast_channel_lock_both, ast_debug, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_iscompatible(), AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_REMOTE, ast_rtp_instance_get_glue(), ast_rtp_glue::get_codec, ast_rtp_glue::get_rtp_info, ast_rtp_glue::get_vrtp_info, 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 2375 of file rtp_engine.c.
References ast_channel_lock_both, ast_debug, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_iscompatible(), ast_rtp_codecs_payloads_xover(), AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_REMOTE, ast_rtp_instance_get_glue(), ast_rtp_instance::codecs, ast_rtp_glue::get_codec, ast_rtp_glue::get_rtp_info, ast_rtp_glue::get_vrtp_info, 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 884 of file rtp_engine.c.
References AST_RTP_EXTENSION_DIRECTION_NONE, AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, rtp_extmap::extension, ast_rtp_instance::extmap_negotiated, and ast_rtp_instance::extmap_unique_ids.
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 921 of file rtp_engine.c.
References AST_VECTOR_SIZE, and ast_rtp_instance::extmap_unique_ids.
Referenced by 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 754 of file rtp_engine.c.
References 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, ast_rtp_engine::extension_enable, ast_rtp_instance::extmap_enabled, ast_rtp_instance::extmap_negotiated, and ast_rtp_instance::extmap_unique_ids.
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 |
Definition at line 952 of file rtp_engine.c.
References AST_RTP_EXTENSION_DIRECTION_NONE, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, rtp_extmap::direction, and ast_rtp_instance::extmap_unique_ids.
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 |
Definition at line 932 of file rtp_engine.c.
References AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, rtp_extmap::extension, and ast_rtp_instance::extmap_unique_ids.
Referenced by 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 908 of file rtp_engine.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, and ast_rtp_instance::extmap_negotiated.
Referenced by ast_rtp_rtcp_handle_nack(), enable_rtp_extension(), 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 |
Definition at line 968 of file rtp_engine.c.
References AST_RTP_EXTENSION_UNSUPPORTED, ast_rtp_instance_extmap_get_extension(), rtp_extmap::extension, and rtp_extension_uris.
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 840 of file rtp_engine.c.
References AST_RTP_EXTENSION_DIRECTION_NONE, AST_RTP_EXTENSION_UNSUPPORTED, AST_VECTOR_GET, AST_VECTOR_REPLACE, AST_VECTOR_SIZE, rtp_extmap::direction, rtp_extmap::extension, ast_rtp_instance::extmap_enabled, ast_rtp_instance::extmap_negotiated, ast_rtp_instance::extmap_unique_ids, 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 2316 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::fd.
Referenced by check_for_rtp_changes(), jingle_enable_video(), jingle_new(), rtp_find_rtcp_fd_position(), 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 |
Example:
This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
Definition at line 2853 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 651 of file rtp_engine.c.
References 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 673 of file rtp_engine.c.
References 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 2358 of file rtp_engine.c.
References ast_rtp_instance::bridged.
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 |
Empty | string if no channel owns this RTP instance |
Definition at line 570 of file rtp_engine.c.
References ast_rtp_instance::channel_uniqueid.
Referenced by __rtp_recvfrom(), ast_rtcp_interpret(), ast_rtp_get_stat(), ast_rtp_prop_set(), ast_rtp_stop(), ast_rtp_write(), rtp_check_timeout(), and rtp_raw_write().
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 3972 of file rtp_engine.c.
References 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 749 of file rtp_engine.c.
References ast_rtp_instance::codecs.
Referenced by ast_rtp_dtmf_begin(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), create_outgoing_sdp_stream(), jingle_add_payloads_to_description(), jingle_enable_video(), jingle_interpret_description(), jingle_new(), and multicast_rtp_write().
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 585 of file rtp_engine.c.
References ast_rtp_instance::data.
Referenced by __rtp_recvfrom(), __rtp_sendto(), 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_stop(), ast_rtp_ice_turn_request(), ast_rtp_local_bridge(), 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_stop(), ast_rtp_stun_request(), ast_rtp_update_source(), ast_rtp_write(), bridge_p2p_rtp_write(), ice_reset_session(), multicast_rtp_activate(), multicast_rtp_destroy(), multicast_rtp_write(), red_write(), rtp_raw_write(), rtp_red_buffer(), rtp_red_init(), and rtp_sendto().
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 |
NULL | if no DTLS support available |
Definition at line 3159 of file rtp_engine.c.
References ast_rtp_engine::dtls, and ast_rtp_instance::engine.
Referenced by ast_sdp_get_rtp_profile().
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 |
Example usage:
This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
Definition at line 2848 of file rtp_engine.c.
References ast_rtp_instance::engine.
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 712 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::extended_prop_get.
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 2330 of file rtp_engine.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_rtp_instance::glue, and ast_rtp_glue::type.
Referenced by ast_ari_channels_rtpstatistics(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), and ast_rtp_instance_make_compatible().
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 |
Example usage:
This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
Definition at line 2838 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout.
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 |
NULL | if no ICE support available |
Definition at line 3039 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::ice.
Referenced by add_ice_to_stream(), check_ice_support(), create_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(), and process_ice_attributes().
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 687 of file rtp_engine.c.
References 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 |
Example usage:
This gets the RTP keepalive interval value for the RTP instance pointed to by 'instance'.
Definition at line 2843 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
time_t ast_rtp_instance_get_last_rx | ( | const struct ast_rtp_instance * | rtp | ) |
Get the last RTP reception time.
rtp | The instance from which to get the last reception time |
Definition at line 3949 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 3939 of file rtp_engine.c.
References ast_rtp_instance::last_tx.
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 665 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by ast_rtp_ice_turn_request(), ast_rtp_prop_set(), ast_rtp_remote_address_set(), create_outgoing_sdp_stream(), multicast_send_control_packet(), and unicast_rtp_request().
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 |
Example usage:
This returns the current value of the NAT property on the instance pointed to by instance.
Definition at line 738 of file rtp_engine.c.
References ast_rtp_instance::properties.
Referenced by ast_rtcp_interpret(), ast_rtp_dtmf_compatible(), ast_rtp_read(), bridge_p2p_rtp_write(), and rtp_raw_write().
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 2588 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_MES, 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_MES, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, ast_rtp_instance_stats::local_maxjitter, ast_rtp_instance_stats::local_maxmes, ast_rtp_instance_stats::local_maxrxploss, ast_rtp_instance_stats::local_minjitter, ast_rtp_instance_stats::local_minmes, ast_rtp_instance_stats::local_minrxploss, ast_rtp_instance_stats::local_normdevjitter, ast_rtp_instance_stats::local_normdevmes, ast_rtp_instance_stats::local_normdevrxploss, ast_rtp_instance_stats::local_ssrc, ast_rtp_instance_stats::local_stdevjitter, ast_rtp_instance_stats::local_stdevmes, ast_rtp_instance_stats::local_stdevrxploss, ast_rtp_instance_stats::maxrtt, ast_rtp_instance_stats::minrtt, ast_rtp_instance_stats::normdevrtt, ast_rtp_instance_stats::remote_maxjitter, ast_rtp_instance_stats::remote_maxmes, ast_rtp_instance_stats::remote_maxrxploss, ast_rtp_instance_stats::remote_minjitter, ast_rtp_instance_stats::remote_minmes, ast_rtp_instance_stats::remote_minrxploss, ast_rtp_instance_stats::remote_normdevjitter, ast_rtp_instance_stats::remote_normdevmes, ast_rtp_instance_stats::remote_normdevrxploss, ast_rtp_instance_stats::remote_ssrc, ast_rtp_instance_stats::remote_stdevjitter, ast_rtp_instance_stats::remote_stdevmes, 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::rxmes, ast_rtp_instance_stats::rxploss, ast_rtp_instance_stats::stdevrtt, ast_rtp_instance_stats::txcount, ast_rtp_instance_stats::txjitter, ast_rtp_instance_stats::txmes, and ast_rtp_instance_stats::txploss.
Referenced by ast_rtp_instance_destroy(), and ast_rtp_instance_set_stats_vars().
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.
This returns the explicitly set address of a remote endpoint. Meaning this won't change unless specifically told to change. In most cases this should be the same as the incoming source address, except in cases where the engine "learns" the address in which case this and the incoming source address might differ.
instance | The instance that we want to get the requested target address for |
address | A structure to put the address into |
Definition at line 695 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::requested_target_address.
Referenced by ast_rtp_read().
struct ast_srtp* ast_rtp_instance_get_srtp | ( | struct ast_rtp_instance * | instance, |
int | rtcp | ||
) |
Obtain the SRTP instance associated with an RTP instance.
instance | the RTP instance |
rtcp | 1 to request instance for RTCP |
NULL | if no SRTP instance exists |
Definition at line 2911 of file rtp_engine.c.
References ast_rtp_instance::rtcp_srtp, and ast_rtp_instance::srtp.
Referenced by __rtp_sendto(), ast_rtcp_read(), ast_rtp_change_source(), and ast_rtp_read().
unsigned int ast_rtp_instance_get_ssrc | ( | struct ast_rtp_instance * | rtp | ) |
Retrieve the local SSRC value that we will be using.
rtp | The RTP instance |
Definition at line 3959 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::ssrc_get.
Referenced by add_ssrc_to_stream(), and create_outgoing_sdp_stream().
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.
instance | Instance to get statistics on |
stats | Structure to put results into |
stat | What statistic(s) to retrieve |
0 | success |
-1 | failure |
Example usage:
This retrieves all statistics the underlying RTP engine supports and puts the values into the stats structure.
Definition at line 2570 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::get_stat.
Referenced by ast_rtp_instance_get_quality(), ast_rtp_instance_get_stats_all_json(), and process_ssrc_attributes().
struct ast_json* ast_rtp_instance_get_stats_all_json | ( | struct ast_rtp_instance * | instance | ) |
Retrieve statistics about an RTP instance in json format.
instance |
Definition at line 4213 of file rtp_engine.c.
References ast_rtp_convert_stats_json(), ast_rtp_instance_get_stats(), and AST_RTP_INSTANCE_STAT_ALL.
Referenced by ast_ari_channels_rtpstatistics().
int ast_rtp_instance_get_timeout | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP timeout value.
instance | The RTP instance |
Example usage:
This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
Definition at line 2833 of file rtp_engine.c.
References ast_rtp_instance::timeout.
Referenced by rtp_check_timeout().
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.
chan | Our own Asterisk channel |
instance | The first RTP instance |
peer | The peer Asterisk channel |
0 | success |
-1 | failure |
Example usage:
This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.
Definition at line 2737 of file rtp_engine.c.
References ao2_ref, ast_rtp_instance_get_glue(), ast_rtp_instance::engine, ast_rtp_glue::get_rtp_info, ast_rtp_instance::glue, ast_rtp_engine::make_compatible, and ast_rtp_glue::type.
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.
engine_name | Name of the engine to use for the RTP instance |
sched | Scheduler context that the RTP engine may want to use |
sa | Address we want to bind to |
data | Unique data for the engine |
non-NULL | success |
NULL | failure |
Example usage:
This creates a new RTP instance using the default engine and asks the RTP engine to bind to the address given in the address structure.
Definition at line 487 of file rtp_engine.c.
References ao2_ref, ast_debug, ast_module_running_ref, ast_module_unref, ast_rtp_codecs_payloads_initialize(), AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, ast_sockaddr_copy(), AST_VECTOR_INIT, ast_rtp_instance::codecs, ast_rtp_instance::engine, ast_rtp_instance::extmap_enabled, ast_rtp_instance::extmap_negotiated, ast_rtp_instance::extmap_unique_ids, ast_rtp_instance::local_address, ast_rtp_engine::mod, ast_rtp_engine::name, and ast_rtp_engine::new.
Referenced by create_rtp(), jingle_alloc(), jingle_enable_video(), multicast_rtp_request(), and unicast_rtp_request().
struct ast_frame* ast_rtp_instance_read | ( | struct ast_rtp_instance * | instance, |
int | rtcp | ||
) |
Receive a frame over RTP.
instance | The RTP instance to receive frame on |
rtcp | Whether to read in RTCP or not |
non-NULL | success |
NULL | failure |
Example usage:
This asks the RTP engine to read in RTP from the instance and return it as an Asterisk frame.
Definition at line 600 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::read.
Referenced by jingle_read(), and rtp_read().
int ast_rtp_instance_sendcng | ( | struct ast_rtp_instance * | instance, |
int | level | ||
) |
Send a comfort noise packet to the RTP instance.
instance | The RTP instance |
level | Magnitude of the noise level |
0 | Success |
non-zero | Failure |
Definition at line 2920 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::sendcng.
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.
instance | The RTP instance that we want to set the bridged value on |
bridged | The RTP instance they are bridged to |
Definition at line 2368 of file rtp_engine.c.
References ast_rtp_instance::bridged.
void ast_rtp_instance_set_channel_id | ( | struct ast_rtp_instance * | instance, |
const char * | uniqueid | ||
) |
Set the channel that owns this RTP instance.
instance | The RTP instance |
uniqueid | The uniqueid of the channel |
Definition at line 575 of file rtp_engine.c.
References ast_copy_string(), and ast_rtp_instance::channel_uniqueid.
Referenced by jingle_enable_video(), jingle_set_owner(), multicast_rtp_request(), and unicast_rtp_request().
void ast_rtp_instance_set_data | ( | struct ast_rtp_instance * | instance, |
void * | data | ||
) |
Set the data portion of an RTP instance.
instance | The RTP instance to manipulate |
data | Pointer to data |
Example usage:
This sets the data pointer on the RTP instance pointed to by 'instance' to blob.
Definition at line 580 of file rtp_engine.c.
References ast_rtp_instance::data.
Referenced by ast_rtp_new(), and multicast_rtp_new().
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.
instance | The RTP instance to set the extended property on |
property | The extended property to set |
value | The value to set the extended property to |
Definition at line 703 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::extended_prop_set.
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.
instance | The RTP instance |
timeout | Value to set the timeout to |
Example usage:
This sets the RTP hold timeout value on 'instance' to be 5000.
Definition at line 2823 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout, and ast_rtp_instance::timeout.
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.
This sets the incoming source 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 RTP instance to change the address on |
address | Address to set it to |
0 | success |
-1 | failure |
Definition at line 628 of file rtp_engine.c.
Referenced by ast_rtp_read().
void ast_rtp_instance_set_keepalive | ( | struct ast_rtp_instance * | instance, |
int | timeout | ||
) |
Set the RTP keepalive interval.
instance | The RTP instance |
timeout | Value to set the keepalive interval to |
Example usage:
This sets the RTP keepalive interval on 'instance' to be 5000.
Definition at line 2828 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
void ast_rtp_instance_set_last_rx | ( | struct ast_rtp_instance * | rtp, |
time_t | time | ||
) |
Set the last RTP reception time.
rtp | The instance on which to set the last reception time |
time | The last reception time |
Definition at line 3954 of file rtp_engine.c.
References ast_rtp_instance::last_rx.
Referenced by create_rtp(), and rtp_check_timeout().
void ast_rtp_instance_set_last_tx | ( | struct ast_rtp_instance * | rtp, |
time_t | time | ||
) |
Set the last RTP transmission time.
rtp | The instance on which to set the last transmission time |
time | The last transmission time |
Definition at line 3944 of file rtp_engine.c.
References ast_rtp_instance::last_tx.
Referenced by __rtp_sendto().
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.
instance | The RTP instance to change the address on |
address | Address to set it to |
0 | success |
-1 | failure |
Example usage:
This changes the local address that RTP is expected on to the address given in the sin structure.
Definition at line 610 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by ast_rtp_remote_address_set().
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.
instance | The RTP instance to set the property on |
property | The property to modify |
value | The value to set the property to |
Example usage:
This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
Definition at line 727 of file rtp_engine.c.
References ast_rtp_instance::engine, ast_rtp_engine::prop_set, and ast_rtp_instance::properties.
Referenced by check_for_rtp_changes(), create_rtp(), enable_rtcp(), jingle_alloc(), jingle_enable_video(), and pjsip_acf_dtmf_mode_write().
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.
instance | Instance to set the QoS parameters on |
tos | Terms of service value |
cos | Class of service value |
desc | What is setting the QoS values |
0 | success |
-1 | failure |
Example usage:
This sets the TOS and COS values to 0 on the instance pointed to by instance.
Definition at line 2293 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::qos.
Referenced by create_rtp().
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.
instance | The RTP instance to change read format on |
format | Format that frames are wanted in |
0 | success |
-1 | failure |
Example usage:
This requests that the RTP engine provide audio frames in the ULAW format.
Definition at line 2708 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_read_format.
void ast_rtp_instance_set_remote_ssrc | ( | struct ast_rtp_instance * | rtp, |
unsigned int | ssrc | ||
) |
Set the remote SSRC for an RTP instance.
rtp | The RTP instance |
ssrc | The remote SSRC |
Definition at line 4002 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_remote_ssrc.
Referenced by process_ssrc_attributes().
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.
This should always be the address of the remote endpoint. Consequently, this can differ from the address the engine is sending RTP to. However, usually they will be the same except in some circumstances (for instance when the engine "learns" the address if symmetric RTP is enabled).
instance | The RTP instance to change the address on |
address | Address to set it to |
0 | success |
-1 | failure |
Definition at line 638 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::requested_target_address.
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.
chan | Channel to set the statistics on |
instance | The RTP instance that statistics will be retrieved from |
Example usage:
This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to by chan.
Definition at line 2639 of file rtp_engine.c.
References ast_channel_bridge_peer(), ast_channel_lock_both, ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_unref, AST_MAX_USER_FIELD, ast_rtp_instance_get_quality(), 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_MES, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, ast_channel::bridge, and pbx_builtin_setvar_helper().
Referenced by chan_pjsip_session_end().
void ast_rtp_instance_set_stream_num | ( | struct ast_rtp_instance * | instance, |
int | stream_num | ||
) |
Set the stream number for an RTP instance.
instance | The RTP instance |
stream_num | The stream identifier number |
Definition at line 4011 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_stream_num.
void ast_rtp_instance_set_timeout | ( | struct ast_rtp_instance * | instance, |
int | timeout | ||
) |
Set the RTP timeout value.
instance | The RTP instance |
timeout | Value to set the timeout to |
Example usage:
This sets the RTP timeout value on 'instance' to be 5000.
Definition at line 2818 of file rtp_engine.c.
References ast_rtp_instance::timeout.
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.
instance | The RTP instance to change write format on |
format | Format that frames will be provided in |
0 | success |
-1 | failure |
Example usage:
This tells the underlying RTP engine that audio frames will be provided to it in ULAW format.
Definition at line 2722 of file rtp_engine.c.
References ast_rtp_instance::engine, ast_rtp_engine::set_read_format, and ast_rtp_engine::set_write_format.
void ast_rtp_instance_stop | ( | struct ast_rtp_instance * | instance | ) |
Stop an RTP instance.
instance | Instance that media is no longer going to at this time |
Example usage:
This tells the RTP engine being used for the instance pointed to by instance that media is no longer going to it at this time, but may in the future.
Definition at line 2307 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::stop.
Referenced by jingle_session_destructor(), and stream_stop().
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.
instance | The RTP instance |
suggestion | The suggested destination |
username | Optionally a username for the request |
Example usage:
This requests that the RTP engine send a STUN BIND request on the session pointed to by 'instance'.
Definition at line 2809 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::stun_request.
Referenced by jingle_interpret_google_transport().
void ast_rtp_instance_update_source | ( | struct ast_rtp_instance * | instance | ) |
Indicate that the RTP marker bit should be set on an RTP stream.
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 been updated and that the marker bit should be set.
Definition at line 2275 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::update_source.
Referenced by jingle_indicate().
int ast_rtp_instance_write | ( | struct ast_rtp_instance * | instance, |
struct ast_frame * | frame | ||
) |
Send a frame out over RTP.
instance | The RTP instance to send frame out on |
frame | the frame to send out |
0 | success |
-1 | failure |
Example usage:
This gives the frame pointed to by frame to the RTP engine being used for the instance and asks that it be transmitted to the current remote address set on the RTP instance.
Definition at line 590 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::write.
Referenced by chan_pjsip_indicate(), jingle_write(), and rtp_write().
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.
buf | Buffer to put the mime output into |
ast_format_capability | Asterisk Formats we are looking up. |
rtp_capability | RTP codes that we are looking up |
asterisk_format | Non-zero if the ast_format_capability structure is to be used, 0 if rtp_capability is to be used |
options | Additional options that may change the result |
non-NULL | success |
NULL | failure |
Example usage:
This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
Definition at line 2169 of file rtp_engine.c.
References ao2_ref, ast_format_cap_count(), ast_format_cap_get_format(), ast_rtp_lookup_mime_subtype2(), AST_RTP_MAX, ast_str_append(), and ast_str_buffer().
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.
asterisk_format | Non-zero to look up using Asterisk format |
format | Asterisk format to look up |
code | RTP code to look up |
options | Additional options that may change the result |
NULL | failure |
Example usage:
This looks up the mime subtype for the ULAW format.
Definition at line 2116 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, ast_format_g726_aal2, AST_RTP_OPT_G726_NONSTANDARD, ast_rtp_mime_type::payload_type, ast_rtp_payload_type::rtp_code, and ast_rtp_mime_type::subtype.
Referenced by ast_rtp_lookup_mime_multiple2(), and jingle_add_payloads_to_description().
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.
asterisk_format | True if the value in format is to be used. |
format | An asterisk format |
code | from AST_RTP list |
Definition at line 2146 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_rtp_mime_type::payload_type, ast_rtp_payload_type::rtp_code, and ast_rtp_mime_type::sample_rate.
Referenced by create_outgoing_sdp_stream(), and jingle_add_payloads_to_description().
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.
rtp | The rtp instance object |
message_type | The RTP message type to publish |
report | The RTCP report object to publish. This should be an ao2 ref counted object. This routine will increase the reference count of the object. |
blob | Additional JSON objects to publish along with the RTCP information |
Definition at line 3638 of file rtp_engine.c.
References ao2_ref, ast_channel_snapshot_get_latest(), ast_json_ref(), ast_rtp_topic(), ast_rtp_instance::channel_uniqueid, RAII_VAR, stasis_message_create(), and stasis_publish().
Referenced by ast_rtcp_interpret().
int ast_rtp_red_buffer | ( | struct ast_rtp_instance * | instance, |
struct ast_frame * | frame | ||
) |
Buffer a frame in an RTP instance for RED.
instance | The instance to buffer the frame on |
frame | Frame that we want to buffer |
0 | success |
-1 | failure |
Definition at line 2556 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::red_buffer.
int ast_rtp_red_init | ( | struct ast_rtp_instance * | instance, |
int | buffer_time, | ||
int * | payloads, | ||
int | generations | ||
) |
Initialize RED support on an RTP instance.
instance | The instance to initialize RED support on |
buffer_time | How long to buffer before sending |
payloads | Payload values |
generations | Number of generations |
0 | success |
-1 | failure |
Definition at line 2542 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::red_init.
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.
report_blocks | The number of report blocks to allocate |
NULL | on error |
Definition at line 3627 of file rtp_engine.c.
Referenced by ast_rtcp_interpret(), ast_rtcp_write(), and ast_rtp_read().
struct stasis_topic* ast_rtp_topic | ( | void | ) |
Stasis Message Bus API topic for RTP and RTCP related messages
Definition at line 3684 of file rtp_engine.c.
References rtp_topic.
Referenced by ast_rtp_publish_rtcp_message(), and manager_subscriptions_init().
|
static |
URIs for known RTP extensions.
Definition at line 234 of file rtp_engine.c.
Referenced by ast_rtp_instance_extmap_get_uri(), and ast_rtp_instance_extmap_negotiate().
|
static |
Mapping between Asterisk codecs and rtp payload types.
Static (i.e., well-known) RTP payload types for our "AST_FORMAT..."s: also, our own choices for dynamic payload types. This is our master table for transmission
See http://www.iana.org/assignments/rtp-parameters for a list of assigned values
Definition at line 273 of file rtp_engine.c.