#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_dtls_cfg |
| DTLS configuration structure. More... | |
| struct | ast_rtp_engine |
| struct | ast_rtp_engine_dtls |
| Structure that represents the optional DTLS SRTP support within an RTP engine. More... | |
| struct | ast_rtp_engine_ice |
| Structure that represents the optional ICE support within an RTP engine. More... | |
| struct | ast_rtp_engine_ice_candidate |
| Structure for an ICE candidate. More... | |
| struct | ast_rtp_glue |
| struct | ast_rtp_instance_stats |
| struct | ast_rtp_payload_type |
Defines | |
| #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 196 |
| #define | AST_RTP_STAT_SET(current_stat, combined, placement, value) |
| #define | AST_RTP_STAT_TERMINATOR(combined) |
Enumerations | |
| enum | ast_rtp_dtls_connection { AST_RTP_DTLS_CONNECTION_NEW, AST_RTP_DTLS_CONNECTION_EXISTING } |
| DTLS connection states. More... | |
| enum | ast_rtp_dtls_hash { AST_RTP_DTLS_HASH_SHA1 } |
| DTLS fingerprint hashes. More... | |
| enum | ast_rtp_dtls_setup { AST_RTP_DTLS_SETUP_ACTIVE, AST_RTP_DTLS_SETUP_PASSIVE, AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_SETUP_HOLDCONN } |
| DTLS setup types. More... | |
| enum | ast_rtp_dtmf_mode { AST_RTP_DTMF_MODE_NONE = 0, AST_RTP_DTMF_MODE_RFC2833, AST_RTP_DTMF_MODE_INBAND } |
| enum | ast_rtp_glue_result { AST_RTP_GLUE_RESULT_FORBID = 0, AST_RTP_GLUE_RESULT_REMOTE, AST_RTP_GLUE_RESULT_LOCAL } |
| enum | ast_rtp_ice_candidate_type { AST_RTP_ICE_CANDIDATE_TYPE_HOST, AST_RTP_ICE_CANDIDATE_TYPE_SRFLX, AST_RTP_ICE_CANDIDATE_TYPE_RELAYED } |
| ICE candidate types. More... | |
| enum | ast_rtp_instance_stat { AST_RTP_INSTANCE_STAT_ALL = 0, AST_RTP_INSTANCE_STAT_TXCOUNT, AST_RTP_INSTANCE_STAT_RXCOUNT, AST_RTP_INSTANCE_STAT_COMBINED_LOSS, AST_RTP_INSTANCE_STAT_TXPLOSS, AST_RTP_INSTANCE_STAT_RXPLOSS, AST_RTP_INSTANCE_STAT_REMOTE_MAXRXPLOSS, AST_RTP_INSTANCE_STAT_REMOTE_MINRXPLOSS, AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVRXPLOSS, AST_RTP_INSTANCE_STAT_REMOTE_STDEVRXPLOSS, AST_RTP_INSTANCE_STAT_LOCAL_MAXRXPLOSS, AST_RTP_INSTANCE_STAT_LOCAL_MINRXPLOSS, AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVRXPLOSS, AST_RTP_INSTANCE_STAT_LOCAL_STDEVRXPLOSS, AST_RTP_INSTANCE_STAT_COMBINED_JITTER, AST_RTP_INSTANCE_STAT_TXJITTER, AST_RTP_INSTANCE_STAT_RXJITTER, AST_RTP_INSTANCE_STAT_REMOTE_MAXJITTER, AST_RTP_INSTANCE_STAT_REMOTE_MINJITTER, AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVJITTER, AST_RTP_INSTANCE_STAT_REMOTE_STDEVJITTER, AST_RTP_INSTANCE_STAT_LOCAL_MAXJITTER, AST_RTP_INSTANCE_STAT_LOCAL_MINJITTER, AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVJITTER, AST_RTP_INSTANCE_STAT_LOCAL_STDEVJITTER, AST_RTP_INSTANCE_STAT_COMBINED_RTT, AST_RTP_INSTANCE_STAT_RTT, AST_RTP_INSTANCE_STAT_MAX_RTT, AST_RTP_INSTANCE_STAT_MIN_RTT, AST_RTP_INSTANCE_STAT_NORMDEVRTT, AST_RTP_INSTANCE_STAT_STDEVRTT, AST_RTP_INSTANCE_STAT_LOCAL_SSRC, AST_RTP_INSTANCE_STAT_REMOTE_SSRC } |
| enum | ast_rtp_instance_stat_field { AST_RTP_INSTANCE_STAT_FIELD_QUALITY = 0, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT } |
| enum | ast_rtp_options { AST_RTP_OPT_G726_NONSTANDARD = (1 << 0) } |
| enum | ast_rtp_property { AST_RTP_PROPERTY_NAT = 0, AST_RTP_PROPERTY_DTMF, AST_RTP_PROPERTY_DTMF_COMPENSATE, AST_RTP_PROPERTY_STUN, AST_RTP_PROPERTY_RTCP, AST_RTP_PROPERTY_MAX } |
Functions | |
| int | ast_rtp_codecs_find_payload_code (struct ast_rtp_codecs *codecs, int code) |
| Search for a payload code in the ast_rtp_codecs structure. | |
| 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 payload. | |
| void | ast_rtp_codecs_packetization_set (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, struct ast_codec_pref *prefs) |
| Set codec packetization preferences. | |
| int | ast_rtp_codecs_payload_code (struct ast_rtp_codecs *codecs, int asterisk_format, const struct ast_format *format, int code) |
| Retrieve a payload based on whether it is an Asterisk format and the code. | |
| void | ast_rtp_codecs_payload_formats (struct ast_rtp_codecs *codecs, struct ast_format_cap *astformats, int *nonastformats) |
| Retrieve all formats that were found. | |
| struct ast_rtp_payload_type | ast_rtp_codecs_payload_lookup (struct ast_rtp_codecs *codecs, int payload) |
| Retrieve payload information by payload. | |
| void | ast_rtp_codecs_payloads_clear (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance) |
| Clear payload information from an RTP instance. | |
| 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. | |
| 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. | |
| void | ast_rtp_codecs_payloads_destroy (struct ast_rtp_codecs *codecs) |
| Destroy the contents of an RTP codecs structure (but not the structure itself). | |
| int | ast_rtp_codecs_payloads_initialize (struct ast_rtp_codecs *codecs) |
| Initialize an RTP codecs structure. | |
| 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. | |
| 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. | |
| 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. | |
| void | ast_rtp_codecs_payloads_unset (struct ast_rtp_codecs *codecs, struct ast_rtp_instance *instance, int payload) |
| Remove payload information. | |
| void | ast_rtp_dtls_cfg_copy (const struct ast_rtp_dtls_cfg *src_cfg, struct ast_rtp_dtls_cfg *dst_cfg) |
| Copy contents of a DTLS configuration structure. | |
| void | ast_rtp_dtls_cfg_free (struct ast_rtp_dtls_cfg *dtls_cfg) |
| Free contents of a DTLS configuration structure. | |
| int | ast_rtp_dtls_cfg_parse (struct ast_rtp_dtls_cfg *dtls_cfg, const char *name, const char *value) |
| Parse DTLS related configuration options. | |
| int | ast_rtp_engine_load_format (const 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. | |
| 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 (const 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. | |
| void | ast_rtp_engine_unregister_srtp (void) |
| int | ast_rtp_glue_register2 (struct ast_rtp_glue *glue, struct ast_module *module) |
| Register RTP glue. | |
| int | ast_rtp_glue_unregister (struct ast_rtp_glue *glue) |
| Unregister RTP glue. | |
| int | ast_rtp_instance_activate (struct ast_rtp_instance *instance) |
| Indicate to the RTP engine that packets are now expected to be sent/received on the RTP instance. | |
| int | ast_rtp_instance_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. | |
| 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. | |
| 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. | |
| void | ast_rtp_instance_change_source (struct ast_rtp_instance *instance) |
| Indicate a new source of audio has dropped in and the ssrc should change. | |
| int | ast_rtp_instance_destroy (struct ast_rtp_instance *instance) |
| Destroy an RTP instance. | |
| int | ast_rtp_instance_dtmf_begin (struct ast_rtp_instance *instance, char digit) |
| Begin sending a DTMF digit. | |
| int | ast_rtp_instance_dtmf_end (struct ast_rtp_instance *instance, char digit) |
| Stop sending a DTMF digit. | |
| 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. | |
| 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. | |
| int | ast_rtp_instance_early_bridge (struct ast_channel *c0, struct ast_channel *c1) |
| Early bridge two channels that use RTP instances. | |
| void | ast_rtp_instance_early_bridge_make_compatible (struct ast_channel *c0, struct ast_channel *c1) |
| Make two channels compatible for early bridging. | |
| int | ast_rtp_instance_fd (struct ast_rtp_instance *instance, int rtcp) |
| Get the file descriptor for an RTP session (or RTCP). | |
| struct ast_rtp_glue * | ast_rtp_instance_get_active_glue (struct ast_rtp_instance *instance) |
| Get the RTP glue in use on an RTP instance. | |
| int | ast_rtp_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. | |
| 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. | |
| 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. | |
| 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. | |
| struct ast_rtp_codecs * | ast_rtp_instance_get_codecs (struct ast_rtp_instance *instance) |
| Get the codecs structure of an RTP instance. | |
| void * | ast_rtp_instance_get_data (struct ast_rtp_instance *instance) |
| Get the data portion of an RTP instance. | |
| 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. | |
| struct ast_rtp_engine * | ast_rtp_instance_get_engine (struct ast_rtp_instance *instance) |
| Get the RTP engine in use on an RTP instance. | |
| void * | ast_rtp_instance_get_extended_prop (struct ast_rtp_instance *instance, int property) |
| Get the value of an RTP instance extended property. | |
| struct ast_rtp_glue * | ast_rtp_instance_get_glue (const char *type) |
| Get the RTP glue that binds a channel to the RTP engine. | |
| 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. | |
| 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. | |
| int | ast_rtp_instance_get_keepalive (struct ast_rtp_instance *instance) |
| Get the RTP keepalive interval. | |
| void | ast_rtp_instance_get_local_address (struct ast_rtp_instance *instance, struct ast_sockaddr *address) |
| Get the local address that we are expecting RTP on. | |
| int | ast_rtp_instance_get_prop (struct ast_rtp_instance *instance, enum ast_rtp_property property) |
| Get the value of an RTP instance property. | |
| 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. | |
| 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. | |
| struct ast_srtp * | ast_rtp_instance_get_srtp (struct ast_rtp_instance *instance) |
| Obtain the SRTP instance associated with an RTP instance. | |
| int | ast_rtp_instance_get_stats (struct ast_rtp_instance *instance, struct ast_rtp_instance_stats *stats, enum ast_rtp_instance_stat stat) |
| Retrieve statistics about an RTP instance. | |
| int | ast_rtp_instance_get_timeout (struct ast_rtp_instance *instance) |
| Get the RTP timeout value. | |
| 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. | |
| 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. | |
| struct ast_frame * | ast_rtp_instance_read (struct ast_rtp_instance *instance, int rtcp) |
| Receive a frame over RTP. | |
| int | ast_rtp_instance_sendcng (struct ast_rtp_instance *instance, int level) |
| Send a comfort noise packet to the RTP instance. | |
| 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. | |
| void | ast_rtp_instance_set_data (struct ast_rtp_instance *instance, void *data) |
| Set the data portion of an RTP instance. | |
| 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. | |
| void | ast_rtp_instance_set_hold_timeout (struct ast_rtp_instance *instance, int timeout) |
| Set the RTP timeout value for when the instance is on hold. | |
| void | ast_rtp_instance_set_keepalive (struct ast_rtp_instance *instance, int timeout) |
| Set the RTP keepalive interval. | |
| 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. | |
| void | ast_rtp_instance_set_prop (struct ast_rtp_instance *instance, enum ast_rtp_property property, int value) |
| Set the value of an RTP instance property. | |
| int | ast_rtp_instance_set_qos (struct ast_rtp_instance *instance, int tos, int cos, const char *desc) |
| Set QoS parameters on an RTP session. | |
| int | ast_rtp_instance_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. | |
| 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. | |
| 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. | |
| void | ast_rtp_instance_set_timeout (struct ast_rtp_instance *instance, int timeout) |
| Set the RTP timeout value. | |
| 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. | |
| void | ast_rtp_instance_stop (struct ast_rtp_instance *instance) |
| Stop an RTP instance. | |
| 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. | |
| void | ast_rtp_instance_update_source (struct ast_rtp_instance *instance) |
| Indicate that the RTP marker bit should be set on an RTP stream. | |
| int | ast_rtp_instance_write (struct ast_rtp_instance *instance, struct ast_frame *frame) |
| Send a frame out over RTP. | |
| 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. | |
| const char * | ast_rtp_lookup_mime_subtype2 (const int asterisk_format, struct ast_format *format, int code, enum ast_rtp_options options) |
| Retrieve mime subtype information on a payload. | |
| unsigned int | ast_rtp_lookup_sample_rate2 (int asterisk_format, struct ast_format *format, int code) |
| Get the sample rate associated with known RTP payload types. | |
| int | ast_rtp_red_buffer (struct ast_rtp_instance *instance, struct ast_frame *frame) |
| Buffer a frame in an RTP instance for RED. | |
| int | ast_rtp_red_init (struct ast_rtp_instance *instance, int buffer_time, int *payloads, int generations) |
| Initialize RED support on an RTP instance. | |
Definition in file rtp_engine.h.
| #define AST_RED_MAX_GENERATION 5 |
| #define AST_RTP_CISCO_DTMF (1 << 2) |
DTMF (Cisco Proprietary)
Definition at line 226 of file rtp_engine.h.
Referenced by ast_rtp_engine_init(), and ast_rtp_read().
| #define AST_RTP_CN (1 << 1) |
'Comfort Noise' (RFC3389)
Definition at line 224 of file rtp_engine.h.
Referenced by ast_rtp_engine_init(), ast_rtp_read(), and ast_rtp_sendcng().
| #define AST_RTP_DTMF (1 << 0) |
DTMF (RFC2833)
Definition at line 222 of file rtp_engine.h.
Referenced by add_noncodec_to_sdp(), add_sdp(), ast_rtp_dtmf_begin(), ast_rtp_engine_init(), 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) |
| #define ast_rtp_glue_register | ( | glue | ) | ast_rtp_glue_register2(glue, ast_module_info->self) |
| #define AST_RTP_MAX AST_RTP_CISCO_DTMF |
Maximum RTP-specific code
Definition at line 228 of file rtp_engine.h.
Referenced by add_sdp(), and ast_rtp_lookup_mime_multiple2().
| #define AST_RTP_MAX_PT 196 |
Definition at line 82 of file rtp_engine.h.
Referenced by ast_rtp_codecs_get_payload_format(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_lookup(), ast_rtp_codecs_payloads_clear(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_default(), ast_rtp_codecs_payloads_initialize(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_codecs_payloads_unset(), ast_rtp_engine_unload_format(), and process_sdp_a_audio().
| #define AST_RTP_STAT_SET | ( | current_stat, | |||
| combined, | |||||
| placement, | |||||
| value | ) |
| #define AST_RTP_STAT_TERMINATOR | ( | combined | ) |
Value:
if (stat == combined) { \ return 0; \ }
Definition at line 313 of file rtp_engine.h.
Referenced by ast_rtp_get_stat().
DTLS connection states.
| AST_RTP_DTLS_CONNECTION_NEW | Endpoint wants to use a new connection |
| AST_RTP_DTLS_CONNECTION_EXISTING | Endpoint wishes to use existing connection |
Definition at line 365 of file rtp_engine.h.
00365 { 00366 AST_RTP_DTLS_CONNECTION_NEW, /*!< Endpoint wants to use a new connection */ 00367 AST_RTP_DTLS_CONNECTION_EXISTING, /*!< Endpoint wishes to use existing connection */ 00368 };
| enum ast_rtp_dtls_hash |
DTLS fingerprint hashes.
Definition at line 371 of file rtp_engine.h.
00371 { 00372 AST_RTP_DTLS_HASH_SHA1, /*!< SHA-1 fingerprint hash */ 00373 };
| enum ast_rtp_dtls_setup |
DTLS setup types.
Definition at line 357 of file rtp_engine.h.
00357 { 00358 AST_RTP_DTLS_SETUP_ACTIVE, /*!< Endpoint is willing to inititate connections */ 00359 AST_RTP_DTLS_SETUP_PASSIVE, /*!< Endpoint is willing to accept connections */ 00360 AST_RTP_DTLS_SETUP_ACTPASS, /*!< Endpoint is willing to both accept and initiate connections */ 00361 AST_RTP_DTLS_SETUP_HOLDCONN, /*!< Endpoint does not want the connection to be established right now */ 00362 };
| enum ast_rtp_dtmf_mode |
RTP DTMF Modes
Definition at line 119 of file rtp_engine.h.
00119 { 00120 /*! No DTMF is being carried over the RTP stream */ 00121 AST_RTP_DTMF_MODE_NONE = 0, 00122 /*! DTMF is being carried out of band using RFC2833 */ 00123 AST_RTP_DTMF_MODE_RFC2833, 00124 /*! DTMF is being carried inband over the RTP stream */ 00125 AST_RTP_DTMF_MODE_INBAND, 00126 };
| enum ast_rtp_glue_result |
Result codes when RTP glue is queried for information
| AST_RTP_GLUE_RESULT_FORBID | No remote or local bridging is permitted |
| AST_RTP_GLUE_RESULT_REMOTE | Move RTP stream to be remote between devices directly |
| AST_RTP_GLUE_RESULT_LOCAL | Perform RTP engine level bridging if possible |
Definition at line 129 of file rtp_engine.h.
00129 { 00130 /*! No remote or local bridging is permitted */ 00131 AST_RTP_GLUE_RESULT_FORBID = 0, 00132 /*! Move RTP stream to be remote between devices directly */ 00133 AST_RTP_GLUE_RESULT_REMOTE, 00134 /*! Perform RTP engine level bridging if possible */ 00135 AST_RTP_GLUE_RESULT_LOCAL, 00136 };
ICE candidate types.
Definition at line 319 of file rtp_engine.h.
00319 { 00320 AST_RTP_ICE_CANDIDATE_TYPE_HOST, /*!< ICE host candidate. A host candidate represents the actual local transport address in the host. */ 00321 AST_RTP_ICE_CANDIDATE_TYPE_SRFLX, /*!< ICE server reflexive candidate, which represents the public mapped address of the local address. */ 00322 AST_RTP_ICE_CANDIDATE_TYPE_RELAYED, /*!< ICE relayed candidate, which represents the address allocated in TURN server. */ 00323 };
Statistics that can be retrieved from an RTP instance
| AST_RTP_INSTANCE_STAT_ALL | Retrieve all statistics |
| AST_RTP_INSTANCE_STAT_TXCOUNT | Retrieve number of packets transmitted |
| AST_RTP_INSTANCE_STAT_RXCOUNT | Retrieve number of packets received |
| AST_RTP_INSTANCE_STAT_COMBINED_LOSS | Retrieve ALL statistics relating to packet loss |
| AST_RTP_INSTANCE_STAT_TXPLOSS | Retrieve number of packets lost for transmitting |
| AST_RTP_INSTANCE_STAT_RXPLOSS | Retrieve number of packets lost for receiving |
| AST_RTP_INSTANCE_STAT_REMOTE_MAXRXPLOSS | Retrieve maximum number of packets lost on remote side |
| AST_RTP_INSTANCE_STAT_REMOTE_MINRXPLOSS | Retrieve minimum number of packets lost on remote side |
| AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVRXPLOSS | Retrieve average number of packets lost on remote side |
| AST_RTP_INSTANCE_STAT_REMOTE_STDEVRXPLOSS | Retrieve standard deviation of packets lost on remote side |
| AST_RTP_INSTANCE_STAT_LOCAL_MAXRXPLOSS | Retrieve maximum number of packets lost on local side |
| AST_RTP_INSTANCE_STAT_LOCAL_MINRXPLOSS | Retrieve minimum number of packets lost on local side |
| AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVRXPLOSS | Retrieve average number of packets lost on local side |
| AST_RTP_INSTANCE_STAT_LOCAL_STDEVRXPLOSS | Retrieve standard deviation of packets lost on local side |
| AST_RTP_INSTANCE_STAT_COMBINED_JITTER | Retrieve ALL statistics relating to jitter |
| AST_RTP_INSTANCE_STAT_TXJITTER | Retrieve jitter on transmitted packets |
| AST_RTP_INSTANCE_STAT_RXJITTER | Retrieve jitter on received packets |
| AST_RTP_INSTANCE_STAT_REMOTE_MAXJITTER | Retrieve maximum jitter on remote side |
| AST_RTP_INSTANCE_STAT_REMOTE_MINJITTER | Retrieve minimum jitter on remote side |
| AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVJITTER | Retrieve average jitter on remote side |
| AST_RTP_INSTANCE_STAT_REMOTE_STDEVJITTER | Retrieve standard deviation jitter on remote side |
| AST_RTP_INSTANCE_STAT_LOCAL_MAXJITTER | Retrieve maximum jitter on local side |
| AST_RTP_INSTANCE_STAT_LOCAL_MINJITTER | Retrieve minimum jitter on local side |
| AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVJITTER | Retrieve average jitter on local side |
| AST_RTP_INSTANCE_STAT_LOCAL_STDEVJITTER | Retrieve standard deviation jitter on local side |
| AST_RTP_INSTANCE_STAT_COMBINED_RTT | Retrieve ALL statistics relating to round trip time |
| AST_RTP_INSTANCE_STAT_RTT | Retrieve round trip time |
| AST_RTP_INSTANCE_STAT_MAX_RTT | Retrieve maximum round trip time |
| AST_RTP_INSTANCE_STAT_MIN_RTT | Retrieve minimum round trip time |
| AST_RTP_INSTANCE_STAT_NORMDEVRTT | Retrieve average round trip time |
| AST_RTP_INSTANCE_STAT_STDEVRTT | Retrieve standard deviation round trip time |
| AST_RTP_INSTANCE_STAT_LOCAL_SSRC | Retrieve local SSRC |
| AST_RTP_INSTANCE_STAT_REMOTE_SSRC | Retrieve remote SSRC |
Definition at line 151 of file rtp_engine.h.
00151 { 00152 /*! Retrieve all statistics */ 00153 AST_RTP_INSTANCE_STAT_ALL = 0, 00154 /*! Retrieve number of packets transmitted */ 00155 AST_RTP_INSTANCE_STAT_TXCOUNT, 00156 /*! Retrieve number of packets received */ 00157 AST_RTP_INSTANCE_STAT_RXCOUNT, 00158 /*! Retrieve ALL statistics relating to packet loss */ 00159 AST_RTP_INSTANCE_STAT_COMBINED_LOSS, 00160 /*! Retrieve number of packets lost for transmitting */ 00161 AST_RTP_INSTANCE_STAT_TXPLOSS, 00162 /*! Retrieve number of packets lost for receiving */ 00163 AST_RTP_INSTANCE_STAT_RXPLOSS, 00164 /*! Retrieve maximum number of packets lost on remote side */ 00165 AST_RTP_INSTANCE_STAT_REMOTE_MAXRXPLOSS, 00166 /*! Retrieve minimum number of packets lost on remote side */ 00167 AST_RTP_INSTANCE_STAT_REMOTE_MINRXPLOSS, 00168 /*! Retrieve average number of packets lost on remote side */ 00169 AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVRXPLOSS, 00170 /*! Retrieve standard deviation of packets lost on remote side */ 00171 AST_RTP_INSTANCE_STAT_REMOTE_STDEVRXPLOSS, 00172 /*! Retrieve maximum number of packets lost on local side */ 00173 AST_RTP_INSTANCE_STAT_LOCAL_MAXRXPLOSS, 00174 /*! Retrieve minimum number of packets lost on local side */ 00175 AST_RTP_INSTANCE_STAT_LOCAL_MINRXPLOSS, 00176 /*! Retrieve average number of packets lost on local side */ 00177 AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVRXPLOSS, 00178 /*! Retrieve standard deviation of packets lost on local side */ 00179 AST_RTP_INSTANCE_STAT_LOCAL_STDEVRXPLOSS, 00180 /*! Retrieve ALL statistics relating to jitter */ 00181 AST_RTP_INSTANCE_STAT_COMBINED_JITTER, 00182 /*! Retrieve jitter on transmitted packets */ 00183 AST_RTP_INSTANCE_STAT_TXJITTER, 00184 /*! Retrieve jitter on received packets */ 00185 AST_RTP_INSTANCE_STAT_RXJITTER, 00186 /*! Retrieve maximum jitter on remote side */ 00187 AST_RTP_INSTANCE_STAT_REMOTE_MAXJITTER, 00188 /*! Retrieve minimum jitter on remote side */ 00189 AST_RTP_INSTANCE_STAT_REMOTE_MINJITTER, 00190 /*! Retrieve average jitter on remote side */ 00191 AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVJITTER, 00192 /*! Retrieve standard deviation jitter on remote side */ 00193 AST_RTP_INSTANCE_STAT_REMOTE_STDEVJITTER, 00194 /*! Retrieve maximum jitter on local side */ 00195 AST_RTP_INSTANCE_STAT_LOCAL_MAXJITTER, 00196 /*! Retrieve minimum jitter on local side */ 00197 AST_RTP_INSTANCE_STAT_LOCAL_MINJITTER, 00198 /*! Retrieve average jitter on local side */ 00199 AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVJITTER, 00200 /*! Retrieve standard deviation jitter on local side */ 00201 AST_RTP_INSTANCE_STAT_LOCAL_STDEVJITTER, 00202 /*! Retrieve ALL statistics relating to round trip time */ 00203 AST_RTP_INSTANCE_STAT_COMBINED_RTT, 00204 /*! Retrieve round trip time */ 00205 AST_RTP_INSTANCE_STAT_RTT, 00206 /*! Retrieve maximum round trip time */ 00207 AST_RTP_INSTANCE_STAT_MAX_RTT, 00208 /*! Retrieve minimum round trip time */ 00209 AST_RTP_INSTANCE_STAT_MIN_RTT, 00210 /*! Retrieve average round trip time */ 00211 AST_RTP_INSTANCE_STAT_NORMDEVRTT, 00212 /*! Retrieve standard deviation round trip time */ 00213 AST_RTP_INSTANCE_STAT_STDEVRTT, 00214 /*! Retrieve local SSRC */ 00215 AST_RTP_INSTANCE_STAT_LOCAL_SSRC, 00216 /*! Retrieve remote SSRC */ 00217 AST_RTP_INSTANCE_STAT_REMOTE_SSRC, 00218 };
Field statistics that can be retrieved from an RTP instance
Definition at line 139 of file rtp_engine.h.
00139 { 00140 /*! Retrieve quality information */ 00141 AST_RTP_INSTANCE_STAT_FIELD_QUALITY = 0, 00142 /*! Retrieve quality information about jitter */ 00143 AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, 00144 /*! Retrieve quality information about packet loss */ 00145 AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, 00146 /*! Retrieve quality information about round trip time */ 00147 AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, 00148 };
| enum ast_rtp_options |
Additional RTP options
Definition at line 113 of file rtp_engine.h.
00113 { 00114 /*! Remote side is using non-standard G.726 */ 00115 AST_RTP_OPT_G726_NONSTANDARD = (1 << 0), 00116 };
| enum ast_rtp_property |
RTP Properties that can be set on an RTP instance
| AST_RTP_PROPERTY_NAT | Enable symmetric RTP support |
| AST_RTP_PROPERTY_DTMF | RTP instance will be carrying DTMF (using RFC2833) |
| AST_RTP_PROPERTY_DTMF_COMPENSATE | Expect unreliable DTMF from remote party |
| AST_RTP_PROPERTY_STUN | Enable STUN support |
| AST_RTP_PROPERTY_RTCP | Enable RTCP support |
| AST_RTP_PROPERTY_MAX |
Maximum number of RTP properties supported.
|
Definition at line 92 of file rtp_engine.h.
00092 { 00093 /*! Enable symmetric RTP support */ 00094 AST_RTP_PROPERTY_NAT = 0, 00095 /*! RTP instance will be carrying DTMF (using RFC2833) */ 00096 AST_RTP_PROPERTY_DTMF, 00097 /*! Expect unreliable DTMF from remote party */ 00098 AST_RTP_PROPERTY_DTMF_COMPENSATE, 00099 /*! Enable STUN support */ 00100 AST_RTP_PROPERTY_STUN, 00101 /*! Enable RTCP support */ 00102 AST_RTP_PROPERTY_RTCP, 00103 00104 /*! 00105 * \brief Maximum number of RTP properties supported 00106 * 00107 * \note THIS MUST BE THE LAST ENTRY IN THIS ENUM. 00108 */ 00109 AST_RTP_PROPERTY_MAX, 00110 };
| int ast_rtp_codecs_find_payload_code | ( | struct ast_rtp_codecs * | codecs, | |
| int | code | |||
| ) |
Search for a payload code in the ast_rtp_codecs structure.
| codecs | Codecs structure to look in | |
| code | The format to look for |
| Numerical | payload or -1 if unable to find payload in codecs |
int payload = ast_rtp_codecs_payload_code(&codecs, 0);
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 765 of file rtp_engine.c.
References ao2_find, ao2_ref, OBJ_KEY, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_codecs::payloads, and type.
Referenced by bridge_p2p_rtp_write().
00766 { 00767 struct ast_rtp_payload_type *type; 00768 int res = -1; 00769 00770 /* Search the payload type in the codecs passed */ 00771 if ((type = ao2_find(codecs->payloads, &code, OBJ_NOLOCK | OBJ_KEY))) 00772 { 00773 res = type->payload; 00774 ao2_ref(type, -1); 00775 return res; 00776 } 00777 00778 return res; 00779 }
| struct ast_format* ast_rtp_codecs_get_payload_format | ( | struct ast_rtp_codecs * | codecs, | |
| int | payload | |||
| ) | [read] |
Retrieve the actual ast_format stored on the codecs structure for a specific payload.
| codecs | Codecs structure to look in | |
| payload | Numerical payload to look up |
| pointer | to format structure on success | |
| NULL | on failure |
Definition at line 673 of file rtp_engine.c.
References ao2_find, ao2_ref, AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_payload_type::format, format, OBJ_KEY, OBJ_NOLOCK, ast_rtp_codecs::payloads, and type.
Referenced by process_sdp_a_audio(), and process_sdp_a_video().
00674 { 00675 struct ast_rtp_payload_type *type; 00676 struct ast_format *format; 00677 00678 if (payload < 0 || payload >= AST_RTP_MAX_PT) { 00679 return NULL; 00680 } 00681 00682 if (!(type = ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK))) { 00683 return NULL; 00684 } 00685 00686 format = type->asterisk_format ? &type->format : NULL; 00687 00688 ao2_ref(type, -1); 00689 00690 return format; 00691 }
| 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 |
ast_rtp_codecs_packetization_set(&codecs, NULL, &prefs);
This sets the packetization preferences pointed to by prefs on the codecs structure pointed to by codecs.
Definition at line 866 of file rtp_engine.c.
References ast_rtp_instance::codecs, ast_rtp_instance::engine, ast_rtp_engine::packetization_set, and ast_rtp_codecs::pref.
Referenced by __oh323_rtp_create(), check_peer_ok(), create_addr_from_peer(), gtalk_new(), jingle_enable_video(), jingle_new(), process_sdp_a_audio(), set_peer_capabilities(), start_rtp(), and transmit_response_with_sdp().
00867 { 00868 codecs->pref = *prefs; 00869 00870 if (instance && instance->engine->packetization_set) { 00871 instance->engine->packetization_set(instance, &instance->codecs.pref); 00872 } 00873 }
| int ast_rtp_codecs_payload_code | ( | struct ast_rtp_codecs * | codecs, | |
| int | asterisk_format, | |||
| const struct ast_format * | format, | |||
| int | 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 Asterisk format is present | |
| format | Asterisk format to look for | |
| code | The format to look for |
| Numerical | payload |
int payload = ast_rtp_codecs_payload_code(&codecs, 1, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0), 0);
This looks for the numerical payload for ULAW in the codecs structure.
Definition at line 734 of file rtp_engine.c.
References ao2_callback, ao2_find, ao2_ref, ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, OBJ_KEY, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_codecs::payloads, ast_rtp_payload_type::rtp_code, rtp_payload_type_find_format(), static_RTP_PT, and type.
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(), jingle_add_payloads_to_description(), multicast_rtp_write(), and send_start_rtp().
00735 { 00736 struct ast_rtp_payload_type *type; 00737 int i, res = -1; 00738 00739 if (asterisk_format && format && (type = ao2_callback(codecs->payloads, OBJ_NOLOCK, rtp_payload_type_find_format, (void*)format))) { 00740 res = type->payload; 00741 ao2_ref(type, -1); 00742 return res; 00743 } else if (!asterisk_format && (type = ao2_find(codecs->payloads, &code, OBJ_NOLOCK | OBJ_KEY))) { 00744 res = type->payload; 00745 ao2_ref(type, -1); 00746 return res; 00747 } 00748 00749 ast_rwlock_rdlock(&static_RTP_PT_lock); 00750 for (i = 0; i < AST_RTP_MAX_PT; i++) { 00751 if (static_RTP_PT[i].asterisk_format && asterisk_format && format && 00752 (ast_format_cmp(format, &static_RTP_PT[i].format) != AST_FORMAT_CMP_NOT_EQUAL)) { 00753 res = i; 00754 break; 00755 } else if (!static_RTP_PT[i].asterisk_format && !asterisk_format && 00756 (static_RTP_PT[i].rtp_code == code)) { 00757 res = i; 00758 break; 00759 } 00760 } 00761 ast_rwlock_unlock(&static_RTP_PT_lock); 00762 00763 return res; 00764 }
| 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 |
struct ast_format_cap *astformats = ast_format_cap_alloc_nolock() int nonastformats; ast_rtp_codecs_payload_formats(&codecs, &astformats, &nonastformats);
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 717 of file rtp_engine.c.
References ao2_callback, ast_format_cap_remove_all(), OBJ_MULTIPLE, OBJ_NODATA, OBJ_NOLOCK, ast_rtp_codecs::payloads, rtp_payload_type_add_ast(), and rtp_payload_type_add_nonast().
Referenced by gtalk_is_answered(), gtalk_newcall(), jingle_interpret_description(), and process_sdp().
00718 { 00719 ast_format_cap_remove_all(astformats); 00720 *nonastformats = 0; 00721 00722 ao2_callback(codecs->payloads, OBJ_NODATA | OBJ_MULTIPLE | OBJ_NOLOCK, rtp_payload_type_add_ast, astformats); 00723 ao2_callback(codecs->payloads, OBJ_NODATA | OBJ_MULTIPLE | OBJ_NOLOCK, rtp_payload_type_add_nonast, nonastformats); 00724 }
| struct ast_rtp_payload_type ast_rtp_codecs_payload_lookup | ( | struct ast_rtp_codecs * | codecs, | |
| int | payload | |||
| ) | [read] |
Retrieve payload information by payload.
| codecs | Codecs structure to look in | |
| payload | Numerical payload to look up |
| Payload | information |
struct ast_rtp_payload_type payload_type; payload_type = ast_rtp_codecs_payload_lookup(&codecs, 0);
This looks up the information for payload '0' from the codecs structure.
Definition at line 650 of file rtp_engine.c.
References ao2_find, ao2_ref, AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_payload_type::asterisk_format, OBJ_KEY, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_payload_type::rtp_code, static_RTP_PT, and type.
Referenced by ast_rtp_read(), bridge_p2p_rtp_write(), process_sdp_a_audio(), and setup_rtp_connection().
00651 { 00652 struct ast_rtp_payload_type result = { .asterisk_format = 0, }, *type; 00653 00654 if (payload < 0 || payload >= AST_RTP_MAX_PT) { 00655 return result; 00656 } 00657 00658 if ((type = ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK))) { 00659 result = *type; 00660 ao2_ref(type, -1); 00661 } 00662 00663 if (!result.rtp_code && !result.asterisk_format) { 00664 ast_rwlock_rdlock(&static_RTP_PT_lock); 00665 result = static_RTP_PT[payload]; 00666 ast_rwlock_unlock(&static_RTP_PT_lock); 00667 } 00668 00669 return result; 00670 }
| 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 |
struct ast_rtp_codecs codecs; ast_rtp_codecs_payloads_clear(&codecs, NULL);
This clears the codecs structure and puts it into a pristine state.
Definition at line 451 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.
Referenced by gtalk_alloc(), and process_sdp().
00452 { 00453 ast_rtp_codecs_payloads_destroy(codecs); 00454 00455 if (instance && instance->engine && instance->engine->payload_set) { 00456 int i; 00457 for (i = 0; i < AST_RTP_MAX_PT; i++) { 00458 instance->engine->payload_set(instance, i, 0, NULL, 0); 00459 } 00460 } 00461 00462 ast_rtp_codecs_payloads_initialize(codecs); 00463 }
| 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 |
ast_rtp_codecs_payloads_copy(&codecs0, &codecs1, NULL);
This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.
Definition at line 499 of file rtp_engine.c.
References ao2_alloc, ao2_find, ao2_link_flags, ao2_ref, ast_debug, AST_RTP_MAX_PT, ast_rtp_payload_type::asterisk_format, ast_rtp_instance::engine, ast_rtp_payload_type::format, OBJ_KEY, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_engine::payload_set, ast_rtp_codecs::payloads, ast_rtp_payload_type::rtp_code, and type.
Referenced by ast_rtp_instance_early_bridge_make_compatible(), jingle_interpret_description(), and process_sdp().
00500 { 00501 int i; 00502 struct ast_rtp_payload_type *type; 00503 00504 for (i = 0; i < AST_RTP_MAX_PT; i++) { 00505 struct ast_rtp_payload_type *new_type; 00506 00507 if (!(type = ao2_find(src->payloads, &i, OBJ_KEY | OBJ_NOLOCK))) { 00508 continue; 00509 } 00510 00511 if (!(new_type = ao2_alloc(sizeof(*new_type), NULL))) { 00512 continue; 00513 } 00514 00515 ast_debug(2, "Copying payload %d from %p to %p\n", i, src, dest); 00516 00517 new_type->payload = i; 00518 *new_type = *type; 00519 00520 ao2_link_flags(dest->payloads, new_type, OBJ_NOLOCK); 00521 00522 ao2_ref(new_type, -1); 00523 00524 if (instance && instance->engine && instance->engine->payload_set) { 00525 instance->engine->payload_set(instance, i, type->asterisk_format, &type->format, type->rtp_code); 00526 } 00527 00528 ao2_ref(type, -1); 00529 } 00530 }
| 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 |
struct ast_rtp_codecs codecs; ast_rtp_codecs_payloads_default(&codecs, NULL);
This sets the default payloads on the codecs structure.
Definition at line 465 of file rtp_engine.c.
References ao2_alloc, ao2_link_flags, ao2_ref, ast_format_copy(), AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_payload_type::asterisk_format, ast_rtp_instance::engine, ast_rtp_payload_type::format, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_engine::payload_set, ast_rtp_codecs::payloads, ast_rtp_payload_type::rtp_code, static_RTP_PT, and type.
00466 { 00467 int i; 00468 00469 ast_rwlock_rdlock(&static_RTP_PT_lock); 00470 for (i = 0; i < AST_RTP_MAX_PT; i++) { 00471 if (static_RTP_PT[i].rtp_code || static_RTP_PT[i].asterisk_format) { 00472 struct ast_rtp_payload_type *type; 00473 00474 if (!(type = ao2_alloc(sizeof(*type), NULL))) { 00475 /* Unfortunately if this occurs the payloads container will not contain all possible default payloads 00476 * but we err on the side of doing what we can in the hopes that the extreme memory conditions which 00477 * caused this to occur will go away. 00478 */ 00479 continue; 00480 } 00481 00482 type->payload = i; 00483 type->asterisk_format = static_RTP_PT[i].asterisk_format; 00484 type->rtp_code = static_RTP_PT[i].rtp_code; 00485 ast_format_copy(&type->format, &static_RTP_PT[i].format); 00486 00487 ao2_link_flags(codecs->payloads, type, OBJ_NOLOCK); 00488 00489 if (instance && instance->engine && instance->engine->payload_set) { 00490 instance->engine->payload_set(instance, i, type->asterisk_format, &type->format, type->rtp_code); 00491 } 00492 00493 ao2_ref(type, -1); 00494 } 00495 } 00496 ast_rwlock_unlock(&static_RTP_PT_lock); 00497 }
| 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 |
struct ast_rtp_codecs codecs; ast_rtp_codecs_payloads_destroy(&codecs);
Definition at line 446 of file rtp_engine.c.
References ao2_cleanup, and ast_rtp_codecs::payloads.
Referenced by ast_rtp_codecs_payloads_clear(), instance_destructor(), jingle_interpret_description(), and process_sdp().
00447 { 00448 ao2_cleanup(codecs->payloads); 00449 }
| 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 |
struct ast_rtp_codecs codecs; ast_rtp_codecs_payloads_initialize(&codecs);
Definition at line 437 of file rtp_engine.c.
References ao2_container_alloc, AST_RTP_MAX_PT, ast_rtp_codecs::payloads, rtp_payload_type_cmp(), and rtp_payload_type_hash().
Referenced by ast_rtp_codecs_payloads_clear(), ast_rtp_instance_new(), jingle_interpret_description(), and process_sdp().
00438 { 00439 if (!(codecs->payloads = ao2_container_alloc(AST_RTP_MAX_PT, rtp_payload_type_hash, rtp_payload_type_cmp))) { 00440 return -1; 00441 } 00442 00443 return 0; 00444 }
| 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 |
ast_rtp_codecs_payloads_set_m_type(&codecs, NULL, 0);
This records that the numerical payload '0' was seen in the codecs structure.
Definition at line 532 of file rtp_engine.c.
References ao2_alloc, ao2_find, ao2_link_flags, ao2_ref, ast_debug, ast_format_copy(), AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_payload_type::asterisk_format, ast_rtp_instance::engine, ast_rtp_payload_type::format, OBJ_KEY, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_engine::payload_set, ast_rtp_codecs::payloads, ast_rtp_payload_type::rtp_code, static_RTP_PT, and type.
Referenced by gtalk_is_answered(), gtalk_newcall(), jingle_interpret_description(), jingle_newcall(), and process_sdp().
00533 { 00534 struct ast_rtp_payload_type *type; 00535 00536 ast_rwlock_rdlock(&static_RTP_PT_lock); 00537 00538 if (payload < 0 || payload >= AST_RTP_MAX_PT) { 00539 ast_rwlock_unlock(&static_RTP_PT_lock); 00540 return; 00541 } 00542 00543 if (!(type = ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK))) { 00544 if (!(type = ao2_alloc(sizeof(*type), NULL))) { 00545 ast_rwlock_unlock(&static_RTP_PT_lock); 00546 return; 00547 } 00548 type->payload = payload; 00549 ao2_link_flags(codecs->payloads, type, OBJ_NOLOCK); 00550 } 00551 00552 type->asterisk_format = static_RTP_PT[payload].asterisk_format; 00553 type->rtp_code = static_RTP_PT[payload].rtp_code; 00554 type->payload = payload; 00555 ast_format_copy(&type->format, &static_RTP_PT[payload].format); 00556 00557 ast_debug(1, "Setting payload %d based on m type on %p\n", payload, codecs); 00558 00559 if (instance && instance->engine && instance->engine->payload_set) { 00560 instance->engine->payload_set(instance, payload, type->asterisk_format, &type->format, type->rtp_code); 00561 } 00562 00563 ao2_ref(type, -1); 00564 00565 ast_rwlock_unlock(&static_RTP_PT_lock); 00566 }
| 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 |
ast_rtp_codecs_payloads_set_rtpmap_type(&codecs, NULL, 0, "audio", "PCMU", 0);
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 630 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_interpret_description(), jingle_newcall(), process_sdp(), set_dtmf_payload(), and setup_rtp_connection().
00631 { 00632 return ast_rtp_codecs_payloads_set_rtpmap_type_rate(codecs, instance, payload, mimetype, mimesubtype, options, 0); 00633 }
| 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 |
| 0 | on success | |
| -1 | if the payload type is out of range | |
| -2 | if the mimeType/mimeSubtype combination was not found |
Definition at line 568 of file rtp_engine.c.
References ao2_alloc, ao2_find, ao2_link_flags, ao2_ref, AST_FORMAT_G726, AST_FORMAT_G726_AAL2, ast_format_set(), AST_RTP_MAX_PT, ast_rtp_mime_types, AST_RTP_OPT_G726_NONSTANDARD, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_payload_type::asterisk_format, ast_rtp_instance::engine, ast_rtp_payload_type::format, ast_format::id, OBJ_KEY, OBJ_NOLOCK, ast_rtp_payload_type::payload, ast_rtp_engine::payload_set, ast_rtp_mime_type::payload_type, ast_rtp_codecs::payloads, ast_rtp_payload_type::rtp_code, ast_rtp_mime_type::sample_rate, ast_rtp_mime_type::subtype, ast_rtp_mime_type::type, and type.
Referenced by ast_rtp_codecs_payloads_set_rtpmap_type(), jingle_interpret_description(), process_sdp_a_audio(), process_sdp_a_text(), and process_sdp_a_video().
00572 { 00573 unsigned int i; 00574 int found = 0; 00575 00576 if (pt < 0 || pt >= AST_RTP_MAX_PT) 00577 return -1; /* bogus payload type */ 00578 00579 ast_rwlock_rdlock(&mime_types_lock); 00580 for (i = 0; i < mime_types_len; ++i) { 00581 const struct ast_rtp_mime_type *t = &ast_rtp_mime_types[i]; 00582 struct ast_rtp_payload_type *type; 00583 00584 if (strcasecmp(mimesubtype, t->subtype)) { 00585 continue; 00586 } 00587 00588 if (strcasecmp(mimetype, t->type)) { 00589 continue; 00590 } 00591 00592 /* if both sample rates have been supplied, and they don't match, 00593 * then this not a match; if one has not been supplied, then the 00594 * rates are not compared */ 00595 if (sample_rate && t->sample_rate && 00596 (sample_rate != t->sample_rate)) { 00597 continue; 00598 } 00599 00600 found = 1; 00601 00602 if (!(type = ao2_find(codecs->payloads, &pt, OBJ_KEY | OBJ_NOLOCK))) { 00603 if (!(type = ao2_alloc(sizeof(*type), NULL))) { 00604 continue; 00605 } 00606 type->payload = pt; 00607 ao2_link_flags(codecs->payloads, type, OBJ_NOLOCK); 00608 } 00609 00610 *type = t->payload_type; 00611 type->payload = pt; 00612 00613 if ((t->payload_type.format.id == AST_FORMAT_G726) && t->payload_type.asterisk_format && (options & AST_RTP_OPT_G726_NONSTANDARD)) { 00614 ast_format_set(&type->format, AST_FORMAT_G726_AAL2, 0); 00615 } 00616 00617 if (instance && instance->engine && instance->engine->payload_set) { 00618 instance->engine->payload_set(instance, pt, type->asterisk_format, &type->format, type->rtp_code); 00619 } 00620 00621 ao2_ref(type, -1); 00622 00623 break; 00624 } 00625 ast_rwlock_unlock(&mime_types_lock); 00626 00627 return (found ? 0 : -2); 00628 }
| 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 |
ast_rtp_codecs_payloads_unset(&codecs, NULL, 0);
This clears the payload '0' from the codecs structure. It will be as if it was never set.
Definition at line 635 of file rtp_engine.c.
References ao2_find, ast_debug, AST_RTP_MAX_PT, ast_rtp_instance::engine, OBJ_KEY, OBJ_NODATA, OBJ_NOLOCK, OBJ_UNLINK, ast_rtp_engine::payload_set, and ast_rtp_codecs::payloads.
Referenced by process_sdp_a_audio(), and process_sdp_a_video().
00636 { 00637 if (payload < 0 || payload >= AST_RTP_MAX_PT) { 00638 return; 00639 } 00640 00641 ast_debug(2, "Unsetting payload %d on %p\n", payload, codecs); 00642 00643 ao2_find(codecs->payloads, &payload, OBJ_KEY | OBJ_NOLOCK | OBJ_NODATA | OBJ_UNLINK); 00644 00645 if (instance && instance->engine && instance->engine->payload_set) { 00646 instance->engine->payload_set(instance, payload, 0, NULL, 0); 00647 } 00648 }
| 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 2108 of file rtp_engine.c.
References 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::pvtfile, ast_rtp_dtls_cfg::rekey, ast_rtp_dtls_cfg::suite, and ast_rtp_dtls_cfg::verify.
Referenced by check_peer_ok(), and create_addr_from_peer().
02109 { 02110 dst_cfg->enabled = src_cfg->enabled; 02111 dst_cfg->verify = src_cfg->verify; 02112 dst_cfg->rekey = src_cfg->rekey; 02113 dst_cfg->suite = src_cfg->suite; 02114 dst_cfg->certfile = ast_strdup(src_cfg->certfile); 02115 dst_cfg->pvtfile = ast_strdup(src_cfg->pvtfile); 02116 dst_cfg->cipher = ast_strdup(src_cfg->cipher); 02117 dst_cfg->cafile = ast_strdup(src_cfg->cafile); 02118 dst_cfg->capath = ast_strdup(src_cfg->capath); 02119 dst_cfg->default_setup = src_cfg->default_setup; 02120 }
| 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 2122 of file rtp_engine.c.
References ast_free, ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::cipher, and ast_rtp_dtls_cfg::pvtfile.
Referenced by __sip_destroy(), and sip_destroy_peer().
02123 { 02124 ast_free(dtls_cfg->certfile); 02125 ast_free(dtls_cfg->pvtfile); 02126 ast_free(dtls_cfg->cipher); 02127 ast_free(dtls_cfg->cafile); 02128 ast_free(dtls_cfg->capath); 02129 }
| 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 2068 of file rtp_engine.c.
References ast_free, AST_RTP_DTLS_SETUP_ACTIVE, AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_SETUP_PASSIVE, 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::pvtfile, ast_rtp_dtls_cfg::rekey, and ast_rtp_dtls_cfg::verify.
Referenced by build_peer().
02069 { 02070 if (!strcasecmp(name, "dtlsenable")) { 02071 dtls_cfg->enabled = ast_true(value) ? 1 : 0; 02072 } else if (!strcasecmp(name, "dtlsverify")) { 02073 dtls_cfg->verify = ast_true(value) ? 1 : 0; 02074 } else if (!strcasecmp(name, "dtlsrekey")) { 02075 if (sscanf(value, "%30u", &dtls_cfg->rekey) != 1) { 02076 return -1; 02077 } 02078 } else if (!strcasecmp(name, "dtlscertfile")) { 02079 ast_free(dtls_cfg->certfile); 02080 dtls_cfg->certfile = ast_strdup(value); 02081 } else if (!strcasecmp(name, "dtlsprivatekey")) { 02082 ast_free(dtls_cfg->pvtfile); 02083 dtls_cfg->pvtfile = ast_strdup(value); 02084 } else if (!strcasecmp(name, "dtlscipher")) { 02085 ast_free(dtls_cfg->cipher); 02086 dtls_cfg->cipher = ast_strdup(value); 02087 } else if (!strcasecmp(name, "dtlscafile")) { 02088 ast_free(dtls_cfg->cafile); 02089 dtls_cfg->cafile = ast_strdup(value); 02090 } else if (!strcasecmp(name, "dtlscapath") || !strcasecmp(name, "dtlscadir")) { 02091 ast_free(dtls_cfg->capath); 02092 dtls_cfg->capath = ast_strdup(value); 02093 } else if (!strcasecmp(name, "dtlssetup")) { 02094 if (!strcasecmp(value, "active")) { 02095 dtls_cfg->default_setup = AST_RTP_DTLS_SETUP_ACTIVE; 02096 } else if (!strcasecmp(value, "passive")) { 02097 dtls_cfg->default_setup = AST_RTP_DTLS_SETUP_PASSIVE; 02098 } else if (!strcasecmp(value, "actpass")) { 02099 dtls_cfg->default_setup = AST_RTP_DTLS_SETUP_ACTPASS; 02100 } 02101 } else { 02102 return -1; 02103 } 02104 02105 return 0; 02106 }
| int ast_rtp_engine_load_format | ( | const struct ast_format * | format | ) |
Custom formats declared in codecs.conf at startup must be communicated to the rtp_engine so their mime type can payload number can be initialized.
Definition at line 2181 of file rtp_engine.c.
References add_static_payload(), AST_FORMAT_CELT, ast_format_rate(), AST_FORMAT_SILK, ast_format::id, and set_next_mime_type().
Referenced by ast_format_attr_reg_interface().
02182 { 02183 switch (format->id) { 02184 case AST_FORMAT_SILK: 02185 set_next_mime_type(format, 0, "audio", "SILK", ast_format_rate(format)); 02186 add_static_payload(-1, format, 0); 02187 break; 02188 case AST_FORMAT_CELT: 02189 set_next_mime_type(format, 0, "audio", "CELT", ast_format_rate(format)); 02190 add_static_payload(-1, format, 0); 02191 break; 02192 default: 02193 break; 02194 } 02195 02196 return 0; 02197 }
| 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 |
ast_rtp_engine_register2(&example_rtp_engine, NULL);
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 114 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, ast_rtp_engine::entry, LOG_WARNING, ast_rtp_engine::mod, ast_rtp_engine::name, ast_rtp_engine::new, ast_rtp_engine::read, and ast_rtp_engine::write.
00115 { 00116 struct ast_rtp_engine *current_engine; 00117 00118 /* Perform a sanity check on the engine structure to make sure it has the basics */ 00119 if (ast_strlen_zero(engine->name) || !engine->new || !engine->destroy || !engine->write || !engine->read) { 00120 ast_log(LOG_WARNING, "RTP Engine '%s' failed sanity check so it was not registered.\n", !ast_strlen_zero(engine->name) ? engine->name : "Unknown"); 00121 return -1; 00122 } 00123 00124 /* Link owner module to the RTP engine for reference counting purposes */ 00125 engine->mod = module; 00126 00127 AST_RWLIST_WRLOCK(&engines); 00128 00129 /* Ensure that no two modules with the same name are registered at the same time */ 00130 AST_RWLIST_TRAVERSE(&engines, current_engine, entry) { 00131 if (!strcmp(current_engine->name, engine->name)) { 00132 ast_log(LOG_WARNING, "An RTP engine with the name '%s' has already been registered.\n", engine->name); 00133 AST_RWLIST_UNLOCK(&engines); 00134 return -1; 00135 } 00136 } 00137 00138 /* The engine survived our critique. Off to the list it goes to be used */ 00139 AST_RWLIST_INSERT_TAIL(&engines, engine, entry); 00140 00141 AST_RWLIST_UNLOCK(&engines); 00142 00143 ast_verb(2, "Registered RTP engine '%s'\n", engine->name); 00144 00145 return 0; 00146 }
| int ast_rtp_engine_register_srtp | ( | struct ast_srtp_res * | srtp_res, | |
| struct ast_srtp_policy_res * | policy_res | |||
| ) |
Definition at line 1998 of file rtp_engine.c.
Referenced by res_srtp_init().
01999 { 02000 if (res_srtp || res_srtp_policy) { 02001 return -1; 02002 } 02003 if (!srtp_res || !policy_res) { 02004 return -1; 02005 } 02006 02007 res_srtp = srtp_res; 02008 res_srtp_policy = policy_res; 02009 02010 return 0; 02011 }
| int ast_rtp_engine_srtp_is_registered | ( | void | ) |
Definition at line 2019 of file rtp_engine.c.
Referenced by dialog_initialize_dtls_srtp(), sdp_crypto_activate(), sdp_crypto_process(), sdp_crypto_setup(), set_crypto_policy(), and setup_srtp().
02020 { 02021 return res_srtp && res_srtp_policy; 02022 }
| int ast_rtp_engine_unload_format | ( | const struct ast_format * | format | ) |
Formats requiring the use of a format attribute interface must have that interface registered in order for the rtp engine to handle it correctly. If an attribute interface is unloaded, this function must be called to notify the rtp_engine.
Definition at line 2199 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_RTP_MAX_PT, ast_rtp_mime_types, ast_rwlock_unlock, ast_rwlock_wrlock, and static_RTP_PT.
Referenced by ast_format_attr_unreg_interface().
02200 { 02201 int x; 02202 int y = 0; 02203 02204 ast_rwlock_wrlock(&static_RTP_PT_lock); 02205 /* remove everything pertaining to this format id from the lists */ 02206 for (x = 0; x < AST_RTP_MAX_PT; x++) { 02207 if (ast_format_cmp(&static_RTP_PT[x].format, format) == AST_FORMAT_CMP_EQUAL) { 02208 memset(&static_RTP_PT[x], 0, sizeof(struct ast_rtp_payload_type)); 02209 } 02210 } 02211 ast_rwlock_unlock(&static_RTP_PT_lock); 02212 02213 02214 ast_rwlock_wrlock(&mime_types_lock); 02215 /* rebuild the list skipping the items matching this id */ 02216 for (x = 0; x < mime_types_len; x++) { 02217 if (ast_format_cmp(&ast_rtp_mime_types[x].payload_type.format, format) == AST_FORMAT_CMP_EQUAL) { 02218 continue; 02219 } 02220 ast_rtp_mime_types[y] = ast_rtp_mime_types[x]; 02221 y++; 02222 } 02223 mime_types_len = y; 02224 ast_rwlock_unlock(&mime_types_lock); 02225 return 0; 02226 }
| 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 |
ast_rtp_engine_unregister(&example_rtp_engine);
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 148 of file rtp_engine.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_rtp_engine::entry, and ast_rtp_engine::name.
Referenced by load_module(), and unload_module().
00149 { 00150 struct ast_rtp_engine *current_engine = NULL; 00151 00152 AST_RWLIST_WRLOCK(&engines); 00153 00154 if ((current_engine = AST_RWLIST_REMOVE(&engines, engine, entry))) { 00155 ast_verb(2, "Unregistered RTP engine '%s'\n", engine->name); 00156 } 00157 00158 AST_RWLIST_UNLOCK(&engines); 00159 00160 return current_engine ? 0 : -1; 00161 }
| void ast_rtp_engine_unregister_srtp | ( | void | ) |
Definition at line 2013 of file rtp_engine.c.
Referenced by res_srtp_shutdown().
02014 { 02015 res_srtp = NULL; 02016 res_srtp_policy = NULL; 02017 }
| 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 |
ast_rtp_glue_register2(&example_rtp_glue, NULL);
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 163 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_glue::entry, LOG_WARNING, ast_rtp_glue::mod, and ast_rtp_glue::type.
00164 { 00165 struct ast_rtp_glue *current_glue = NULL; 00166 00167 if (ast_strlen_zero(glue->type)) { 00168 return -1; 00169 } 00170 00171 glue->mod = module; 00172 00173 AST_RWLIST_WRLOCK(&glues); 00174 00175 AST_RWLIST_TRAVERSE(&glues, current_glue, entry) { 00176 if (!strcasecmp(current_glue->type, glue->type)) { 00177 ast_log(LOG_WARNING, "RTP glue with the name '%s' has already been registered.\n", glue->type); 00178 AST_RWLIST_UNLOCK(&glues); 00179 return -1; 00180 } 00181 } 00182 00183 AST_RWLIST_INSERT_TAIL(&glues, glue, entry); 00184 00185 AST_RWLIST_UNLOCK(&glues); 00186 00187 ast_verb(2, "Registered RTP glue '%s'\n", glue->type); 00188 00189 return 0; 00190 }
| int ast_rtp_glue_unregister | ( | struct ast_rtp_glue * | glue | ) |
Unregister RTP glue.
| glue | The glue to unregister |
| 0 | success | |
| -1 | failure |
ast_rtp_glue_unregister(&example_rtp_glue);
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 192 of file rtp_engine.c.
References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_rtp_glue::entry, and ast_rtp_glue::type.
Referenced by load_module(), and unload_module().
00193 { 00194 struct ast_rtp_glue *current_glue = NULL; 00195 00196 AST_RWLIST_WRLOCK(&glues); 00197 00198 if ((current_glue = AST_RWLIST_REMOVE(&glues, glue, entry))) { 00199 ast_verb(2, "Unregistered RTP glue '%s'\n", glue->type); 00200 } 00201 00202 AST_RWLIST_UNLOCK(&glues); 00203 00204 return current_glue ? 0 : -1; 00205 }
| 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 |
ast_rtp_instance_activate(instance);
This tells the underlying RTP engine of instance that packets will now flow.
Definition at line 1939 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 2024 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().
02025 { 02026 int res = 0; 02027 02028 if (!res_srtp) { 02029 return -1; 02030 } 02031 02032 if (!instance->srtp) { 02033 res = res_srtp->create(&instance->srtp, instance, remote_policy); 02034 } else { 02035 res = res_srtp->replace(&instance->srtp, instance, remote_policy); 02036 } 02037 if (!res) { 02038 res = res_srtp->add_stream(instance->srtp, local_policy); 02039 } 02040 02041 return res; 02042 }
| 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. |
ast_rtp_instance_available_formats(instance, to_capabilities, from_capabilities, result_capabilities);
This sees if it is possible to have ulaw communicated to the endpoint but signed linear received into Asterisk.
Definition at line 1927 of file rtp_engine.c.
References ast_format_cap_is_empty(), ast_translate_available_formats(), ast_rtp_engine::available_formats, and ast_rtp_instance::engine.
Referenced by sip_call().
01928 { 01929 if (instance->engine->available_formats) { 01930 instance->engine->available_formats(instance, to_endpoint, to_asterisk, result); 01931 if (!ast_format_cap_is_empty(result)) { 01932 return; 01933 } 01934 } 01935 01936 ast_translate_available_formats(to_endpoint, to_asterisk, result); 01937 }
| 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 1441 of file rtp_engine.c.
References ast_rtp_glue::allow_rtp_remote, ast_rtp_glue::allow_vrtp_remote, AST_BRIDGE_DTMF_CHANNEL_0, AST_BRIDGE_DTMF_CHANNEL_1, AST_BRIDGE_FAILED, AST_BRIDGE_FAILED_NOWARN, ast_channel_lock, ast_channel_name(), ast_channel_tech(), ast_channel_tech_pvt(), ast_channel_trylock, ast_channel_unlock, ast_check_hangup(), ast_debug, ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_cap_has_joint(), ast_format_cap_is_empty(), ast_getformatname_multiple(), 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_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, remote_bridge_loop(), ast_sockaddr::ss, type, and unref_instance_cond().
01442 { 01443 struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 01444 *vinstance0 = NULL, *vinstance1 = NULL, 01445 *tinstance0 = NULL, *tinstance1 = NULL; 01446 struct ast_rtp_glue *glue0, *glue1; 01447 struct ast_sockaddr addr1 = { {0, }, }, addr2 = { {0, }, }; 01448 enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID; 01449 enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID; 01450 enum ast_bridge_result res = AST_BRIDGE_FAILED; 01451 enum ast_rtp_dtmf_mode dmode; 01452 struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock(); 01453 struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock(); 01454 int unlock_chans = 1; 01455 01456 if (!cap0 || !cap1) { 01457 unlock_chans = 0; 01458 goto done; 01459 } 01460 01461 /* Lock both channels so we can look for the glue that binds them together */ 01462 ast_channel_lock(c0); 01463 while (ast_channel_trylock(c1)) { 01464 ast_channel_unlock(c0); 01465 usleep(1); 01466 ast_channel_lock(c0); 01467 } 01468 01469 /* Ensure neither channel got hungup during lock avoidance */ 01470 if (ast_check_hangup(c0) || ast_check_hangup(c1)) { 01471 ast_log(LOG_WARNING, "Got hangup while attempting to bridge '%s' and '%s'\n", ast_channel_name(c0), ast_channel_name(c1)); 01472 goto done; 01473 } 01474 01475 /* Grab glue that binds each channel to something using the RTP engine */ 01476 if (!(glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) || !(glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) { 01477 ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0)); 01478 goto done; 01479 } 01480 01481 audio_glue0_res = glue0->get_rtp_info(c0, &instance0); 01482 video_glue0_res = glue0->get_vrtp_info ? glue0->get_vrtp_info(c0, &vinstance0) : AST_RTP_GLUE_RESULT_FORBID; 01483 01484 audio_glue1_res = glue1->get_rtp_info(c1, &instance1); 01485 video_glue1_res = glue1->get_vrtp_info ? glue1->get_vrtp_info(c1, &vinstance1) : AST_RTP_GLUE_RESULT_FORBID; 01486 01487 /* Apply any limitations on direct media bridging that may be present */ 01488 if (audio_glue0_res == audio_glue1_res && audio_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) { 01489 if (glue0->allow_rtp_remote && !(glue0->allow_rtp_remote(c0, instance1))) { 01490 /* If the allow_rtp_remote indicates that remote isn't allowed, revert to local bridge */ 01491 audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL; 01492 } else if (glue1->allow_rtp_remote && !(glue1->allow_rtp_remote(c1, instance0))) { 01493 audio_glue0_res = audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL; 01494 } 01495 } 01496 if (video_glue0_res == video_glue1_res && video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) { 01497 if (glue0->allow_vrtp_remote && !(glue0->allow_vrtp_remote(c0, instance1))) { 01498 /* if the allow_vrtp_remote indicates that remote isn't allowed, revert to local bridge */ 01499 video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL; 01500 } else if (glue1->allow_vrtp_remote && !(glue1->allow_vrtp_remote(c1, instance0))) { 01501 video_glue0_res = video_glue1_res = AST_RTP_GLUE_RESULT_LOCAL; 01502 } 01503 } 01504 01505 /* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */ 01506 if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) { 01507 audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID; 01508 } 01509 if (video_glue1_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) { 01510 audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID; 01511 } 01512 01513 /* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */ 01514 if (audio_glue0_res == AST_RTP_GLUE_RESULT_FORBID || audio_glue1_res == AST_RTP_GLUE_RESULT_FORBID) { 01515 res = AST_BRIDGE_FAILED_NOWARN; 01516 goto done; 01517 } 01518 01519 01520 /* If address families differ, force a local bridge */ 01521 ast_rtp_instance_get_remote_address(instance0, &addr1); 01522 ast_rtp_instance_get_remote_address(instance1, &addr2); 01523 01524 if (addr1.ss.ss_family != addr2.ss.ss_family || 01525 (ast_sockaddr_is_ipv4_mapped(&addr1) != ast_sockaddr_is_ipv4_mapped(&addr2))) { 01526 audio_glue0_res = AST_RTP_GLUE_RESULT_LOCAL; 01527 audio_glue1_res = AST_RTP_GLUE_RESULT_LOCAL; 01528 } 01529 01530 /* If we need to get DTMF see if we can do it outside of the RTP stream itself */ 01531 dmode = ast_rtp_instance_dtmf_mode_get(instance0); 01532 if ((flags & AST_BRIDGE_DTMF_CHANNEL_0) && dmode) { 01533 res = AST_BRIDGE_FAILED_NOWARN; 01534 goto done; 01535 } 01536 dmode = ast_rtp_instance_dtmf_mode_get(instance1); 01537 if ((flags & AST_BRIDGE_DTMF_CHANNEL_1) && dmode) { 01538 res = AST_BRIDGE_FAILED_NOWARN; 01539 goto done; 01540 } 01541 01542 /* If we have gotten to a local bridge make sure that both sides have the same local bridge callback and that they are DTMF compatible */ 01543 if ((audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL) && ((instance0->engine->local_bridge != instance1->engine->local_bridge) || (instance0->engine->dtmf_compatible && !instance0->engine->dtmf_compatible(c0, instance0, c1, instance1)))) { 01544 res = AST_BRIDGE_FAILED_NOWARN; 01545 goto done; 01546 } 01547 01548 /* Make sure that codecs match */ 01549 if (glue0->get_codec){ 01550 glue0->get_codec(c0, cap0); 01551 } 01552 if (glue1->get_codec) { 01553 glue1->get_codec(c1, cap1); 01554 } 01555 if (!ast_format_cap_is_empty(cap0) && !ast_format_cap_is_empty(cap1) && !ast_format_cap_has_joint(cap0, cap1)) { 01556 char tmp0[256] = { 0, }; 01557 char tmp1[256] = { 0, }; 01558 ast_debug(1, "Channel codec0 = %s is not codec1 = %s, cannot native bridge in RTP.\n", 01559 ast_getformatname_multiple(tmp0, sizeof(tmp0), cap0), 01560 ast_getformatname_multiple(tmp1, sizeof(tmp1), cap1)); 01561 res = AST_BRIDGE_FAILED_NOWARN; 01562 goto done; 01563 } 01564 01565 instance0->glue = glue0; 01566 instance1->glue = glue1; 01567 instance0->chan = c0; 01568 instance1->chan = c1; 01569 01570 /* Depending on the end result for bridging either do a local bridge or remote bridge */ 01571 if (audio_glue0_res == AST_RTP_GLUE_RESULT_LOCAL || audio_glue1_res == AST_RTP_GLUE_RESULT_LOCAL) { 01572 ast_verb(3, "Locally bridging %s and %s\n", ast_channel_name(c0), ast_channel_name(c1)); 01573 res = local_bridge_loop(c0, c1, instance0, instance1, timeoutms, flags, fo, rc, ast_channel_tech_pvt(c0), ast_channel_tech_pvt(c1)); 01574 } else { 01575 ast_verb(3, "Remotely bridging %s and %s\n", ast_channel_name(c0), ast_channel_name(c1)); 01576 res = remote_bridge_loop(c0, c1, instance0, instance1, vinstance0, vinstance1, 01577 tinstance0, tinstance1, glue0, glue1, cap0, cap1, timeoutms, flags, 01578 fo, rc, ast_channel_tech_pvt(c0), ast_channel_tech_pvt(c1)); 01579 } 01580 01581 instance0->glue = NULL; 01582 instance1->glue = NULL; 01583 instance0->chan = NULL; 01584 instance1->chan = NULL; 01585 01586 unlock_chans = 0; 01587 01588 done: 01589 if (unlock_chans) { 01590 ast_channel_unlock(c0); 01591 ast_channel_unlock(c1); 01592 } 01593 ast_format_cap_destroy(cap1); 01594 ast_format_cap_destroy(cap0); 01595 01596 unref_instance_cond(&instance0); 01597 unref_instance_cond(&instance1); 01598 unref_instance_cond(&vinstance0); 01599 unref_instance_cond(&vinstance1); 01600 unref_instance_cond(&tinstance0); 01601 unref_instance_cond(&tinstance1); 01602 01603 return res; 01604 }
| 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 |
ast_rtp_instance_change_source(instance);
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 906 of file rtp_engine.c.
References ast_rtp_engine::change_source, and ast_rtp_instance::engine.
Referenced by jingle_indicate(), mgcp_indicate(), oh323_indicate(), sip_indicate(), skinny_indicate(), and unistim_indicate().
00907 { 00908 if (instance->engine->change_source) { 00909 instance->engine->change_source(instance); 00910 } 00911 }
| int ast_rtp_instance_destroy | ( | struct ast_rtp_instance * | instance | ) |
Destroy an RTP instance.
| instance | The RTP instance to destroy |
| 0 | success | |
| -1 | failure |
ast_rtp_instance_destroy(instance);
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 229 of file rtp_engine.c.
References ao2_ref.
Referenced by __oh323_destroy(), __sip_destroy(), cleanup_connection(), destroy_endpoint(), gtalk_free_pvt(), jingle_free_pvt(), jingle_session_destructor(), mgcp_hangup(), multicast_rtp_hangup(), multicast_rtp_request(), oh323_alloc(), setsubstate(), skinny_hangup(), start_rtp(), unalloc_sub(), and unistim_hangup_clean().
00230 { 00231 ao2_ref(instance, -1); 00232 00233 return 0; 00234 }
| 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 |
ast_rtp_instance_dtmf_begin(instance, '1');
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 875 of file rtp_engine.c.
References ast_rtp_engine::dtmf_begin, and ast_rtp_instance::engine.
Referenced by gtalk_digit_begin(), jingle_digit_begin(), mgcp_senddigit_begin(), oh323_digit_begin(), and sip_senddigit_begin().
00876 { 00877 return instance->engine->dtmf_begin ? instance->engine->dtmf_begin(instance, digit) : -1; 00878 }
| 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 |
ast_rtp_instance_dtmf_end(instance, '1');
This stops sending the DTMF '1' on the RTP instance pointed to by instance.
Definition at line 880 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().
00881 { 00882 return instance->engine->dtmf_end ? instance->engine->dtmf_end(instance, digit) : -1; 00883 }
| int ast_rtp_instance_dtmf_end_with_duration | ( | struct ast_rtp_instance * | instance, | |
| char | digit, | |||
| unsigned int | duration | |||
| ) |
Definition at line 884 of file rtp_engine.c.
References ast_rtp_engine::dtmf_end_with_duration, and ast_rtp_instance::engine.
Referenced by gtalk_digit_end(), jingle_digit_end(), and sip_senddigit_end().
00885 { 00886 return instance->engine->dtmf_end_with_duration ? instance->engine->dtmf_end_with_duration(instance, digit, duration) : -1; 00887 }
| 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 |
enum ast_rtp_dtmf_mode dtmf_mode = ast_rtp_instance_dtmf_mode_get(instance);
This gets the DTMF mode set on the RTP instance pointed to by 'instance'.
Definition at line 894 of file rtp_engine.c.
References ast_rtp_engine::dtmf_mode_get, and ast_rtp_instance::engine.
Referenced by ast_rtp_instance_bridge().
00895 { 00896 return instance->engine->dtmf_mode_get ? instance->engine->dtmf_mode_get(instance) : 0; 00897 }
| 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 |
This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.
Definition at line 889 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().
00890 { 00891 return (!instance->engine->dtmf_mode_set || instance->engine->dtmf_mode_set(instance, dtmf_mode)) ? -1 : 0; 00892 }
| 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 1697 of file rtp_engine.c.
References ast_channel_lock, ast_channel_name(), ast_channel_tech(), ast_channel_trylock, ast_channel_unlock, ast_debug, ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_cap_has_joint(), 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, type, unref_instance_cond(), and ast_rtp_glue::update_peer.
01698 { 01699 struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 01700 *vinstance0 = NULL, *vinstance1 = NULL, 01701 *tinstance0 = NULL, *tinstance1 = NULL; 01702 struct ast_rtp_glue *glue0, *glue1; 01703 enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID; 01704 enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID; 01705 struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock(); 01706 struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock(); 01707 int res = 0; 01708 01709 /* If there is no second channel just immediately bail out, we are of no use in that scenario */ 01710 if (!c1) { 01711 ast_format_cap_destroy(cap0); 01712 ast_format_cap_destroy(cap1); 01713 return -1; 01714 } 01715 01716 /* Lock both channels so we can look for the glue that binds them together */ 01717 ast_channel_lock(c0); 01718 while (ast_channel_trylock(c1)) { 01719 ast_channel_unlock(c0); 01720 usleep(1); 01721 ast_channel_lock(c0); 01722 } 01723 01724 if (!cap1 || !cap0) { 01725 goto done; 01726 } 01727 01728 /* Grab glue that binds each channel to something using the RTP engine */ 01729 if (!(glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) || !(glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) { 01730 ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0)); 01731 goto done; 01732 } 01733 01734 audio_glue0_res = glue0->get_rtp_info(c0, &instance0); 01735 video_glue0_res = glue0->get_vrtp_info ? glue0->get_vrtp_info(c0, &vinstance0) : AST_RTP_GLUE_RESULT_FORBID; 01736 01737 audio_glue1_res = glue1->get_rtp_info(c1, &instance1); 01738 video_glue1_res = glue1->get_vrtp_info ? glue1->get_vrtp_info(c1, &vinstance1) : AST_RTP_GLUE_RESULT_FORBID; 01739 01740 /* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */ 01741 if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) { 01742 audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID; 01743 } 01744 if (video_glue1_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) { 01745 audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID; 01746 } 01747 if (audio_glue0_res == AST_RTP_GLUE_RESULT_REMOTE && (video_glue0_res == AST_RTP_GLUE_RESULT_FORBID || video_glue0_res == AST_RTP_GLUE_RESULT_REMOTE) && glue0->get_codec) { 01748 glue0->get_codec(c0, cap0); 01749 } 01750 if (audio_glue1_res == AST_RTP_GLUE_RESULT_REMOTE && (video_glue1_res == AST_RTP_GLUE_RESULT_FORBID || video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) && glue1->get_codec) { 01751 glue1->get_codec(c1, cap1); 01752 } 01753 01754 /* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */ 01755 if (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE) { 01756 goto done; 01757 } 01758 01759 /* Make sure we have matching codecs */ 01760 if (!ast_format_cap_has_joint(cap0, cap1)) { 01761 goto done; 01762 } 01763 01764 /* Bridge media early */ 01765 if (glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) { 01766 ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>"); 01767 } 01768 01769 res = 0; 01770 01771 done: 01772 ast_channel_unlock(c0); 01773 ast_channel_unlock(c1); 01774 01775 ast_format_cap_destroy(cap0); 01776 ast_format_cap_destroy(cap1); 01777 01778 unref_instance_cond(&instance0); 01779 unref_instance_cond(&instance1); 01780 unref_instance_cond(&vinstance0); 01781 unref_instance_cond(&vinstance1); 01782 unref_instance_cond(&tinstance0); 01783 unref_instance_cond(&tinstance1); 01784 01785 if (!res) { 01786 ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>"); 01787 } 01788 01789 return res; 01790 }
| void ast_rtp_instance_early_bridge_make_compatible | ( | struct ast_channel * | c0, | |
| struct ast_channel * | c1 | |||
| ) |
Make two channels compatible for early bridging.
| c0 | First channel part of the bridge | |
| c1 | Second channel part of the bridge |
Definition at line 1611 of file rtp_engine.c.
References ast_channel_lock_both, ast_channel_name(), ast_channel_tech(), ast_channel_unlock, ast_debug, ast_format_cap_alloc_nolock(), ast_format_cap_destroy(), ast_format_cap_has_joint(), 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, type, unref_instance_cond(), and ast_rtp_glue::update_peer.
Referenced by dial_exec_full(), and do_forward().
01612 { 01613 struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL, 01614 *vinstance0 = NULL, *vinstance1 = NULL, 01615 *tinstance0 = NULL, *tinstance1 = NULL; 01616 struct ast_rtp_glue *glue0, *glue1; 01617 enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID; 01618 enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID; 01619 struct ast_format_cap *cap0 = ast_format_cap_alloc_nolock(); 01620 struct ast_format_cap *cap1 = ast_format_cap_alloc_nolock(); 01621 01622 /* Lock both channels so we can look for the glue that binds them together */ 01623 ast_channel_lock_both(c0, c1); 01624 01625 if (!cap1 || !cap0) { 01626 goto done; 01627 } 01628 01629 /* Grab glue that binds each channel to something using the RTP engine */ 01630 if (!(glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) || !(glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) { 01631 ast_debug(1, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0)); 01632 goto done; 01633 } 01634 01635 audio_glue0_res = glue0->get_rtp_info(c0, &instance0); 01636 video_glue0_res = glue0->get_vrtp_info ? glue0->get_vrtp_info(c0, &vinstance0) : AST_RTP_GLUE_RESULT_FORBID; 01637 01638 audio_glue1_res = glue1->get_rtp_info(c1, &instance1); 01639 video_glue1_res = glue1->get_vrtp_info ? glue1->get_vrtp_info(c1, &vinstance1) : AST_RTP_GLUE_RESULT_FORBID; 01640 01641 /* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */ 01642 if (video_glue0_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue0_res != AST_RTP_GLUE_RESULT_REMOTE)) { 01643 audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID; 01644 } 01645 if (video_glue1_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue1_res != AST_RTP_GLUE_RESULT_REMOTE)) { 01646 audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID; 01647 } 01648 if (audio_glue0_res == AST_RTP_GLUE_RESULT_REMOTE && (video_glue0_res == AST_RTP_GLUE_RESULT_FORBID || video_glue0_res == AST_RTP_GLUE_RESULT_REMOTE) && glue0->get_codec) { 01649 glue0->get_codec(c0, cap0); 01650 } 01651 if (audio_glue1_res == AST_RTP_GLUE_RESULT_REMOTE && (video_glue1_res == AST_RTP_GLUE_RESULT_FORBID || video_glue1_res == AST_RTP_GLUE_RESULT_REMOTE) && glue1->get_codec) { 01652 glue1->get_codec(c1, cap1); 01653 } 01654 01655 /* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */ 01656 if (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE) { 01657 goto done; 01658 } 01659 01660 /* Make sure we have matching codecs */ 01661 if (!ast_format_cap_has_joint(cap0, cap1)) { 01662 goto done; 01663 } 01664 01665 ast_rtp_codecs_payloads_copy(&instance0->codecs, &instance1->codecs, instance1); 01666 01667 if (vinstance0 && vinstance1) { 01668 ast_rtp_codecs_payloads_copy(&vinstance0->codecs, &vinstance1->codecs, vinstance1); 01669 } 01670 if (tinstance0 && tinstance1) { 01671 ast_rtp_codecs_payloads_copy(&tinstance0->codecs, &tinstance1->codecs, tinstance1); 01672 } 01673 01674 if (glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) { 01675 ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", 01676 ast_channel_name(c0), ast_channel_name(c1)); 01677 } else { 01678 ast_debug(1, "Seeded SDP of '%s' with that of '%s'\n", 01679 ast_channel_name(c0), ast_channel_name(c1)); 01680 } 01681 01682 done: 01683 ast_channel_unlock(c0); 01684 ast_channel_unlock(c1); 01685 01686 ast_format_cap_destroy(cap0); 01687 ast_format_cap_destroy(cap1); 01688 01689 unref_instance_cond(&instance0); 01690 unref_instance_cond(&instance1); 01691 unref_instance_cond(&vinstance0); 01692 unref_instance_cond(&vinstance1); 01693 unref_instance_cond(&tinstance0); 01694 unref_instance_cond(&tinstance1); 01695 }
| 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 |
int rtp_fd = ast_rtp_instance_fd(instance, 0);
This retrieves the file descriptor for the socket carrying media on the instance pointed to by instance.
Definition at line 925 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_enable_video(), 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 | ) | [read] |
Get the RTP glue in use on an RTP instance.
| instance | The RTP instance |
| pointer | to the glue |
struct ast_rtp_glue *glue = ast_rtp_instance_get_active_glue(instance);
This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.
Definition at line 1988 of file rtp_engine.c.
References ast_rtp_instance::glue.
01989 { 01990 return instance->glue; 01991 }
| 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: |
struct ast_sockaddr address; int ret; ret = ast_rtp_instance_get_and_cmp_local_address(instance, &address);
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 352 of file rtp_engine.c.
References ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::local_address.
00354 { 00355 if (ast_sockaddr_cmp(address, &instance->local_address) != 0) { 00356 ast_sockaddr_copy(address, &instance->local_address); 00357 return 1; 00358 } 00359 00360 return 0; 00361 }
| 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: |
struct ast_sockaddr address; int ret; ret = ast_rtp_instance_get_and_cmp_remote_address(instance, &address);
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 369 of file rtp_engine.c.
References ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::remote_address.
Referenced by sip_set_rtp_peer().
00371 { 00372 if (ast_sockaddr_cmp(address, &instance->remote_address) != 0) { 00373 ast_sockaddr_copy(address, &instance->remote_address); 00374 return 1; 00375 } 00376 00377 return 0; 00378 }
| struct ast_rtp_instance* ast_rtp_instance_get_bridged | ( | struct ast_rtp_instance * | instance | ) | [read] |
Get the other RTP instance that an instance is bridged to.
| instance | The RTP instance that we want |
| non-NULL | success | |
| NULL | failure |
struct ast_rtp_instance *bridged = ast_rtp_instance_get_bridged(instance0);
This gets the RTP instance that instance0 is bridged to.
Definition at line 1606 of file rtp_engine.c.
References ast_rtp_instance::bridged.
Referenced by ast_rtp_read(), bridge_p2p_rtp_write(), and dialog_needdestroy().
01607 { 01608 return instance->bridged; 01609 }
| struct ast_channel* ast_rtp_instance_get_chan | ( | struct ast_rtp_instance * | instance | ) | [read] |
Get the channel that is associated with an RTP instance while in a bridge.
| instance | The RTP instance |
| pointer | to the channel |
struct ast_channel *chan = ast_rtp_instance_get_chan(instance);
This gets the channel associated with the RTP instance pointed to by 'instance'.
Definition at line 1993 of file rtp_engine.c.
References ast_rtp_instance::chan.
01994 { 01995 return instance->chan; 01996 }
| struct ast_rtp_codecs* ast_rtp_instance_get_codecs | ( | struct ast_rtp_instance * | instance | ) | [read] |
Get the codecs structure of an RTP instance.
| instance | The RTP instance to get the codecs structure from |
struct ast_rtp_codecs *codecs = ast_rtp_instance_get_codecs(instance);
This gets the codecs structure on the RTP instance pointed to by 'instance'.
Definition at line 416 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_add_payloads_to_description(), jingle_enable_video(), jingle_interpret_description(), jingle_new(), jingle_newcall(), multicast_rtp_write(), process_sdp(), process_sdp_a_audio(), send_start_rtp(), set_dtmf_payload(), set_peer_capabilities(), setup_rtp_connection(), start_rtp(), and transmit_response_with_sdp().
00417 { 00418 return &instance->codecs; 00419 }
| 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 |
struct *blob = ast_rtp_instance_get_data(instance); (
This gets the data pointer on the RTP instance pointed to by 'instance'.
Definition at line 302 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_ice_add_remote_candidate(), 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_start(), ast_rtp_ice_stop(), ast_rtp_local_bridge(), ast_rtp_on_turn_rtcp_state(), ast_rtp_on_turn_rtp_state(), ast_rtp_on_turn_rx_rtcp_data(), ast_rtp_on_turn_rx_rtp_data(), ast_rtp_prop_set(), ast_rtp_qos_set(), ast_rtp_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().
00303 { 00304 return instance->data; 00305 }
| struct ast_rtp_engine_dtls* ast_rtp_instance_get_dtls | ( | struct ast_rtp_instance * | instance | ) | [read] |
Obtain a pointer to the DTLS support present on an RTP instance.
| instance | the RTP instance |
| DTLS | support if present | |
| NULL | if no DTLS support available |
Definition at line 2063 of file rtp_engine.c.
References ast_rtp_engine::dtls, and ast_rtp_instance::engine.
Referenced by add_dtls_to_sdp(), dialog_initialize_dtls_srtp(), get_sdp_rtp_profile(), process_crypto(), process_sdp(), and process_sdp_a_dtls().
| struct ast_rtp_engine* ast_rtp_instance_get_engine | ( | struct ast_rtp_instance * | instance | ) | [read] |
Get the RTP engine in use on an RTP instance.
| instance | The RTP instance |
| pointer | to the engine |
struct ast_rtp_engine *engine = ast_rtp_instance_get_engine(instance);
This gets the RTP engine currently in use on the RTP instance pointed to by 'instance'.
Definition at line 1983 of file rtp_engine.c.
References ast_rtp_instance::engine.
01984 { 01985 return instance->engine; 01986 }
| 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 393 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::extended_prop_get.
00394 { 00395 if (instance->engine->extended_prop_get) { 00396 return instance->engine->extended_prop_get(instance, property); 00397 } 00398 00399 return NULL; 00400 }
| struct ast_rtp_glue* ast_rtp_instance_get_glue | ( | const char * | type | ) | [read] |
Get the RTP glue that binds a channel to the RTP engine.
| type | Name of the glue we want |
| non-NULL | success | |
| NULL | failure |
struct ast_rtp_glue *glue = ast_rtp_instance_get_glue("Example");
This retrieves the RTP glue that has the name 'Example'.
Definition at line 930 of file rtp_engine.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_rtp_glue::entry, 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().
00931 { 00932 struct ast_rtp_glue *glue = NULL; 00933 00934 AST_RWLIST_RDLOCK(&glues); 00935 00936 AST_RWLIST_TRAVERSE(&glues, glue, entry) { 00937 if (!strcasecmp(glue->type, type)) { 00938 break; 00939 } 00940 } 00941 00942 AST_RWLIST_UNLOCK(&glues); 00943 00944 return glue; 00945 }
| 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 |
int timeout = ast_rtp_instance_get_hold_timeout(instance);
This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.
Definition at line 1973 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout.
Referenced by check_rtp_timeout().
01974 { 01975 return instance->holdtimeout; 01976 }
| struct ast_rtp_engine_ice* ast_rtp_instance_get_ice | ( | struct ast_rtp_instance * | instance | ) | [read] |
Obtain a pointer to the ICE support present on an RTP instance.
| instance | the RTP instance |
| ICE | support if present | |
| NULL | if no ICE support available |
Definition at line 2058 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::ice.
Referenced by add_ice_to_sdp(), dialog_initialize_rtp(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_enable_video(), jingle_interpret_google_transport(), jingle_interpret_ice_udp_transport(), jingle_new(), jingle_outgoing_hook(), process_sdp_a_ice(), and start_ice().
| int ast_rtp_instance_get_keepalive | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP keepalive interval.
| instance | The RTP instance |
| period | Keepalive interval value |
int interval = ast_rtp_instance_get_keepalive(instance);
This gets the RTP keepalive interval value for the RTP instance pointed to by 'instance'.
Definition at line 1978 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
Referenced by check_rtp_timeout().
01979 { 01980 return instance->keepalive; 01981 }
| 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 |
struct ast_sockaddr address; ast_rtp_instance_get_local_address(instance, &address);
This gets the local address that we are expecting RTP on and stores it in the 'address' structure.
Definition at line 363 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by add_sdp(), ast_rtp_on_turn_rx_rtp_data(), 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(), send_start_rtp(), sip_acf_channel_read(), sip_allow_anyrtp_remote(), and skinny_set_rtp_peer().
00365 { 00366 ast_sockaddr_copy(address, &instance->local_address); 00367 }
| 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 |
ast_rtp_instance_get_prop(instance, AST_RTP_PROPERTY_NAT);
This returns the current value of the NAT property on the instance pointed to by instance.
Definition at line 411 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().
00412 { 00413 return instance->properties[property]; 00414 }
| 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 |
char quality[AST_MAX_USER_FIELD]; ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, &buf, sizeof(buf));
This retrieves general quality statistics and places a text representation into the buf pointed to by buf.
Definition at line 1807 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().
01808 { 01809 struct ast_rtp_instance_stats stats = { 0, }; 01810 enum ast_rtp_instance_stat stat; 01811 01812 /* Determine what statistics we will need to retrieve based on field passed in */ 01813 if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY) { 01814 stat = AST_RTP_INSTANCE_STAT_ALL; 01815 } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER) { 01816 stat = AST_RTP_INSTANCE_STAT_COMBINED_JITTER; 01817 } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS) { 01818 stat = AST_RTP_INSTANCE_STAT_COMBINED_LOSS; 01819 } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT) { 01820 stat = AST_RTP_INSTANCE_STAT_COMBINED_RTT; 01821 } else { 01822 return NULL; 01823 } 01824 01825 /* Attempt to actually retrieve the statistics we need to generate the quality string */ 01826 if (ast_rtp_instance_get_stats(instance, &stats, stat)) { 01827 return NULL; 01828 } 01829 01830 /* Now actually fill the buffer with the good information */ 01831 if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY) { 01832 snprintf(buf, size, "ssrc=%i;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f", 01833 stats.local_ssrc, stats.remote_ssrc, stats.rxploss, stats.txjitter, stats.rxcount, stats.rxjitter, stats.txcount, stats.txploss, stats.rtt); 01834 } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER) { 01835 snprintf(buf, size, "minrxjitter=%f;maxrxjitter=%f;avgrxjitter=%f;stdevrxjitter=%f;reported_minjitter=%f;reported_maxjitter=%f;reported_avgjitter=%f;reported_stdevjitter=%f;", 01836 stats.local_minjitter, stats.local_maxjitter, stats.local_normdevjitter, sqrt(stats.local_stdevjitter), stats.remote_minjitter, stats.remote_maxjitter, stats.remote_normdevjitter, sqrt(stats.remote_stdevjitter)); 01837 } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS) { 01838 snprintf(buf, size, "minrxlost=%f;maxrxlost=%f;avgrxlost=%f;stdevrxlost=%f;reported_minlost=%f;reported_maxlost=%f;reported_avglost=%f;reported_stdevlost=%f;", 01839 stats.local_minrxploss, stats.local_maxrxploss, stats.local_normdevrxploss, sqrt(stats.local_stdevrxploss), stats.remote_minrxploss, stats.remote_maxrxploss, stats.remote_normdevrxploss, sqrt(stats.remote_stdevrxploss)); 01840 } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT) { 01841 snprintf(buf, size, "minrtt=%f;maxrtt=%f;avgrtt=%f;stdevrtt=%f;", stats.minrtt, stats.maxrtt, stats.normdevrtt, stats.stdevrtt); 01842 } 01843 01844 return buf; 01845 }
| 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 |
struct ast_sockaddr address; ast_rtp_instance_get_remote_address(instance, &address);
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 380 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::remote_address.
Referenced by add_sdp(), 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(), find_rtp_port(), gtalk_update_stun(), jingle_interpret_ice_udp_transport(), multicast_rtp_write(), multicast_send_control_packet(), oh323_set_rtp_peer(), process_cn_rfc3389(), process_dtmf_rfc2833(), process_sdp(), remote_bridge_loop(), send_start_rtp(), sip_acf_channel_read(), sip_allow_anyrtp_remote(), skinny_set_rtp_peer(), and transmit_modify_with_sdp().
00382 { 00383 ast_sockaddr_copy(address, &instance->remote_address); 00384 }
| struct ast_srtp* ast_rtp_instance_get_srtp | ( | struct ast_rtp_instance * | instance | ) | [read] |
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 2044 of file rtp_engine.c.
References ast_rtp_instance::srtp.
Referenced by __rtp_recvfrom(), __rtp_sendto(), and ast_rtp_change_source().
02045 { 02046 return instance->srtp; 02047 }
| 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 |
struct ast_rtp_instance_stats stats; ast_rtp_instance_get_stats(instance, &stats, AST_RTP_INSTANCE_STAT_ALL);
This retrieves all statistics the underlying RTP engine supports and puts the values into the stats structure.
Definition at line 1802 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().
01803 { 01804 return instance->engine->get_stat ? instance->engine->get_stat(instance, stats, stat) : -1; 01805 }
| int ast_rtp_instance_get_timeout | ( | struct ast_rtp_instance * | instance | ) |
Get the RTP timeout value.
| instance | The RTP instance |
| timeout | value |
int timeout = ast_rtp_instance_get_timeout(instance);
This gets the RTP timeout value for the RTP instance pointed to by 'instance'.
Definition at line 1968 of file rtp_engine.c.
References ast_rtp_instance::timeout.
Referenced by check_rtp_timeout().
01969 { 01970 return instance->timeout; 01971 }
| 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 |
ast_rtp_instance_make_compatible(instance, peer);
This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.
Definition at line 1891 of file rtp_engine.c.
References ao2_ref, ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_rtp_instance_get_glue(), ast_rtp_instance::engine, ast_rtp_glue::get_rtp_info, ast_rtp_engine::make_compatible, and type.
Referenced by sip_setoption().
01892 { 01893 struct ast_rtp_glue *glue; 01894 struct ast_rtp_instance *peer_instance = NULL; 01895 int res = -1; 01896 01897 if (!instance->engine->make_compatible) { 01898 return -1; 01899 } 01900 01901 ast_channel_lock(peer); 01902 01903 if (!(glue = ast_rtp_instance_get_glue(ast_channel_tech(peer)->type))) { 01904 ast_channel_unlock(peer); 01905 return -1; 01906 } 01907 01908 glue->get_rtp_info(peer, &peer_instance); 01909 01910 if (!peer_instance || peer_instance->engine != instance->engine) { 01911 ast_channel_unlock(peer); 01912 ao2_ref(peer_instance, -1); 01913 peer_instance = NULL; 01914 return -1; 01915 } 01916 01917 res = instance->engine->make_compatible(chan, instance, peer, peer_instance); 01918 01919 ast_channel_unlock(peer); 01920 01921 ao2_ref(peer_instance, -1); 01922 peer_instance = NULL; 01923 01924 return res; 01925 }
| struct ast_rtp_instance* ast_rtp_instance_new | ( | const char * | engine_name, | |
| struct ast_sched_context * | sched, | |||
| const struct ast_sockaddr * | sa, | |||
| void * | data | |||
| ) | [read] |
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 |
struct ast_rtp_instance *instance = NULL; instance = ast_rtp_instance_new(NULL, sched, &sin, NULL);
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 236 of file rtp_engine.c.
References ao2_alloc, ao2_ref, ast_debug, ast_log(), ast_module_ref(), ast_module_unref(), ast_rtp_codecs_payloads_initialize(), AST_RWLIST_FIRST, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_sockaddr_copy(), ast_strlen_zero(), ast_rtp_instance::codecs, ast_rtp_instance::engine, ast_rtp_engine::entry, 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(), jingle_enable_video(), multicast_rtp_request(), and start_rtp().
00239 { 00240 struct ast_sockaddr address = {{0,}}; 00241 struct ast_rtp_instance *instance = NULL; 00242 struct ast_rtp_engine *engine = NULL; 00243 00244 AST_RWLIST_RDLOCK(&engines); 00245 00246 /* If an engine name was specified try to use it or otherwise use the first one registered */ 00247 if (!ast_strlen_zero(engine_name)) { 00248 AST_RWLIST_TRAVERSE(&engines, engine, entry) { 00249 if (!strcmp(engine->name, engine_name)) { 00250 break; 00251 } 00252 } 00253 } else { 00254 engine = AST_RWLIST_FIRST(&engines); 00255 } 00256 00257 /* If no engine was actually found bail out now */ 00258 if (!engine) { 00259 ast_log(LOG_ERROR, "No RTP engine was found. Do you have one loaded?\n"); 00260 AST_RWLIST_UNLOCK(&engines); 00261 return NULL; 00262 } 00263 00264 /* Bump up the reference count before we return so the module can not be unloaded */ 00265 ast_module_ref(engine->mod); 00266 00267 AST_RWLIST_UNLOCK(&engines); 00268 00269 /* Allocate a new RTP instance */ 00270 if (!(instance = ao2_alloc(sizeof(*instance), instance_destructor))) { 00271 ast_module_unref(engine->mod); 00272 return NULL; 00273 } 00274 instance->engine = engine; 00275 ast_sockaddr_copy(&instance->local_address, sa); 00276 ast_sockaddr_copy(&address, sa); 00277 00278 if (ast_rtp_codecs_payloads_initialize(&instance->codecs)) { 00279 ao2_ref(instance, -1); 00280 return NULL; 00281 } 00282 00283 ast_debug(1, "Using engine '%s' for RTP instance '%p'\n", engine->name, instance); 00284 00285 /* And pass it off to the engine to setup */ 00286 if (instance->engine->new(instance, sched, &address, data)) { 00287 ast_debug(1, "Engine '%s' failed to setup RTP instance '%p'\n", engine->name, instance); 00288 ao2_ref(instance, -1); 00289 return NULL; 00290 } 00291 00292 ast_debug(1, "RTP instance '%p' is setup and ready to go\n", instance); 00293 00294 return instance; 00295 }
| struct ast_frame* ast_rtp_instance_read | ( | struct ast_rtp_instance * | instance, | |
| int | rtcp | |||
| ) | [read] |
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 |
struct ast_frame *frame; frame = ast_rtp_instance_read(instance, 0);
This asks the RTP engine to read in RTP from the instance and return it as an Asterisk frame.
Definition at line 312 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::read.
Referenced by gtalk_rtp_read(), jingle_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 2049 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::sendcng.
Referenced by check_rtp_timeout().
02050 { 02051 if (instance->engine->sendcng) { 02052 return instance->engine->sendcng(instance, level); 02053 } 02054 02055 return -1; 02056 }
| 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 |
ast_rtp_instance_set_alt_remote_address(instance, &address);
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 338 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().
00340 { 00341 ast_sockaddr_copy(&instance->alt_remote_address, address); 00342 00343 /* oink */ 00344 00345 if (instance->engine->alt_remote_address_set) { 00346 instance->engine->alt_remote_address_set(instance, &instance->alt_remote_address); 00347 } 00348 00349 return 0; 00350 }
| 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 |
ast_rtp_instance_set_data(instance, blob);
This sets the data pointer on the RTP instance pointed to by 'instance' to blob.
Definition at line 297 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 386 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::extended_prop_set.
00387 { 00388 if (instance->engine->extended_prop_set) { 00389 instance->engine->extended_prop_set(instance, property, value); 00390 } 00391 }
| 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 |
ast_rtp_instance_set_hold_timeout(instance, 5000);
This sets the RTP hold timeout value on 'instance' to be 5000.
Definition at line 1958 of file rtp_engine.c.
References ast_rtp_instance::holdtimeout.
Referenced by check_rtp_timeout(), and dialog_initialize_rtp().
01959 { 01960 instance->holdtimeout = timeout; 01961 }
| 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 |
ast_rtp_instance_set_keepalive(instance, 5000);
This sets the RTP keepalive interval on 'instance' to be 5000.
Definition at line 1963 of file rtp_engine.c.
References ast_rtp_instance::keepalive.
Referenced by dialog_initialize_rtp().
01964 { 01965 instance->keepalive = interval; 01966 }
| 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 |
ast_rtp_instance_set_local_address(instance, &sin);
This changes the local address that RTP is expected on to the address given in the sin structure.
Definition at line 317 of file rtp_engine.c.
References ast_sockaddr_copy(), and ast_rtp_instance::local_address.
Referenced by ast_rtp_new().
00319 { 00320 ast_sockaddr_copy(&instance->local_address, address); 00321 return 0; 00322 }
| 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 |
ast_rtp_instance_set_prop(instance, AST_RTP_PROPERTY_NAT, 1);
This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.
Definition at line 402 of file rtp_engine.c.
References ast_rtp_instance::engine, ast_rtp_engine::prop_set, and ast_rtp_instance::properties.
Referenced by __oh323_rtp_create(), create_addr_from_peer(), dialog_initialize_rtp(), do_setnat(), gtalk_alloc(), handle_request_invite(), jingle_alloc(), jingle_enable_video(), oh323_rtp_read(), process_sdp(), sip_dtmfmode(), sip_set_rtp_peer(), and start_rtp().
00403 { 00404 instance->properties[property] = value; 00405 00406 if (instance->engine->prop_set) { 00407 instance->engine->prop_set(instance, property, value); 00408 } 00409 }
| 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 |
ast_rtp_instance_set_qos(instance, 0, 0, "Example");
This sets the TOS and COS values to 0 on the instance pointed to by instance.
Definition at line 913 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().
00914 { 00915 return instance->engine->qos ? instance->engine->qos(instance, tos, cos, desc) : -1; 00916 }
| 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 |
struct ast_format tmp_fmt; ast_rtp_instance_set_read_format(instance, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0));
This requests that the RTP engine provide audio frames in the ULAW format.
Definition at line 1881 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_read_format.
Referenced by sip_new(), and sip_setoption().
01882 { 01883 return instance->engine->set_read_format ? instance->engine->set_read_format(instance, format) : -1; 01884 }
| 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 |
ast_rtp_instance_set_remote_address(instance, &sin);
This changes the remote address that RTP will be sent to on instance to the address given in the sin structure.
Definition at line 324 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(), jingle_interpret_ice_udp_transport(), multicast_rtp_request(), process_sdp(), setup_rtp_connection(), and start_rtp().
00326 { 00327 ast_sockaddr_copy(&instance->remote_address, address); 00328 00329 /* moo */ 00330 00331 if (instance->engine->remote_address_set) { 00332 instance->engine->remote_address_set(instance, &instance->remote_address); 00333 } 00334 00335 return 0; 00336 }
| 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 |
ast_rtp_instance_set_stats_vars(chan, rtp);
This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to by chan.
Definition at line 1847 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().
01848 { 01849 char quality_buf[AST_MAX_USER_FIELD], *quality; 01850 struct ast_channel *bridge = ast_bridged_channel(chan); 01851 01852 if ((quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) { 01853 pbx_builtin_setvar_helper(chan, "RTPAUDIOQOS", quality); 01854 if (bridge) { 01855 pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSBRIDGED", quality); 01856 } 01857 } 01858 01859 if ((quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, quality_buf, sizeof(quality_buf)))) { 01860 pbx_builtin_setvar_helper(chan, "RTPAUDIOQOSJITTER", quality); 01861 if (bridge) { 01862 pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSJITTERBRIDGED", quality); 01863 } 01864 } 01865 01866 if ((quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, quality_buf, sizeof(quality_buf)))) { 01867 pbx_builtin_setvar_helper(chan, "RTPAUDIOQOSLOSS", quality); 01868 if (bridge) { 01869 pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSLOSSBRIDGED", quality); 01870 } 01871 } 01872 01873 if ((quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, quality_buf, sizeof(quality_buf)))) { 01874 pbx_builtin_setvar_helper(chan, "RTPAUDIOQOSRTT", quality); 01875 if (bridge) { 01876 pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSRTTBRIDGED", quality); 01877 } 01878 } 01879 }
| 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 |
ast_rtp_instance_set_timeout(instance, 5000);
This sets the RTP timeout value on 'instance' to be 5000.
Definition at line 1953 of file rtp_engine.c.
References ast_rtp_instance::timeout.
Referenced by check_rtp_timeout(), and dialog_initialize_rtp().
01954 { 01955 instance->timeout = timeout; 01956 }
| 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 |
struct ast_format tmp_fmt; ast_rtp_instance_set_write_format(instance, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0));
This tells the underlying RTP engine that audio frames will be provided to it in ULAW format.
Definition at line 1886 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::set_write_format.
Referenced by sip_new(), and sip_setoption().
01887 { 01888 return instance->engine->set_write_format ? instance->engine->set_write_format(instance, format) : -1; 01889 }
| 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 |
ast_rtp_instance_stop(instance);
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 918 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 |
ast_rtp_instance_stun_request(instance, NULL, NULL);
This requests that the RTP engine send a STUN BIND request on the session pointed to by 'instance'.
Definition at line 1944 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::stun_request.
Referenced by gtalk_update_stun(), jingle_interpret_google_transport(), and jingle_update_stun().
01947 { 01948 if (instance->engine->stun_request) { 01949 instance->engine->stun_request(instance, suggestion, username); 01950 } 01951 }
| 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 |
ast_rtp_instance_update_source(instance);
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 899 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::update_source.
Referenced by jingle_indicate(), mgcp_indicate(), oh323_indicate(), sip_answer(), sip_indicate(), sip_write(), and skinny_indicate().
00900 { 00901 if (instance->engine->update_source) { 00902 instance->engine->update_source(instance); 00903 } 00904 }
| 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 |
ast_rtp_instance_write(instance, frame);
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 307 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, | |
| 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 |
char buf[256] = ""; struct ast_format tmp_fmt; struct ast_format_cap *cap = ast_format_cap_alloc_nolock(); ast_format_cap_add(cap, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0)); ast_format_cap_add(cap, ast_format_set(&tmp_fmt, AST_FORMAT_GSM, 0)); char *mime = ast_rtp_lookup_mime_multiple2(&buf, sizeof(buf), cap, 0, 1, 0); ast_format_cap_destroy(cap);
This returns the mime values for ULAW and ALAW in the buffer pointed to by buf.
Definition at line 830 of file rtp_engine.c.
References ast_format_cap_iter_end(), ast_format_cap_iter_next(), ast_format_cap_iter_start(), ast_rtp_lookup_mime_subtype2(), AST_RTP_MAX, ast_str_append(), ast_str_buffer(), and name.
Referenced by process_sdp().
00831 { 00832 int found = 0; 00833 const char *name; 00834 if (!buf) { 00835 return NULL; 00836 } 00837 00838 00839 if (asterisk_format) { 00840 struct ast_format tmp_fmt; 00841 ast_format_cap_iter_start(ast_format_capability); 00842 while (!ast_format_cap_iter_next(ast_format_capability, &tmp_fmt)) { 00843 name = ast_rtp_lookup_mime_subtype2(asterisk_format, &tmp_fmt, 0, options); 00844 ast_str_append(&buf, 0, "%s|", name); 00845 found = 1; 00846 } 00847 ast_format_cap_iter_end(ast_format_capability); 00848 00849 } else { 00850 int x; 00851 ast_str_append(&buf, 0, "0x%x (", (unsigned int) rtp_capability); 00852 for (x = 1; x < AST_RTP_MAX; x <<= 1) { 00853 if (rtp_capability & x) { 00854 name = ast_rtp_lookup_mime_subtype2(asterisk_format, NULL, x, options); 00855 ast_str_append(&buf, 0, "%s|", name); 00856 found = 1; 00857 } 00858 } 00859 } 00860 00861 ast_str_append(&buf, 0, "%s", found ? ")" : "nothing)"); 00862 00863 return ast_str_buffer(buf); 00864 }
| const char* ast_rtp_lookup_mime_subtype2 | ( | const int | asterisk_format, | |
| 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 |
| Mime | subtype success | |
| NULL | failure |
const char *subtype = ast_rtp_lookup_mime_subtype2(1, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0), 0, 0);
This looks up the mime subtype for the ULAW format.
Definition at line 780 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, AST_FORMAT_G726_AAL2, ast_rtp_mime_types, AST_RTP_OPT_G726_NONSTANDARD, ast_rwlock_rdlock, ast_rwlock_unlock, ast_format::id, ast_rtp_mime_type::payload_type, ast_rtp_payload_type::rtp_code, 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(), jingle_add_payloads_to_description(), transmit_connect(), transmit_connect_with_sdp(), transmit_modify_request(), and transmit_modify_with_sdp().
00781 { 00782 int i; 00783 const char *res = ""; 00784 00785 ast_rwlock_rdlock(&mime_types_lock); 00786 for (i = 0; i < mime_types_len; i++) { 00787 if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format && 00788 (ast_format_cmp(format, &ast_rtp_mime_types[i].payload_type.format) != AST_FORMAT_CMP_NOT_EQUAL)) { 00789 if ((format->id == AST_FORMAT_G726_AAL2) && (options & AST_RTP_OPT_G726_NONSTANDARD)) { 00790 res = "G726-32"; 00791 break; 00792 } else { 00793 res = ast_rtp_mime_types[i].subtype; 00794 break; 00795 } 00796 } else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format && 00797 ast_rtp_mime_types[i].payload_type.rtp_code == code) { 00798 00799 res = ast_rtp_mime_types[i].subtype; 00800 break; 00801 } 00802 } 00803 ast_rwlock_unlock(&mime_types_lock); 00804 00805 return res; 00806 }
| unsigned int ast_rtp_lookup_sample_rate2 | ( | int | asterisk_format, | |
| 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 808 of file rtp_engine.c.
References ast_format_cmp(), AST_FORMAT_CMP_NOT_EQUAL, ast_rtp_mime_types, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_mime_type::payload_type, ast_rtp_payload_type::rtp_code, and ast_rtp_mime_type::sample_rate.
Referenced by add_codec_to_sdp(), add_noncodec_to_sdp(), add_tcodec_to_sdp(), add_vcodec_to_sdp(), and jingle_add_payloads_to_description().
00809 { 00810 unsigned int i; 00811 unsigned int res = 0; 00812 00813 ast_rwlock_rdlock(&mime_types_lock); 00814 for (i = 0; i < mime_types_len; ++i) { 00815 if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format && 00816 (ast_format_cmp(format, &ast_rtp_mime_types[i].payload_type.format) != AST_FORMAT_CMP_NOT_EQUAL)) { 00817 res = ast_rtp_mime_types[i].sample_rate; 00818 break; 00819 } else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format && 00820 ast_rtp_mime_types[i].payload_type.rtp_code == code) { 00821 res = ast_rtp_mime_types[i].sample_rate; 00822 break; 00823 } 00824 } 00825 ast_rwlock_unlock(&mime_types_lock); 00826 00827 return res; 00828 }
| 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 1797 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::red_buffer.
Referenced by sip_write().
01798 { 01799 return instance->engine->red_buffer ? instance->engine->red_buffer(instance, frame) : -1; 01800 }
| 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 1792 of file rtp_engine.c.
References ast_rtp_instance::engine, and ast_rtp_engine::red_init.
Referenced by process_sdp().
01793 { 01794 return instance->engine->red_init ? instance->engine->red_init(instance, buffer_time, payloads, generations) : -1; 01795 }
1.5.6