Pluggable RTP Architecture. More...
#include "asterisk/astobj2.h"
#include "asterisk/frame.h"
#include "asterisk/netsock2.h"
#include "asterisk/sched.h"
#include "asterisk/res_srtp.h"
Go to the source code of this file.
Data Structures | |
struct | ast_rtp_codecs |
struct | ast_rtp_engine |
struct | ast_rtp_glue |
struct | ast_rtp_instance_stats |
struct | ast_rtp_payload_type |
Macros | |
#define | AST_RED_MAX_GENERATION 5 |
#define | AST_RTP_CISCO_DTMF (1 << 2) |
#define | AST_RTP_CN (1 << 1) |
#define | AST_RTP_DTMF (1 << 0) |
#define | ast_rtp_engine_register(engine) ast_rtp_engine_register2(engine, ast_module_info->self) |
#define | ast_rtp_glue_register(glue) ast_rtp_glue_register2(glue, ast_module_info->self) |
#define | AST_RTP_MAX AST_RTP_CISCO_DTMF |
#define | AST_RTP_MAX_PT 256 |
#define | AST_RTP_STAT_SET(current_stat, combined, placement, value) |
#define | AST_RTP_STAT_TERMINATOR(combined) |
Functions | |
void | ast_rtp_codecs_packetization_set (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs) |
Set codec packetization preferences. More... | |
int | ast_rtp_codecs_payload_code (struct ast_rtp_codecs *codecs, const int asterisk_format, const format_t code) |
Retrieve a payload based on whether it is an Asterisk format and the code. More... | |
void | ast_rtp_codecs_payload_formats (struct ast_rtp_codecs *codecs, format_t *astformats, int *nonastformats) |
Retrieve all formats that were found. More... | |
struct ast_rtp_payload_type | ast_rtp_codecs_payload_lookup (struct ast_rtp_codecs *codecs, int payload) |
Retrieve payload information by payload. More... | |
void | ast_rtp_codecs_payloads_clear (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance) |
Clear payload 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_default (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance) |
Set payload information on an RTP instance to the default. More... | |
void | ast_rtp_codecs_payloads_set_m_type (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload) |
Record payload information that was seen in an m= SDP line. 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 payload 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 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 payload information. More... | |
int | ast_rtp_engine_register2 (struct ast_rtp_engine *engine, struct ast_module *module) |
Register an RTP engine. More... | |
int | ast_rtp_engine_register_srtp (struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res) |
int | ast_rtp_engine_srtp_is_registered (void) |
int | ast_rtp_engine_unregister (struct ast_rtp_engine *engine) |
Unregister an RTP engine. More... | |
void | ast_rtp_engine_unregister_srtp (void) |
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) |
Add or replace the SRTP policies for the given RTP instance. More... | |
format_t | ast_rtp_instance_available_formats (struct ast_rtp_instance *instance, format_t to_endpoint, format_t to_asterisk) |
Request the formats that can be transcoded. More... | |
enum ast_bridge_result | ast_rtp_instance_bridge (struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms) |
Bridge two channels that use RTP instances. 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... | |
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_remote_address (struct ast_rtp_instance *instance, struct ast_sockaddr *address) |
Get the address of the remote endpoint that we are sending RTP to, comparing its address to another. 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... | |
struct ast_channel * | ast_rtp_instance_get_chan (struct ast_rtp_instance *instance) |
Get the channel that is associated with an RTP instance while in a bridge. 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 * | 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... | |
int | ast_rtp_instance_get_keepalive (struct ast_rtp_instance *instance) |
Get the RTP keepalive interval. 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_remote_address (struct ast_rtp_instance *instance, struct ast_sockaddr *address) |
Get the address of the remote endpoint that we are sending RTP to. More... | |
struct ast_srtp * | ast_rtp_instance_get_srtp (struct ast_rtp_instance *instance) |
Obtain the SRTP instance associated with an RTP instance. 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... | |
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 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... | |
int | ast_rtp_instance_set_alt_remote_address (struct ast_rtp_instance *instance, const struct ast_sockaddr *address) |
Set the address of an an alternate RTP address to receive from. 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... | |
void | ast_rtp_instance_set_keepalive (struct ast_rtp_instance *instance, int timeout) |
Set the RTP keepalive interval. 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, format_t format) |
Request that the underlying RTP engine provide audio frames in a specific format. More... | |
int | ast_rtp_instance_set_remote_address (struct ast_rtp_instance *instance, const struct ast_sockaddr *address) |
Set the address of the remote endpoint that we are sending RTP to. 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_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, format_t 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, const format_t 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 format_t code, enum ast_rtp_options options) |
Retrieve mime subtype information on a payload. More... | |
unsigned int | ast_rtp_lookup_sample_rate2 (int asterisk_format, format_t code) |
Get the sample rate associated with known RTP payload types. 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... | |
Pluggable RTP Architecture.
Definition in file rtp_engine.h.
#define AST_RED_MAX_GENERATION 5 |
Definition at line 82 of file rtp_engine.h.
Referenced by process_sdp_a_text().
#define AST_RTP_CISCO_DTMF (1 << 2) |
#define AST_RTP_CN (1 << 1) |
'Comfort Noise' (RFC3389)
Definition at line 220 of file rtp_engine.h.
Referenced by ast_rtp_read(), and ast_rtp_sendcng().
#define AST_RTP_DTMF (1 << 0) |
DTMF (RFC2833)
Definition at line 218 of file rtp_engine.h.
Referenced by add_noncodec_to_sdp(), add_sdp(), ast_rtp_dtmf_begin(), ast_rtp_read(), check_peer_ok(), create_addr(), create_addr_from_peer(), oh323_alloc(), oh323_request(), process_sdp(), sip_alloc(), and sip_dtmfmode().
#define ast_rtp_engine_register | ( | engine | ) | ast_rtp_engine_register2(engine, ast_module_info->self) |
Definition at line 423 of file rtp_engine.h.
Referenced by load_module().
#define ast_rtp_glue_register | ( | glue | ) | ast_rtp_glue_register2(glue, ast_module_info->self) |
Definition at line 476 of file rtp_engine.h.
Referenced by load_module().
#define AST_RTP_MAX AST_RTP_CISCO_DTMF |
Maximum RTP-specific code
Definition at line 224 of file rtp_engine.h.
Referenced by add_sdp(), and ast_rtp_lookup_mime_multiple2().
#define AST_RTP_MAX_PT 256 |
Definition at line 79 of file rtp_engine.h.
Referenced by ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_formats(), ast_rtp_codecs_payload_lookup(), ast_rtp_codecs_payloads_clear(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_default(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_codecs_payloads_unset(), and process_sdp_a_audio().
#define AST_RTP_STAT_SET | ( | current_stat, | |
combined, | |||
placement, | |||
value | |||
) |
Definition at line 296 of file rtp_engine.h.
Referenced by ast_rtp_get_stat().
#define AST_RTP_STAT_TERMINATOR | ( | combined | ) |
Definition at line 304 of file rtp_engine.h.
Referenced by ast_rtp_get_stat().
enum ast_rtp_dtmf_mode |
RTP DTMF Modes
Definition at line 115 of file rtp_engine.h.
enum ast_rtp_glue_result |
Result codes when RTP glue is queried for information
Definition at line 125 of file rtp_engine.h.
Statistics that can be retrieved from an RTP instance
Definition at line 147 of file rtp_engine.h.
Field statistics that can be retrieved from an RTP instance
Definition at line 135 of file rtp_engine.h.
enum ast_rtp_options |
Additional RTP options
Enumerator | |
---|---|
AST_RTP_OPT_G726_NONSTANDARD |
Remote side is using non-standard G.726 |
Definition at line 109 of file rtp_engine.h.
enum ast_rtp_property |
RTP Properties that can be set on an RTP instance
Definition at line 88 of file rtp_engine.h.
void ast_rtp_codecs_packetization_set | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance, | ||
struct ast_codec_pref * | prefs | ||
) |
Set codec packetization preferences.
codecs | Codecs structure to muck with |
instance | Optionally the instance that the codecs structure belongs to |
prefs | Codec packetization preferences |
Example usage:
This sets the packetization preferences pointed to by prefs on the codecs structure pointed to by codecs.
Definition at line 727 of file rtp_engine.c.
References ast_rtp_instance::codecs, ast_rtp_instance::engine, ast_rtp_engine::packetization_set, ast_rtp_codecs::pref, and prefs.
Referenced by __oh323_rtp_create(), check_peer_ok(), create_addr_from_peer(), gtalk_new(), jingle_new(), process_sdp_a_audio(), set_peer_capabilities(), start_rtp(), and transmit_response_with_sdp().
int ast_rtp_codecs_payload_code | ( | struct ast_rtp_codecs * | codecs, |
const int | asterisk_format, | ||
const format_t | code | ||
) |
Retrieve a payload based on whether it is an Asterisk format and the code.
codecs | Codecs structure to look in |
asterisk_format | Non-zero if the given code is an Asterisk format value |
code | The format to look for |
Numerical | payload |
Example usage:
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 654 of file rtp_engine.c.
References AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, and ast_rtp_codecs::payloads.
Referenced by add_codec_to_sdp(), add_noncodec_to_sdp(), add_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), ast_rtp_dtmf_begin(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), multicast_rtp_write(), and start_rtp().
void ast_rtp_codecs_payload_formats | ( | struct ast_rtp_codecs * | codecs, |
format_t * | astformats, | ||
int * | nonastformats | ||
) |
Retrieve all formats that were found.
codecs | Codecs structure to look in |
astformats | An integer 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 636 of file rtp_engine.c.
References ast_debug, AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, and ast_rtp_codecs::payloads.
Referenced by gtalk_is_answered(), gtalk_newcall(), and process_sdp().
struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup | ( | struct ast_rtp_codecs * | codecs, |
int | payload | ||
) |
Retrieve payload information by payload.
codecs | Codecs structure to look in |
payload | Numerical payload to look up |
Payload | information |
Example usage:
This looks up the information for payload '0' from the codecs structure.
Definition at line 618 of file rtp_engine.c.
References AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, and ast_rtp_payload_type::code.
Referenced by ast_rtp_read(), bridge_p2p_rtp_write(), process_sdp_a_audio(), and setup_rtp_connection().
void ast_rtp_codecs_payloads_clear | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance | ||
) |
Clear payload 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 488 of file rtp_engine.c.
References AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, ast_rtp_instance::engine, ast_rtp_engine::payload_set, and ast_rtp_codecs::payloads.
Referenced by gtalk_alloc(), and process_sdp().
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 516 of file rtp_engine.c.
References ast_debug, AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, ast_rtp_instance::engine, ast_rtp_engine::payload_set, and ast_rtp_codecs::payloads.
Referenced by ast_rtp_instance_early_bridge_make_compatible(), and process_sdp().
void ast_rtp_codecs_payloads_default | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance | ||
) |
Set payload information on an RTP instance to the default.
codecs | The codecs structure to set defaults on |
instance | Optionally the instance that the codecs structure belongs to |
Example usage:
This sets the default payloads on the codecs structure.
Definition at line 501 of file rtp_engine.c.
References AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, ast_rtp_instance::engine, ast_rtp_engine::payload_set, and ast_rtp_codecs::payloads.
void ast_rtp_codecs_payloads_set_m_type | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance, | ||
int | payload | ||
) |
Record payload information that was seen in an m= SDP line.
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 532 of file rtp_engine.c.
References ast_debug, AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, ast_rtp_instance::engine, ast_rtp_engine::payload_set, and ast_rtp_codecs::payloads.
Referenced by gtalk_is_answered(), gtalk_newcall(), jingle_newcall(), and process_sdp().
int ast_rtp_codecs_payloads_set_rtpmap_type | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance, | ||
int | payload, | ||
char * | mimetype, | ||
char * | mimesubtype, | ||
enum ast_rtp_options | options | ||
) |
Record payload information that was seen in an a=rtpmap: SDP line.
codecs | The codecs structure to muck with |
instance | Optionally the instance that the codecs structure belongs to |
payload | Numerical payload that was seen in the a=rtpmap: SDP line |
mimetype | The string mime type that was seen |
mimesubtype | The strin mime sub type that was seen |
options | Optional options that may change the behavior of this specific payload |
0 | success |
-1 | failure, invalid payload numbe |
-2 | failure, unknown mimetype |
Example usage:
This records that the numerical payload '0' was seen with mime type 'audio' and sub mime type 'PCMU' in the codecs structure.
Definition at line 597 of file rtp_engine.c.
References ast_rtp_codecs_payloads_set_rtpmap_type_rate().
Referenced by __oh323_rtp_create(), gtalk_is_answered(), gtalk_newcall(), jingle_newcall(), process_sdp(), set_dtmf_payload(), and setup_rtp_connection().
int ast_rtp_codecs_payloads_set_rtpmap_type_rate | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance, | ||
int | pt, | ||
char * | mimetype, | ||
char * | mimesubtype, | ||
enum ast_rtp_options | options, | ||
unsigned int | sample_rate | ||
) |
Set 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 548 of file rtp_engine.c.
References ARRAY_LEN, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, AST_RTP_MAX_PT, ast_rtp_mime_types, AST_RTP_OPT_G726_NONSTANDARD, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, ast_rtp_instance::engine, ast_rtp_engine::payload_set, ast_rtp_mime_type::payload_type, ast_rtp_codecs::payloads, ast_rtp_mime_type::sample_rate, ast_rtp_mime_type::subtype, and ast_rtp_mime_type::type.
Referenced by ast_rtp_codecs_payloads_set_rtpmap_type(), process_sdp_a_audio(), process_sdp_a_text(), and process_sdp_a_video().
void ast_rtp_codecs_payloads_unset | ( | struct ast_rtp_codecs * | codecs, |
struct ast_rtp_instance * | instance, | ||
int | payload | ||
) |
Remove payload 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 602 of file rtp_engine.c.
References ast_debug, AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::code, ast_rtp_instance::engine, ast_rtp_engine::payload_set, and ast_rtp_codecs::payloads.
Referenced by process_sdp_a_audio(), and process_sdp_a_video().
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 188 of file rtp_engine.c.
References ast_log(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_verb, ast_rtp_engine::destroy, LOG_WARNING, ast_rtp_engine::mod, ast_rtp_engine::name, ast_rtp_engine::new, ast_rtp_engine::read, and ast_rtp_engine::write.
int ast_rtp_engine_register_srtp | ( | struct ast_srtp_res * | srtp_res, |
struct ast_srtp_policy_res * | policy_res | ||
) |
Definition at line 1803 of file rtp_engine.c.
References policy_res, and srtp_res.
Referenced by res_srtp_init().
int ast_rtp_engine_srtp_is_registered | ( | void | ) |
Definition at line 1824 of file rtp_engine.c.
References res_srtp_policy.
Referenced by sdp_crypto_activate(), sdp_crypto_process(), sdp_crypto_setup(), set_crypto_policy(), and setup_srtp().
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 222 of file rtp_engine.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, and ast_rtp_engine::name.
Referenced by load_module(), and unload_module().
void ast_rtp_engine_unregister_srtp | ( | void | ) |
int ast_rtp_glue_register2 | ( | struct ast_rtp_glue * | glue, |
struct ast_module * | module | ||
) |
Register RTP glue.
glue | The glue to register |
module | Module that the RTP glue is part of |
0 | success |
-1 | failure |
Example usage:
This registers the RTP glue declared as example_rtp_glue with the RTP engine core, but does not associate a module with it.
Definition at line 237 of file rtp_engine.c.
References ast_log(), AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero(), ast_verb, LOG_WARNING, ast_rtp_glue::mod, 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 266 of file rtp_engine.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, 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 1744 of file rtp_engine.c.
References ast_rtp_engine::activate, and ast_rtp_instance::engine.
Referenced by handle_response_invite(), multicast_rtp_call(), and transmit_response_with_sdp().
int ast_rtp_instance_add_srtp_policy | ( | struct ast_rtp_instance * | instance, |
struct ast_srtp_policy * | remote_policy, | ||
struct ast_srtp_policy * | local_policy | ||
) |
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 |
0 | Success |
non-zero | Failure |
Definition at line 1829 of file rtp_engine.c.
References ast_srtp_res::add_stream, ast_srtp_res::create, ast_srtp_res::replace, and ast_rtp_instance::srtp.
Referenced by sdp_crypto_activate().
format_t ast_rtp_instance_available_formats | ( | struct ast_rtp_instance * | instance, |
format_t | to_endpoint, | ||
format_t | to_asterisk | ||
) |
Request the formats that can be transcoded.
instance | The RTP instance |
to_endpoint | Formats being sent/received towards the endpoint |
to_asterisk | Formats being sent/received towards Asterisk |
supported | formats |
Example usage:
This sees if it is possible to have ulaw communicated to the endpoint but signed linear received into Asterisk.
Definition at line 1733 of file rtp_engine.c.
References ast_translate_available_formats(), ast_rtp_engine::available_formats, ast_rtp_instance::engine, and formats.
Referenced by sip_call().
enum ast_bridge_result ast_rtp_instance_bridge | ( | struct ast_channel * | c0, |
struct ast_channel * | c1, | ||
int | flags, | ||
struct ast_frame ** | fo, | ||
struct ast_channel ** | rc, | ||
int | timeoutms | ||
) |
Bridge two channels that use RTP instances.
c0 | First channel part of the bridge |
c1 | Second channel part of the bridge |
flags | Bridging flags |
fo | If a frame needs to be passed up it is stored here |
rc | Channel that passed the above frame up |
timeoutms | How long the channels should be bridged for |
Bridge | result |
Definition at line 1274 of file rtp_engine.c.
References AST_BRIDGE_DTMF_CHANNEL_0, AST_BRIDGE_DTMF_CHANNEL_1, AST_BRIDGE_FAILED, AST_BRIDGE_FAILED_NOWARN, ast_channel_lock, ast_channel_trylock, ast_channel_unlock, ast_check_hangup(), ast_codec_pref_getsize(), ast_debug, ast_getformatname(), ast_log(), AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_LOCAL, AST_RTP_GLUE_RESULT_REMOTE, ast_rtp_instance_dtmf_mode_get(), ast_rtp_instance_get_glue(), ast_rtp_instance_get_remote_address(), ast_sockaddr_is_ipv4_mapped(), ast_verb, ast_rtp_instance::chan, ast_rtp_instance::codecs, ast_rtp_engine::dtmf_compatible, ast_rtp_instance::engine, ast_rtp_glue::get_codec, ast_rtp_glue::get_rtp_info, ast_rtp_glue::get_vrtp_info, ast_rtp_instance::glue, ast_rtp_engine::local_bridge, local_bridge_loop(), LOG_WARNING, ast_channel::name, ast_rtp_codecs::pref, ast_channel::rawreadformat, ast_channel::rawwriteformat, remote_bridge_loop(), ast_sockaddr::ss, ast_channel::tech, ast_channel::tech_pvt, ast_channel_tech::type, and unref_instance_cond().
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 767 of file rtp_engine.c.
References ast_rtp_engine::change_source, and ast_rtp_instance::engine.
Referenced by mgcp_indicate(), oh323_indicate(), sip_indicate(), and skinny_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 301 of file rtp_engine.c.
References ao2_ref.
Referenced by __oh323_destroy(), __sip_destroy(), cleanup_connection(), destroy_endpoint(), gtalk_free_pvt(), jingle_free_pvt(), mgcp_hangup(), multicast_rtp_hangup(), multicast_rtp_request(), oh323_alloc(), skinny_hangup(), start_rtp(), unalloc_sub(), and unistim_hangup().
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 736 of file rtp_engine.c.
References ast_rtp_engine::dtmf_begin, and ast_rtp_instance::engine.
Referenced by gtalk_digit_begin(), mgcp_senddigit_begin(), oh323_digit_begin(), and sip_senddigit_begin().
int ast_rtp_instance_dtmf_end | ( | struct ast_rtp_instance * | instance, |
char | digit | ||
) |
Stop sending a DTMF digit.
instance | The RTP instance to stop the DTMF on |
digit | What DTMF digit to stop |
0 | success |
-1 | failure |
Example usage:
This stops sending the DTMF '1' on the RTP instance pointed to by instance.
Definition at line 741 of file rtp_engine.c.
References ast_rtp_engine::dtmf_end, and ast_rtp_instance::engine.
Referenced by mgcp_senddigit_end(), and oh323_digit_end().
int ast_rtp_instance_dtmf_end_with_duration | ( | struct ast_rtp_instance * | instance, |
char | digit, | ||
unsigned int | duration | ||
) |
Definition at line 745 of file rtp_engine.c.
References ast_rtp_engine::dtmf_end_with_duration, and ast_rtp_instance::engine.
Referenced by gtalk_digit_end(), and sip_senddigit_end().
enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get | ( | struct ast_rtp_instance * | instance | ) |
Get the DTMF mode of an RTP instance.
instance | The RTP instance to get the DTMF mode of |
DTMF | mode |
Example usage:
This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
Definition at line 755 of file rtp_engine.c.
References ast_rtp_engine::dtmf_mode_get, and ast_rtp_instance::engine.
Referenced by ast_rtp_instance_bridge().
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 750 of file rtp_engine.c.
References ast_rtp_engine::dtmf_mode_set, and ast_rtp_instance::engine.
Referenced by enable_dsp_detect(), gtalk_alloc(), and sip_new().
int ast_rtp_instance_early_bridge | ( | struct ast_channel * | c0, |
struct ast_channel * | c1 | ||
) |
Early bridge two channels that use RTP instances.
c0 | First channel part of the bridge |
c1 | Second channel part of the bridge |
0 | success |
-1 | failure |
Definition at line 1509 of file rtp_engine.c.
References ast_channel_lock, ast_channel_trylock, ast_channel_unlock, ast_debug, ast_log(), 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, LOG_WARNING, ast_channel::name, ast_channel::tech, ast_channel_tech::type, unref_instance_cond(), and ast_rtp_glue::update_peer.
void ast_rtp_instance_early_bridge_make_compatible | ( | struct ast_channel * | c_dst, |
struct ast_channel * | c_src | ||
) |
Make two channels compatible for early bridging.
c_dst | Destination channel to copy to |
c_src | Source channel to copy from |
Definition at line 1423 of file rtp_engine.c.
References ast_channel_lock, ast_channel_trylock, ast_channel_unlock, ast_debug, ast_log(), ast_rtp_codecs_payloads_copy(), 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, LOG_WARNING, ast_channel::name, ast_channel::tech, ast_channel_tech::type, unref_instance_cond(), and ast_rtp_glue::update_peer.
Referenced by dial_exec_full(), and do_forward().
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 786 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::fd.
Referenced by __oh323_new(), __oh323_rtp_create(), __oh323_update_info(), gtalk_new(), jingle_new(), mgcp_new(), process_sdp(), sip_new(), sip_set_rtp_peer(), skinny_new(), start_rtp(), and unistim_new().
struct ast_rtp_glue* ast_rtp_instance_get_active_glue | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP glue in use on an RTP instance.
instance | The RTP instance |
pointer | to the glue |
Example:
This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
Definition at line 1793 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 419 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_remote_address | ( | struct ast_rtp_instance * | instance, |
struct ast_sockaddr * | address | ||
) |
Get the address of the remote endpoint that we are sending RTP to, comparing its address to another.
instance | The instance that we want to get the remote address for |
address | An initialized address that may be overwritten if the remote address is different |
0 | address was not changed |
1 | address was changed Example usage: |
This retrieves the current remote address set on the instance pointed to by instance and puts the value into the address structure.
Definition at line 436 of file rtp_engine.c.
References ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::remote_address.
Referenced by sip_set_rtp_peer().
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 1418 of file rtp_engine.c.
References ast_rtp_instance::bridged.
Referenced by ast_rtp_read(), bridge_p2p_rtp_write(), and dialog_needdestroy().
struct ast_channel* ast_rtp_instance_get_chan | ( | struct ast_rtp_instance * | instance | ) |
Get the channel that is associated with an RTP instance while in a bridge.
instance | The RTP instance |
pointer | to the channel |
Example:
This gets the channel associated with the RTP instance pointed to by 'instance'.
Definition at line 1798 of file rtp_engine.c.
References ast_rtp_instance::chan.
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 483 of file rtp_engine.c.
References ast_rtp_instance::codecs.
Referenced by __oh323_rtp_create(), add_codec_to_sdp(), add_noncodec_to_sdp(), add_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), ast_rtp_dtmf_begin(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), check_peer_ok(), create_addr_from_peer(), gtalk_alloc(), gtalk_is_answered(), gtalk_new(), gtalk_newcall(), jingle_new(), jingle_newcall(), multicast_rtp_write(), process_sdp(), process_sdp_a_audio(), set_dtmf_payload(), set_peer_capabilities(), setup_rtp_connection(), start_rtp(), and transmit_response_with_sdp().
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 369 of file rtp_engine.c.
References ast_rtp_instance::data.
Referenced by __rtp_recvfrom(), __rtp_sendto(), ast_rtcp_read(), ast_rtcp_write(), ast_rtcp_write_rr(), ast_rtcp_write_sr(), ast_rtp_alt_remote_address_set(), 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_stat(), ast_rtp_local_bridge(), ast_rtp_prop_set(), ast_rtp_qos_set(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_remote_address_set(), ast_rtp_sendcng(), ast_rtp_stop(), ast_rtp_stun_request(), ast_rtp_update_source(), ast_rtp_write(), bridge_p2p_rtp_write(), create_dtmf_frame(), multicast_rtp_activate(), multicast_rtp_destroy(), multicast_rtp_write(), process_cn_rfc3389(), process_dtmf_cisco(), process_dtmf_rfc2833(), red_write(), rtp_red_buffer(), and rtp_red_init().
struct ast_rtp_engine* ast_rtp_instance_get_engine | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP engine in use on an RTP instance.
instance | The RTP instance |
pointer | to the engine |
Example usage:
This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
Definition at line 1788 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 460 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 791 of file rtp_engine.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, and ast_rtp_glue::type.
Referenced by ast_rtp_instance_bridge(), ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_rtp_instance_make_compatible(), and remote_bridge_loop().
int ast_rtp_instance_get_hold_timeout | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP timeout value for when an RTP instance is on hold.
instance | The RTP instance |
timeout | value |
Example usage:
This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
Definition at line 1778 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout.
Referenced by check_rtp_timeout().
int ast_rtp_instance_get_keepalive | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP keepalive interval.
instance | The RTP instance |
period | Keepalive interval value |
Example usage:
This gets the RTP keepalive interval value for the RTP instance pointed to by 'instance'.
Definition at line 1783 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
Referenced by check_rtp_timeout().
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 430 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by add_sdp(), apply_directmedia_ha(), ast_rtp_prop_set(), external_rtp_create(), get_our_media_address(), gtalk_create_candidates(), handle_open_receive_channel_ack_message(), jingle_create_candidates(), multicast_send_control_packet(), oh323_set_rtp_peer(), sip_acf_channel_read(), skinny_set_rtp_peer(), start_rtp(), and unistim_set_rtp_peer().
int ast_rtp_instance_get_prop | ( | struct ast_rtp_instance * | instance, |
enum ast_rtp_property | property | ||
) |
Get the value of an RTP instance property.
instance | The RTP instance to get the property from |
property | The property to get |
Current | value of the property |
Example usage:
This returns the current value of the NAT property on the instance pointed to by instance.
Definition at line 478 of file rtp_engine.c.
References ast_rtp_instance::properties.
Referenced by ast_rtcp_read(), ast_rtp_dtmf_compatible(), ast_rtp_raw_write(), ast_rtp_read(), bridge_p2p_rtp_write(), process_dtmf_cisco(), and process_dtmf_rfc2833().
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 1609 of file rtp_engine.c.
References ast_rtp_instance_get_stats(), AST_RTP_INSTANCE_STAT_ALL, AST_RTP_INSTANCE_STAT_COMBINED_JITTER, AST_RTP_INSTANCE_STAT_COMBINED_LOSS, AST_RTP_INSTANCE_STAT_COMBINED_RTT, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, ast_rtp_instance_stats::local_maxjitter, ast_rtp_instance_stats::local_maxrxploss, ast_rtp_instance_stats::local_minjitter, ast_rtp_instance_stats::local_minrxploss, ast_rtp_instance_stats::local_normdevjitter, ast_rtp_instance_stats::local_normdevrxploss, ast_rtp_instance_stats::local_ssrc, ast_rtp_instance_stats::local_stdevjitter, ast_rtp_instance_stats::local_stdevrxploss, ast_rtp_instance_stats::maxrtt, ast_rtp_instance_stats::minrtt, ast_rtp_instance_stats::normdevrtt, ast_rtp_instance_stats::remote_maxjitter, ast_rtp_instance_stats::remote_maxrxploss, ast_rtp_instance_stats::remote_minjitter, ast_rtp_instance_stats::remote_minrxploss, ast_rtp_instance_stats::remote_normdevjitter, ast_rtp_instance_stats::remote_normdevrxploss, ast_rtp_instance_stats::remote_ssrc, ast_rtp_instance_stats::remote_stdevjitter, ast_rtp_instance_stats::remote_stdevrxploss, ast_rtp_instance_stats::rtt, ast_rtp_instance_stats::rxcount, ast_rtp_instance_stats::rxjitter, ast_rtp_instance_stats::rxploss, ast_rtp_instance_stats::stdevrtt, ast_rtp_instance_stats::txcount, ast_rtp_instance_stats::txjitter, and ast_rtp_instance_stats::txploss.
Referenced by ast_rtp_instance_set_stats_vars(), handle_request_bye(), sip_acf_channel_read(), and sip_hangup().
void ast_rtp_instance_get_remote_address | ( | struct ast_rtp_instance * | instance, |
struct ast_sockaddr * | address | ||
) |
Get the address of the remote endpoint that we are sending RTP to.
instance | The instance that we want to get the remote address for |
address | A structure to put the address into |
Example usage:
This retrieves the current remote address set on the instance pointed to by instance and puts the value into the address structure.
Definition at line 447 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::remote_address.
Referenced by add_sdp(), apply_directmedia_ha(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_continuation(), ast_rtp_dtmf_end_with_duration(), ast_rtp_instance_bridge(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), create_dtmf_frame(), gtalk_update_stun(), handle_response_invite(), multicast_rtp_write(), multicast_send_control_packet(), oh323_set_rtp_peer(), process_cn_rfc3389(), process_dtmf_rfc2833(), process_sdp(), remote_bridge_loop(), sip_acf_channel_read(), skinny_set_rtp_peer(), transmit_modify_with_sdp(), and unistim_set_rtp_peer().
struct ast_srtp* ast_rtp_instance_get_srtp | ( | struct ast_rtp_instance * | instance | ) |
Obtain the SRTP instance associated with an RTP instance.
instance | the RTP instance |
the | SRTP instance on success |
NULL | if no SRTP instance exists |
Definition at line 1849 of file rtp_engine.c.
References ast_rtp_instance::srtp.
Referenced by __rtp_recvfrom(), __rtp_sendto(), and ast_rtp_change_source().
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 1604 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::get_stat.
Referenced by ast_rtp_instance_get_quality(), ast_srtp_unprotect(), sdp_crypto_activate(), show_chanstats_cb(), and sip_acf_channel_read().
int ast_rtp_instance_get_timeout | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP timeout value.
instance | The RTP instance |
timeout | value |
Example usage:
This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
Definition at line 1773 of file rtp_engine.c.
References ast_rtp_instance::timeout.
Referenced by check_rtp_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 1693 of file rtp_engine.c.
References ao2_ref, ast_channel_lock, ast_channel_unlock, ast_log(), ast_rtp_instance_get_glue(), ast_rtp_instance::engine, ast_rtp_glue::get_rtp_info, LOG_ERROR, ast_rtp_engine::make_compatible, ast_channel::tech, ast_rtp_glue::type, and ast_channel_tech::type.
Referenced by sip_setoption().
struct ast_rtp_instance* ast_rtp_instance_new | ( | const char * | engine_name, |
struct sched_context * | sched, | ||
const struct ast_sockaddr * | sa, | ||
void * | data | ||
) |
Create a new RTP instance.
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 308 of file rtp_engine.c.
References ao2_alloc, ao2_ref, ast_debug, ast_log(), ast_module_ref(), ast_module_unref(), AST_RWLIST_FIRST, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_sockaddr_copy(), ast_strlen_zero(), ast_rtp_instance::engine, instance_destructor(), ast_rtp_instance::local_address, LOG_ERROR, ast_rtp_engine::mod, ast_rtp_engine::name, and ast_rtp_engine::new.
Referenced by __oh323_rtp_create(), dialog_initialize_rtp(), gtalk_alloc(), jingle_alloc(), multicast_rtp_request(), and start_rtp().
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 379 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::read.
Referenced by gtalk_rtp_read(), jingle_rtp_read(), mgcp_rtp_read(), oh323_read(), oh323_rtp_read(), sip_rtp_read(), skinny_rtp_read(), and unistim_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 1854 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::sendcng.
Referenced by check_rtp_timeout().
int ast_rtp_instance_set_alt_remote_address | ( | struct ast_rtp_instance * | instance, |
const struct ast_sockaddr * | address | ||
) |
Set the address of an an alternate RTP address to receive from.
instance | The RTP instance to change the address on |
address | Address to set it to |
0 | success |
-1 | failure |
Example usage:
This changes the alternate remote address that RTP will be sent to on instance to the address given in the sin structure.
Definition at line 405 of file rtp_engine.c.
References ast_rtp_instance::alt_remote_address, ast_rtp_engine::alt_remote_address_set, ast_sockaddr_copy(), and ast_rtp_instance::engine.
Referenced by handle_request_invite().
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 364 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 453 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 1763 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout, and ast_rtp_instance::timeout.
Referenced by check_rtp_timeout(), and dialog_initialize_rtp().
void ast_rtp_instance_set_keepalive | ( | struct ast_rtp_instance * | instance, |
int | timeout | ||
) |
Set the RTP keepalive interval.
instance | The RTP instance |
period | Value to set the keepalive interval to |
Example usage:
This sets the RTP keepalive interval on 'instance' to be 5000.
Definition at line 1768 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
Referenced by dialog_initialize_rtp().
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 384 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by ast_rtp_new().
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 469 of file rtp_engine.c.
References ast_rtp_instance::engine, ast_rtp_engine::prop_set, ast_rtp_instance::properties, and value.
Referenced by __oh323_rtp_create(), create_addr_from_peer(), dialog_initialize_rtp(), do_setnat(), gtalk_alloc(), handle_request_invite(), oh323_rtp_read(), process_sdp(), sip_dtmfmode(), sip_set_rtp_peer(), and start_rtp().
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 774 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::qos.
Referenced by __oh323_rtp_create(), dialog_initialize_rtp(), and start_rtp().
int ast_rtp_instance_set_read_format | ( | struct ast_rtp_instance * | instance, |
format_t | format | ||
) |
Request that the underlying RTP engine provide audio frames in a specific format.
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 1683 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_read_format.
Referenced by sip_new(), and sip_setoption().
int ast_rtp_instance_set_remote_address | ( | struct ast_rtp_instance * | instance, |
const struct ast_sockaddr * | address | ||
) |
Set the address of the remote endpoint that we are sending RTP to.
instance | The RTP instance to change the address on |
address | Address to set it to |
0 | success |
-1 | failure |
Example usage:
This changes the remote address that RTP will be sent to on instance to the address given in the sin structure.
Definition at line 391 of file rtp_engine.c.
References ast_sockaddr_copy(), ast_rtp_instance::engine, ast_rtp_instance::remote_address, and ast_rtp_engine::remote_address_set.
Referenced by ast_rtp_read(), ast_rtp_stop(), handle_open_receive_channel_ack_message(), multicast_rtp_request(), process_sdp(), setup_rtp_connection(), and start_rtp().
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 1649 of file rtp_engine.c.
References ast_bridged_channel(), 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_RTT, ast_channel::bridge, pbx_builtin_setvar_helper(), and quality.
Referenced by handle_request_bye(), and sip_hangup().
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 1758 of file rtp_engine.c.
References ast_rtp_instance::timeout.
Referenced by check_rtp_timeout(), and dialog_initialize_rtp().
int ast_rtp_instance_set_write_format | ( | struct ast_rtp_instance * | instance, |
format_t | format | ||
) |
Tell underlying RTP engine that audio frames will be provided in a specific format.
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 1688 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_write_format.
Referenced by sip_new(), and sip_setoption().
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 779 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::stop.
Referenced by process_sdp(), setup_rtp_connection(), and stop_media_flows().
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 1749 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::stun_request.
Referenced by gtalk_update_stun(), and jingle_update_stun().
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 760 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::update_source.
Referenced by mgcp_indicate(), oh323_indicate(), sip_answer(), sip_indicate(), sip_write(), and skinny_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 374 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::write.
Referenced by gtalk_write(), jingle_write(), mgcp_write(), multicast_rtp_write(), oh323_write(), sip_write(), skinny_write(), and unistim_write().
char* ast_rtp_lookup_mime_multiple2 | ( | struct ast_str * | buf, |
const format_t | capability, | ||
const int | asterisk_format, | ||
enum ast_rtp_options | options | ||
) |
Convert formats into a string and put them into a buffer.
buf | Buffer to put the mime output into |
capability | Formats that we are looking up |
asterisk_format | Non-zero if the given capability are Asterisk format capabilities |
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 703 of file rtp_engine.c.
References ast_rtp_lookup_mime_subtype2(), AST_RTP_MAX, ast_str_append(), ast_str_buffer(), format, and name.
Referenced by process_sdp().
const char* ast_rtp_lookup_mime_subtype2 | ( | const int | asterisk_format, |
const format_t | code, | ||
enum ast_rtp_options | options | ||
) |
Retrieve mime subtype information on a payload.
asterisk_format | Non-zero if the given code is an Asterisk format value |
code | Format to look up |
options | Additional options that may change the result |
Mime | subtype success |
NULL | failure |
Example usage:
This looks up the mime subtype for the ULAW format.
Definition at line 673 of file rtp_engine.c.
References ARRAY_LEN, AST_FORMAT_G726_AAL2, ast_rtp_mime_types, AST_RTP_OPT_G726_NONSTANDARD, ast_rtp_payload_type::asterisk_format, ast_rtp_mime_type::payload_type, and ast_rtp_mime_type::subtype.
Referenced by add_codec_to_sdp(), add_noncodec_to_sdp(), add_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), ast_rtp_lookup_mime_multiple2(), transmit_connect(), transmit_connect_with_sdp(), transmit_modify_request(), and transmit_modify_with_sdp().
unsigned int ast_rtp_lookup_sample_rate2 | ( | int | asterisk_format, |
format_t | code | ||
) |
Get the sample rate associated with known RTP payload types.
asterisk_format | True if the value in the 'code' parameter is an AST_FORMAT value |
code | Format code, either from AST_FORMAT list or from AST_RTP list |
Definition at line 690 of file rtp_engine.c.
References ARRAY_LEN, ast_rtp_mime_types, ast_rtp_payload_type::asterisk_format, ast_rtp_mime_type::payload_type, and ast_rtp_mime_type::sample_rate.
Referenced by add_codec_to_sdp(), add_noncodec_to_sdp(), add_tcodec_to_sdp(), and add_vcodec_to_sdp().
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 1599 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::red_buffer.
Referenced by sip_write().
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 1594 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::red_init.
Referenced by process_sdp().