rtp_engine.h File Reference

Pluggable RTP Architecture. More...

#include "asterisk/astobj2.h"
#include "asterisk/frame.h"
#include "asterisk/format_cap.h"
#include "asterisk/netsock2.h"
#include "asterisk/sched.h"
#include "asterisk/res_srtp.h"
#include "asterisk/stasis.h"
#include "asterisk/vector.h"

Include dependency graph for rtp_engine.h:

This graph shows which files directly or indirectly include this file:

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
struct  ast_rtp_rtcp_report
 An object that represents data sent during a SR/RR RTCP report. More...
struct  ast_rtp_rtcp_report_block
 A report block within a SR/RR report. More...

Defines

#define AST_RED_MAX_GENERATION   5
#define AST_RTP_CISCO_DTMF   (1 << 2)
#define AST_RTP_CN   (1 << 1)
#define AST_RTP_CODECS_NULL_INIT   { .payloads = { 0, }, .framing = 0, .codecs_lock = AST_RWLOCK_INIT_VALUE, }
#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_instance_get_and_cmp_remote_address(instance, address)   ast_rtp_instance_get_and_cmp_requested_target_address((instance), (address));
 Get the address of the remote endpoint that we are sending RTP to, comparing its address to another.
#define ast_rtp_instance_get_remote_address(instance, address)   ast_rtp_instance_get_incoming_source_address((instance), (address));
 Get the address of the remote endpoint that we are sending RTP to.
#define ast_rtp_instance_set_remote_address(instance, address)   ast_rtp_instance_set_requested_target_address((instance), (address));
 Set the address of the remote endpoint that we are sending RTP to.
#define AST_RTP_MAX   AST_RTP_CISCO_DTMF
#define AST_RTP_MAX_PT   196
#define AST_RTP_RTCP_RR   201
#define AST_RTP_RTCP_SR   200
#define AST_RTP_STAT_SET(current_stat, combined, placement, value)
#define AST_RTP_STAT_STRCPY(current_stat, combined, placement, value)
#define AST_RTP_STAT_TERMINATOR(combined)
#define MAX_CHANNEL_ID   152

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_SHA256, 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_dtls_verify { AST_RTP_DTLS_VERIFY_NONE = 0, AST_RTP_DTLS_VERIFY_FINGERPRINT = (1 << 0), AST_RTP_DTLS_VERIFY_CERTIFICATE = (1 << 1) }
 DTLS verification settings. 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_ice_component_type { AST_RTP_ICE_COMPONENT_RTP = 1, AST_RTP_ICE_COMPONENT_RTCP = 2 }
 ICE component types. More...
enum  ast_rtp_ice_role { AST_RTP_ICE_ROLE_CONTROLLED, AST_RTP_ICE_ROLE_CONTROLLING }
 ICE role during negotiation. 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, AST_RTP_INSTANCE_STAT_CHANNEL_UNIQUEID
}
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.
unsigned int ast_rtp_codecs_get_framing (struct ast_rtp_codecs *codecs)
 Get the framing used for a set of codecs.
struct ast_rtp_payload_typeast_rtp_codecs_get_payload (struct ast_rtp_codecs *codecs, int payload)
 Retrieve payload information by payload.
struct ast_formatast_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.
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.
int ast_rtp_codecs_payload_replace_format (struct ast_rtp_codecs *codecs, int payload, struct ast_format *format)
 Update the format associated with a payload in a codecs structure.
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_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_codecs_set_framing (struct ast_rtp_codecs *codecs, unsigned int framing)
 Set the framing used for a set of codecs.
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.
struct ast_rtp_payload_typeast_rtp_engine_alloc_payload_type (void)
 Allocation routine for ast_rtp_payload_type.
int ast_rtp_engine_load_format (struct ast_format *format)
 Custom formats declared in codecs.conf at startup must be communicated to the rtp_engine so their mime type can payload number can be initialized.
int ast_rtp_engine_register2 (struct ast_rtp_engine *engine, struct ast_module *module)
 Register an RTP engine.
int ast_rtp_engine_register_srtp (struct ast_srtp_res *srtp_res, struct ast_srtp_policy_res *policy_res)
int ast_rtp_engine_srtp_is_registered (void)
int ast_rtp_engine_unload_format (struct ast_format *format)
 Formats requiring the use of a format attribute interface must have that interface registered in order for the rtp engine to handle it correctly. If an attribute interface is unloaded, this function must be called to notify the rtp_engine.
int ast_rtp_engine_unregister (struct ast_rtp_engine *engine)
 Unregister an RTP engine.
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.
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 *c_dst, struct ast_channel *c_src)
 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_glueast_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_requested_target_address (struct ast_rtp_instance *instance, struct ast_sockaddr *address)
 Get the requested target address of the remote endpoint and compare it to the given address.
struct ast_rtp_instanceast_rtp_instance_get_bridged (struct ast_rtp_instance *instance)
 Get the other RTP instance that an instance is bridged to.
const char * ast_rtp_instance_get_channel_id (struct ast_rtp_instance *instance)
 Get the unique ID of the channel that owns this RTP instance.
struct ast_rtp_codecsast_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_dtlsast_rtp_instance_get_dtls (struct ast_rtp_instance *instance)
 Obtain a pointer to the DTLS support present on an RTP instance.
struct ast_rtp_engineast_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_glueast_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_iceast_rtp_instance_get_ice (struct ast_rtp_instance *instance)
 Obtain a pointer to the ICE support present on an RTP instance.
void ast_rtp_instance_get_incoming_source_address (struct ast_rtp_instance *instance, struct ast_sockaddr *address)
 Get the incoming source address of the remote endpoint.
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_requested_target_address (struct ast_rtp_instance *instance, struct ast_sockaddr *address)
 Get the requested target address of the remote endpoint.
struct ast_srtpast_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_instanceast_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_frameast_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.
void ast_rtp_instance_set_bridged (struct ast_rtp_instance *instance, struct ast_rtp_instance *bridged)
 Set the other RTP instance that an instance is bridged to.
void ast_rtp_instance_set_channel_id (struct ast_rtp_instance *instance, const char *uniqueid)
 Set the channel that owns this RTP instance.
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.
int ast_rtp_instance_set_incoming_source_address (struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
 Set the incoming source address of the remote endpoint that we are sending RTP to.
void ast_rtp_instance_set_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_requested_target_address (struct ast_rtp_instance *instance, const struct ast_sockaddr *address)
 Set the requested target address of the remote endpoint.
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.
void ast_rtp_publish_rtcp_message (struct ast_rtp_instance *rtp, struct stasis_message_type *message_type, struct ast_rtp_rtcp_report *report, struct ast_json *blob)
 Publish an RTCP message to Stasis Message Bus API.
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.
struct stasis_message_typeast_rtp_rtcp_received_type (void)
 Message type for an RTCP message received from some external source.
struct ast_rtp_rtcp_reportast_rtp_rtcp_report_alloc (unsigned int report_blocks)
 Allocate an ao2 ref counted instance of ast_rtp_rtcp_report.
struct stasis_message_typeast_rtp_rtcp_sent_type (void)
 Message type for an RTCP message sent from this Asterisk instance.
struct stasis_topicast_rtp_topic (void)
 Stasis Message Bus API topic for RTP and RTCP related messages


Detailed Description

Pluggable RTP Architecture.

Author:
Joshua Colp <jcolp@digium.com> Asterisk RTP Engine API

Definition in file rtp_engine.h.


Define Documentation

#define AST_RED_MAX_GENERATION   5

Definition at line 89 of file rtp_engine.h.

Referenced by process_sdp_a_text().

#define AST_RTP_CISCO_DTMF   (1 << 2)

DTMF (Cisco Proprietary)

Definition at line 240 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 238 of file rtp_engine.h.

Referenced by ast_rtp_engine_init(), ast_rtp_read(), and ast_rtp_sendcng().

#define AST_RTP_CODECS_NULL_INIT   { .payloads = { 0, }, .framing = 0, .codecs_lock = AST_RWLOCK_INIT_VALUE, }

Definition at line 589 of file rtp_engine.h.

Referenced by process_sdp(), and set_caps().

#define AST_RTP_DTMF   (1 << 0)

#define ast_rtp_engine_register ( engine   )     ast_rtp_engine_register2(engine, ast_module_info->self)

Definition at line 646 of file rtp_engine.h.

Referenced by load_module().

#define ast_rtp_glue_register ( glue   )     ast_rtp_glue_register2(glue, ast_module_info->self)

Definition at line 699 of file rtp_engine.h.

Referenced by load_module().

#define ast_rtp_instance_get_and_cmp_remote_address ( instance,
address   )     ast_rtp_instance_get_and_cmp_requested_target_address((instance), (address));

Get the address of the remote endpoint that we are sending RTP to, comparing its address to another.

Parameters:
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
Return values:
0 address was not changed
1 address was changed Example usage:

This retrieves the current remote address set on the instance pointed to by instance and puts the value into the address structure.

Since:
1.8

Definition at line 1080 of file rtp_engine.h.

Referenced by check_for_rtp_changes(), ooh323_set_rtp_peer(), and sip_set_rtp_peer().

#define ast_rtp_instance_get_remote_address ( instance,
address   )     ast_rtp_instance_get_incoming_source_address((instance), (address));

Get the address of the remote endpoint that we are sending RTP to.

Parameters:
instance The instance that we want to get the remote address for
address A structure to put the address into
Example usage:

This retrieves the current remote address set on the instance pointed to by instance and puts the value into the address structure.

Since:
1.8

Definition at line 1044 of file rtp_engine.h.

Referenced by __rtp_recvfrom(), add_sdp(), ast_rtp_dtmf_begin(), ast_rtp_dtmf_continuation(), ast_rtp_dtmf_end_with_duration(), ast_rtp_raw_write(), ast_rtp_read(), ast_rtp_sendcng(), ast_rtp_write(), bridge_p2p_rtp_write(), channel_read_rtp(), create_dtmf_frame(), find_rtp_port(), jingle_interpret_ice_udp_transport(), multicast_rtp_write(), multicast_send_control_packet(), ooh323_get_rtp_peer(), process_cn_rfc3389(), process_dtmf_rfc2833(), process_sdp(), send_start_rtp(), sip_acf_channel_read(), skinny_set_rtp_peer(), transmit_modify_with_sdp(), and unistim_set_rtp_peer().

#define ast_rtp_instance_set_remote_address ( instance,
address   )     ast_rtp_instance_set_requested_target_address((instance), (address));

Set the address of the remote endpoint that we are sending RTP to.

Parameters:
instance The RTP instance to change the address on
address Address to set it to
Return values:
0 success
-1 failure
Example usage:

This changes the remote address that RTP will be sent to on instance to the address given in the sin structure.

Since:
1.8

Definition at line 932 of file rtp_engine.h.

Referenced by apply_negotiated_sdp_stream(), 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(), setup_rtp_remote(), start_rtp(), and unicast_rtp_request().

#define AST_RTP_MAX   AST_RTP_CISCO_DTMF

Maximum RTP-specific code

Definition at line 242 of file rtp_engine.h.

Referenced by add_sdp(), ast_rtp_lookup_mime_multiple2(), and create_outgoing_sdp_stream().

#define AST_RTP_MAX_PT   196

#define AST_RTP_RTCP_RR   201

Receiver Report

Definition at line 261 of file rtp_engine.h.

#define AST_RTP_RTCP_SR   200

Sender Report

Definition at line 259 of file rtp_engine.h.

Referenced by rtcp_report_to_ami(), and rtcp_report_to_json().

#define AST_RTP_STAT_SET ( current_stat,
combined,
placement,
value   ) 

Definition at line 361 of file rtp_engine.h.

Referenced by ast_rtp_get_stat().

#define AST_RTP_STAT_STRCPY ( current_stat,
combined,
placement,
value   ) 

Definition at line 369 of file rtp_engine.h.

Referenced by ast_rtp_get_stat().

#define AST_RTP_STAT_TERMINATOR ( combined   ) 

Value:

if (stat == combined) { \
return 0; \
}

Definition at line 377 of file rtp_engine.h.

Referenced by ast_rtp_get_stat().

#define MAX_CHANNEL_ID   152

Maximum size of an internal Asterisk channel unique ID.

Note:
Must match the AST_MAX_UNIQUEID(AST_MAX_PUBLIC_UNIQUEID) value. We don't use that defined value directly here to avoid a hard dependency on channel.h.

Definition at line 98 of file rtp_engine.h.


Enumeration Type Documentation

DTLS connection states.

Enumerator:
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 447 of file rtp_engine.h.

00447                              {
00448    AST_RTP_DTLS_CONNECTION_NEW,      /*!< Endpoint wants to use a new connection */
00449    AST_RTP_DTLS_CONNECTION_EXISTING, /*!< Endpoint wishes to use existing connection */
00450 };

DTLS fingerprint hashes.

Enumerator:
AST_RTP_DTLS_HASH_SHA256  SHA-256 fingerprint hash
AST_RTP_DTLS_HASH_SHA1  SHA-1 fingerprint hash

Definition at line 453 of file rtp_engine.h.

00453                        {
00454    AST_RTP_DTLS_HASH_SHA256, /*!< SHA-256 fingerprint hash */
00455    AST_RTP_DTLS_HASH_SHA1,   /*!< SHA-1 fingerprint hash */
00456 };

DTLS setup types.

Enumerator:
AST_RTP_DTLS_SETUP_ACTIVE  Endpoint is willing to inititate connections
AST_RTP_DTLS_SETUP_PASSIVE  Endpoint is willing to accept connections
AST_RTP_DTLS_SETUP_ACTPASS  Endpoint is willing to both accept and initiate connections
AST_RTP_DTLS_SETUP_HOLDCONN  Endpoint does not want the connection to be established right now

Definition at line 439 of file rtp_engine.h.

00439                         {
00440    AST_RTP_DTLS_SETUP_ACTIVE,   /*!< Endpoint is willing to inititate connections */
00441    AST_RTP_DTLS_SETUP_PASSIVE,  /*!< Endpoint is willing to accept connections */
00442    AST_RTP_DTLS_SETUP_ACTPASS,  /*!< Endpoint is willing to both accept and initiate connections */
00443    AST_RTP_DTLS_SETUP_HOLDCONN, /*!< Endpoint does not want the connection to be established right now */
00444 };

DTLS verification settings.

Enumerator:
AST_RTP_DTLS_VERIFY_NONE  Don't verify anything
AST_RTP_DTLS_VERIFY_FINGERPRINT  Verify the fingerprint
AST_RTP_DTLS_VERIFY_CERTIFICATE  Verify the certificate

Definition at line 459 of file rtp_engine.h.

00459                          {
00460    AST_RTP_DTLS_VERIFY_NONE = 0,               /*!< Don't verify anything */
00461    AST_RTP_DTLS_VERIFY_FINGERPRINT = (1 << 0), /*!< Verify the fingerprint */
00462    AST_RTP_DTLS_VERIFY_CERTIFICATE = (1 << 1), /*!< Verify the certificate */
00463 };

RTP DTMF Modes

Enumerator:
AST_RTP_DTMF_MODE_NONE  No DTMF is being carried over the RTP stream
AST_RTP_DTMF_MODE_RFC2833  DTMF is being carried out of band using RFC2833
AST_RTP_DTMF_MODE_INBAND  DTMF is being carried inband over the RTP stream

Definition at line 131 of file rtp_engine.h.

00131                        {
00132    /*! No DTMF is being carried over the RTP stream */
00133    AST_RTP_DTMF_MODE_NONE = 0,
00134    /*! DTMF is being carried out of band using RFC2833 */
00135    AST_RTP_DTMF_MODE_RFC2833,
00136    /*! DTMF is being carried inband over the RTP stream */
00137    AST_RTP_DTMF_MODE_INBAND,
00138 };

Result codes when RTP glue is queried for information

Enumerator:
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 141 of file rtp_engine.h.

00141                          {
00142    /*! No remote or local bridging is permitted */
00143    AST_RTP_GLUE_RESULT_FORBID = 0,
00144    /*! Move RTP stream to be remote between devices directly */
00145    AST_RTP_GLUE_RESULT_REMOTE,
00146    /*! Perform RTP engine level bridging if possible */
00147    AST_RTP_GLUE_RESULT_LOCAL,
00148 };

ICE candidate types.

Enumerator:
AST_RTP_ICE_CANDIDATE_TYPE_HOST  ICE host candidate. A host candidate represents the actual local transport address in the host.
AST_RTP_ICE_CANDIDATE_TYPE_SRFLX  ICE server reflexive candidate, which represents the public mapped address of the local address.
AST_RTP_ICE_CANDIDATE_TYPE_RELAYED  ICE relayed candidate, which represents the address allocated in TURN server.

Definition at line 383 of file rtp_engine.h.

00383                                 {
00384    AST_RTP_ICE_CANDIDATE_TYPE_HOST,    /*!< ICE host candidate. A host candidate represents the actual local transport address in the host. */
00385    AST_RTP_ICE_CANDIDATE_TYPE_SRFLX,   /*!< ICE server reflexive candidate, which represents the public mapped address of the local address. */
00386    AST_RTP_ICE_CANDIDATE_TYPE_RELAYED, /*!< ICE relayed candidate, which represents the address allocated in TURN server. */
00387 };

ICE component types.

Enumerator:
AST_RTP_ICE_COMPONENT_RTP 
AST_RTP_ICE_COMPONENT_RTCP 

Definition at line 390 of file rtp_engine.h.

00390                                 {
00391    AST_RTP_ICE_COMPONENT_RTP = 1,
00392    AST_RTP_ICE_COMPONENT_RTCP = 2,
00393 };

ICE role during negotiation.

Enumerator:
AST_RTP_ICE_ROLE_CONTROLLED 
AST_RTP_ICE_ROLE_CONTROLLING 

Definition at line 396 of file rtp_engine.h.

Statistics that can be retrieved from an RTP instance

Enumerator:
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
AST_RTP_INSTANCE_STAT_CHANNEL_UNIQUEID  Retrieve channel unique ID

Definition at line 163 of file rtp_engine.h.

00163                            {
00164    /*! Retrieve all statistics */
00165    AST_RTP_INSTANCE_STAT_ALL = 0,
00166    /*! Retrieve number of packets transmitted */
00167    AST_RTP_INSTANCE_STAT_TXCOUNT,
00168    /*! Retrieve number of packets received */
00169    AST_RTP_INSTANCE_STAT_RXCOUNT,
00170    /*! Retrieve ALL statistics relating to packet loss */
00171    AST_RTP_INSTANCE_STAT_COMBINED_LOSS,
00172    /*! Retrieve number of packets lost for transmitting */
00173    AST_RTP_INSTANCE_STAT_TXPLOSS,
00174    /*! Retrieve number of packets lost for receiving */
00175    AST_RTP_INSTANCE_STAT_RXPLOSS,
00176    /*! Retrieve maximum number of packets lost on remote side */
00177    AST_RTP_INSTANCE_STAT_REMOTE_MAXRXPLOSS,
00178    /*! Retrieve minimum number of packets lost on remote side */
00179    AST_RTP_INSTANCE_STAT_REMOTE_MINRXPLOSS,
00180    /*! Retrieve average number of packets lost on remote side */
00181    AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVRXPLOSS,
00182    /*! Retrieve standard deviation of packets lost on remote side */
00183    AST_RTP_INSTANCE_STAT_REMOTE_STDEVRXPLOSS,
00184    /*! Retrieve maximum number of packets lost on local side */
00185    AST_RTP_INSTANCE_STAT_LOCAL_MAXRXPLOSS,
00186    /*! Retrieve minimum number of packets lost on local side */
00187    AST_RTP_INSTANCE_STAT_LOCAL_MINRXPLOSS,
00188    /*! Retrieve average number of packets lost on local side */
00189    AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVRXPLOSS,
00190    /*! Retrieve standard deviation of packets lost on local side */
00191    AST_RTP_INSTANCE_STAT_LOCAL_STDEVRXPLOSS,
00192    /*! Retrieve ALL statistics relating to jitter */
00193    AST_RTP_INSTANCE_STAT_COMBINED_JITTER,
00194    /*! Retrieve jitter on transmitted packets */
00195    AST_RTP_INSTANCE_STAT_TXJITTER,
00196    /*! Retrieve jitter on received packets */
00197    AST_RTP_INSTANCE_STAT_RXJITTER,
00198    /*! Retrieve maximum jitter on remote side */
00199    AST_RTP_INSTANCE_STAT_REMOTE_MAXJITTER,
00200    /*! Retrieve minimum jitter on remote side */
00201    AST_RTP_INSTANCE_STAT_REMOTE_MINJITTER,
00202    /*! Retrieve average jitter on remote side */
00203    AST_RTP_INSTANCE_STAT_REMOTE_NORMDEVJITTER,
00204    /*! Retrieve standard deviation jitter on remote side */
00205    AST_RTP_INSTANCE_STAT_REMOTE_STDEVJITTER,
00206    /*! Retrieve maximum jitter on local side */
00207    AST_RTP_INSTANCE_STAT_LOCAL_MAXJITTER,
00208    /*! Retrieve minimum jitter on local side */
00209    AST_RTP_INSTANCE_STAT_LOCAL_MINJITTER,
00210    /*! Retrieve average jitter on local side */
00211    AST_RTP_INSTANCE_STAT_LOCAL_NORMDEVJITTER,
00212    /*! Retrieve standard deviation jitter on local side */
00213    AST_RTP_INSTANCE_STAT_LOCAL_STDEVJITTER,
00214    /*! Retrieve ALL statistics relating to round trip time */
00215    AST_RTP_INSTANCE_STAT_COMBINED_RTT,
00216    /*! Retrieve round trip time */
00217    AST_RTP_INSTANCE_STAT_RTT,
00218    /*! Retrieve maximum round trip time */
00219    AST_RTP_INSTANCE_STAT_MAX_RTT,
00220    /*! Retrieve minimum round trip time */
00221    AST_RTP_INSTANCE_STAT_MIN_RTT,
00222    /*! Retrieve average round trip time */
00223    AST_RTP_INSTANCE_STAT_NORMDEVRTT,
00224    /*! Retrieve standard deviation round trip time */
00225    AST_RTP_INSTANCE_STAT_STDEVRTT,
00226    /*! Retrieve local SSRC */
00227    AST_RTP_INSTANCE_STAT_LOCAL_SSRC,
00228    /*! Retrieve remote SSRC */
00229    AST_RTP_INSTANCE_STAT_REMOTE_SSRC,
00230    /*! Retrieve channel unique ID */
00231    AST_RTP_INSTANCE_STAT_CHANNEL_UNIQUEID,
00232 };

Field statistics that can be retrieved from an RTP instance

Enumerator:
AST_RTP_INSTANCE_STAT_FIELD_QUALITY  Retrieve quality information
AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER  Retrieve quality information about jitter
AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS  Retrieve quality information about packet loss
AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT  Retrieve quality information about round trip time

Definition at line 151 of file rtp_engine.h.

00151                                  {
00152    /*! Retrieve quality information */
00153    AST_RTP_INSTANCE_STAT_FIELD_QUALITY = 0,
00154    /*! Retrieve quality information about jitter */
00155    AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER,
00156    /*! Retrieve quality information about packet loss */
00157    AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS,
00158    /*! Retrieve quality information about round trip time */
00159    AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT,
00160 };

Additional RTP options

Enumerator:
AST_RTP_OPT_G726_NONSTANDARD  Remote side is using non-standard G.726

Definition at line 125 of file rtp_engine.h.

00125                      {
00126    /*! Remote side is using non-standard G.726 */
00127    AST_RTP_OPT_G726_NONSTANDARD = (1 << 0),
00128 };

RTP Properties that can be set on an RTP instance

Enumerator:
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.

Note:
THIS MUST BE THE LAST ENTRY IN THIS ENUM.

Definition at line 104 of file rtp_engine.h.

00104                       {
00105    /*! Enable symmetric RTP support */
00106    AST_RTP_PROPERTY_NAT = 0,
00107    /*! RTP instance will be carrying DTMF (using RFC2833) */
00108    AST_RTP_PROPERTY_DTMF,
00109    /*! Expect unreliable DTMF from remote party */
00110    AST_RTP_PROPERTY_DTMF_COMPENSATE,
00111    /*! Enable STUN support */
00112    AST_RTP_PROPERTY_STUN,
00113    /*! Enable RTCP support */
00114    AST_RTP_PROPERTY_RTCP,
00115 
00116    /*!
00117     * \brief Maximum number of RTP properties supported
00118     *
00119     * \note THIS MUST BE THE LAST ENTRY IN THIS ENUM.
00120     */
00121    AST_RTP_PROPERTY_MAX,
00122 };


Function Documentation

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.

Parameters:
codecs Codecs structure to look in
code The format to look for
Return values:
Numerical payload or -1 if unable to find payload in codecs
Example usage:

 int payload = ast_rtp_codecs_payload_code(&codecs, 0);

This looks for the numerical payload for ULAW in the codecs structure.

Definition at line 937 of file rtp_engine.c.

References ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::payload, and type.

Referenced by bridge_p2p_rtp_write().

00938 {
00939    struct ast_rtp_payload_type *type;
00940    int res = -1;
00941 
00942    ast_rwlock_rdlock(&codecs->codecs_lock);
00943    if (code < AST_VECTOR_SIZE(&codecs->payloads)) {
00944       type = AST_VECTOR_GET(&codecs->payloads, code);
00945       if (type) {
00946          res = type->payload;
00947       }
00948    }
00949    ast_rwlock_unlock(&codecs->codecs_lock);
00950 
00951    return res;
00952 }

unsigned int ast_rtp_codecs_get_framing ( struct ast_rtp_codecs codecs  ) 

Get the framing used for a set of codecs.

Parameters:
codecs Codecs structure to get the framing from
Return values:
The framing to be used for the media stream associated with these codecs
Since:
13.0.0

Definition at line 856 of file rtp_engine.c.

References ast_rwlock_rdlock, ast_rwlock_unlock, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.

Referenced by ast_rtp_write(), and create_outgoing_sdp_stream().

00857 {
00858    unsigned int framing;
00859 
00860    ast_rwlock_rdlock(&codecs->codecs_lock);
00861    framing = codecs->framing;
00862    ast_rwlock_unlock(&codecs->codecs_lock);
00863 
00864    return framing;
00865 }

struct ast_rtp_payload_type* ast_rtp_codecs_get_payload ( struct ast_rtp_codecs codecs,
int  payload 
) [read]

Retrieve payload information by payload.

Parameters:
codecs Codecs structure to look in
payload Numerical payload to look up
Return values:
Payload information.
NULL if payload does not exist.
Note:
The payload returned by this function has its reference count increased. Callers are responsible for decrementing the reference count.
Example usage:

 struct ast_rtp_payload_type *payload_type;
 payload_type = ast_rtp_codecs_get_payload(&codecs, 0);

This looks up the information for payload '0' from the codecs structure.

Definition at line 773 of file rtp_engine.c.

References ao2_bump, ast_rtp_engine_alloc_payload_type(), AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, format, ast_rtp_payload_type::format, NULL, ast_rtp_payload_type::payload, ast_rtp_payload_type::rtp_code, static_RTP_PT, and type.

Referenced by ast_rtp_read(), and bridge_p2p_rtp_write().

00774 {
00775    struct ast_rtp_payload_type *type = NULL;
00776 
00777    if (payload < 0 || payload >= AST_RTP_MAX_PT) {
00778       return NULL;
00779    }
00780 
00781    ast_rwlock_rdlock(&codecs->codecs_lock);
00782    if (payload < AST_VECTOR_SIZE(&codecs->payloads)) {
00783       type = AST_VECTOR_GET(&codecs->payloads, payload);
00784       ao2_bump(type);
00785    }
00786    ast_rwlock_unlock(&codecs->codecs_lock);
00787 
00788    if (!type) {
00789       type = ast_rtp_engine_alloc_payload_type();
00790       if (!type) {
00791          return NULL;
00792       }
00793       ast_rwlock_rdlock(&static_RTP_PT_lock);
00794       type->asterisk_format = static_RTP_PT[payload].asterisk_format;
00795       type->rtp_code = static_RTP_PT[payload].rtp_code;
00796       type->payload = payload;
00797       type->format = ao2_bump(static_RTP_PT[payload].format);
00798       ast_rwlock_unlock(&static_RTP_PT_lock);
00799    }
00800 
00801    return type;
00802 }

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.

Parameters:
codecs Codecs structure to look in
payload Numerical payload to look up
Return values:
pointer to format structure on success
NULL on failure
Note:
The format returned by this function has its reference count increased. Callers are responsible for decrementing the reference count.
Since:
10.0

Definition at line 824 of file rtp_engine.c.

References ao2_bump, AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, format, NULL, and type.

Referenced by get_codecs(), process_sdp_a_audio(), and process_sdp_a_video().

00825 {
00826    struct ast_rtp_payload_type *type;
00827    struct ast_format *format = NULL;
00828 
00829    if (payload < 0 || payload >= AST_RTP_MAX_PT) {
00830       return NULL;
00831    }
00832 
00833    ast_rwlock_rdlock(&codecs->codecs_lock);
00834    if (payload < AST_VECTOR_SIZE(&codecs->payloads)) {
00835       type = AST_VECTOR_GET(&codecs->payloads, payload);
00836       if (type && type->asterisk_format) {
00837          format = ao2_bump(type->format);
00838       }
00839    }
00840    ast_rwlock_unlock(&codecs->codecs_lock);
00841 
00842    return format;
00843 }

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.

Parameters:
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
Return values:
Numerical payload
Example usage:

 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.

Since:
1.8

Definition at line 897 of file rtp_engine.c.

References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, AST_FORMAT_CMP_NOT_EQUAL, AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, ast_rtp_payload_type::payload, ast_rtp_payload_type::rtp_code, 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(), create_outgoing_sdp_stream(), jingle_add_payloads_to_description(), multicast_rtp_write(), and send_start_rtp().

00898 {
00899    struct ast_rtp_payload_type *type;
00900    int i;
00901    int payload = -1;
00902 
00903    ast_rwlock_rdlock(&codecs->codecs_lock);
00904    for (i = 0; i < AST_VECTOR_SIZE(&codecs->payloads); i++) {
00905       type = AST_VECTOR_GET(&codecs->payloads, i);
00906       if (!type) {
00907          continue;
00908       }
00909 
00910       if ((asterisk_format && format && ast_format_cmp(format, type->format) == AST_FORMAT_CMP_EQUAL)
00911          || (!asterisk_format && type->rtp_code == code)) {
00912          payload = i;
00913          break;
00914       }
00915    }
00916    ast_rwlock_unlock(&codecs->codecs_lock);
00917 
00918    if (payload < 0) {
00919       ast_rwlock_rdlock(&static_RTP_PT_lock);
00920       for (i = 0; i < AST_RTP_MAX_PT; i++) {
00921          if (static_RTP_PT[i].asterisk_format && asterisk_format && format &&
00922             (ast_format_cmp(format, static_RTP_PT[i].format) != AST_FORMAT_CMP_NOT_EQUAL)) {
00923             payload = i;
00924             break;
00925          } else if (!static_RTP_PT[i].asterisk_format && !asterisk_format &&
00926             (static_RTP_PT[i].rtp_code == code)) {
00927             payload = i;
00928             break;
00929          }
00930       }
00931       ast_rwlock_unlock(&static_RTP_PT_lock);
00932    }
00933 
00934    return payload;
00935 }

void ast_rtp_codecs_payload_formats ( struct ast_rtp_codecs codecs,
struct ast_format_cap astformats,
int *  nonastformats 
)

Retrieve all formats that were found.

Parameters:
codecs Codecs structure to look in
astformats A capabilities structure to put the Asterisk formats in.
nonastformats An integer to put the non-Asterisk formats in
Example usage:

 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.

Since:
1.8

Definition at line 867 of file rtp_engine.c.

References ast_format_cap_append, ast_format_cap_remove_by_type(), ast_format_cap_set_framing(), AST_MEDIA_TYPE_UNKNOWN, ast_rwlock_rdlock, ast_rwlock_unlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, ast_rtp_codecs::framing, ast_rtp_payload_type::rtp_code, and type.

Referenced by jingle_interpret_description(), process_sdp(), and set_caps().

00868 {
00869    int i;
00870 
00871    ast_format_cap_remove_by_type(astformats, AST_MEDIA_TYPE_UNKNOWN);
00872    *nonastformats = 0;
00873 
00874    ast_rwlock_rdlock(&codecs->codecs_lock);
00875    for (i = 0; i < AST_VECTOR_SIZE(&codecs->payloads); i++) {
00876       struct ast_rtp_payload_type *type;
00877 
00878       type = AST_VECTOR_GET(&codecs->payloads, i);
00879       if (!type) {
00880          continue;
00881       }
00882 
00883       if (type->asterisk_format) {
00884          ast_format_cap_append(astformats, type->format, 0);
00885       } else {
00886          *nonastformats |= type->rtp_code;
00887       }
00888    }
00889 
00890    if (codecs->framing) {
00891       ast_format_cap_set_framing(astformats, codecs->framing);
00892    }
00893 
00894    ast_rwlock_unlock(&codecs->codecs_lock);
00895 }

int ast_rtp_codecs_payload_replace_format ( struct ast_rtp_codecs codecs,
int  payload,
struct ast_format format 
)

Update the format associated with a payload in a codecs structure.

Parameters:
codecs Codecs structure to operate on
payload Numerical payload to look up
format The format to replace the existing one
Return values:
0 success
-1 failure
Since:
13

Definition at line 804 of file rtp_engine.c.

References ao2_replace, AST_RTP_MAX_PT, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_payload_type::format, and type.

Referenced by get_codecs(), process_sdp_a_audio(), and process_sdp_a_video().

00805 {
00806    struct ast_rtp_payload_type *type;
00807 
00808    if (payload < 0 || payload >= AST_RTP_MAX_PT) {
00809       return -1;
00810    }
00811 
00812    ast_rwlock_wrlock(&codecs->codecs_lock);
00813    if (payload < AST_VECTOR_SIZE(&codecs->payloads)) {
00814       type = AST_VECTOR_GET(&codecs->payloads, payload);
00815       if (type && type->asterisk_format) {
00816          ao2_replace(type->format, format);
00817       }
00818    }
00819    ast_rwlock_unlock(&codecs->codecs_lock);
00820 
00821    return 0;
00822 }

void ast_rtp_codecs_payloads_clear ( struct ast_rtp_codecs codecs,
struct ast_rtp_instance instance 
)

Clear payload information from an RTP instance.

Parameters:
codecs The codecs structure that payloads will be cleared from
instance Optionally the instance that the codecs structure belongs to
Example usage:

This clears the codecs structure and puts it into a pristine state.

Since:
1.8

Definition at line 595 of file rtp_engine.c.

References ast_rtp_codecs_payloads_destroy(), ast_rtp_codecs_payloads_initialize(), AST_RTP_MAX_PT, ast_rtp_instance::engine, NULL, and ast_rtp_engine::payload_set.

Referenced by process_sdp().

00596 {
00597    ast_rtp_codecs_payloads_destroy(codecs);
00598 
00599    if (instance && instance->engine && instance->engine->payload_set) {
00600       int i;
00601       for (i = 0; i < AST_RTP_MAX_PT; i++) {
00602          instance->engine->payload_set(instance, i, 0, NULL, 0);
00603       }
00604    }
00605 
00606    ast_rtp_codecs_payloads_initialize(codecs);
00607 }

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.

Parameters:
src The source codecs structure
dest The destination codecs structure that the values from src will be copied to
instance Optionally the instance that the dst codecs structure belongs to
Example usage:

 ast_rtp_codecs_payloads_copy(&codecs0, &codecs1, NULL);

This copies the payloads from the codecs0 structure to the codecs1 structure, overwriting any current values.

Since:
1.8

Definition at line 609 of file rtp_engine.c.

References ao2_bump, ao2_t_cleanup, ast_debug, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_INSERT, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, ast_rtp_payload_type::format, ast_rtp_codecs::framing, ast_rtp_engine::payload_set, ast_rtp_payload_type::rtp_code, and type.

Referenced by ast_rtp_instance_early_bridge_make_compatible(), jingle_interpret_description(), process_sdp(), and set_caps().

00610 {
00611    int i;
00612 
00613    ast_rwlock_rdlock(&src->codecs_lock);
00614    ast_rwlock_wrlock(&dest->codecs_lock);
00615 
00616    for (i = 0; i < AST_VECTOR_SIZE(&src->payloads); i++) {
00617       struct ast_rtp_payload_type *type;
00618 
00619       type = AST_VECTOR_GET(&src->payloads, i);
00620       if (!type) {
00621          continue;
00622       }
00623       if (i < AST_VECTOR_SIZE(&dest->payloads)) {
00624          ao2_t_cleanup(AST_VECTOR_GET(&dest->payloads, i), "cleaning up vector element about to be replaced");
00625       }
00626       ast_debug(2, "Copying payload %d (%p) from %p to %p\n", i, type, src, dest);
00627       ao2_bump(type);
00628       AST_VECTOR_INSERT(&dest->payloads, i, type);
00629 
00630       if (instance && instance->engine && instance->engine->payload_set) {
00631          instance->engine->payload_set(instance, i, type->asterisk_format, type->format, type->rtp_code);
00632       }
00633    }
00634    dest->framing = src->framing;
00635    ast_rwlock_unlock(&dest->codecs_lock);
00636    ast_rwlock_unlock(&src->codecs_lock);
00637 }

void ast_rtp_codecs_payloads_destroy ( struct ast_rtp_codecs codecs  ) 

Destroy the contents of an RTP codecs structure (but not the structure itself).

Parameters:
codecs The codecs structure to destroy the contents of
Example usage:

Since:
11

Definition at line 580 of file rtp_engine.c.

References ao2_t_cleanup, ast_rwlock_destroy, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, and type.

Referenced by ast_rtp_codecs_payloads_clear(), instance_destructor(), jingle_interpret_description(), process_sdp(), and set_caps().

00581 {
00582    int i;
00583 
00584    for (i = 0; i < AST_VECTOR_SIZE(&codecs->payloads); i++) {
00585       struct ast_rtp_payload_type *type;
00586 
00587       type = AST_VECTOR_GET(&codecs->payloads, i);
00588       ao2_t_cleanup(type, "destroying ast_rtp_codec");
00589    }
00590    AST_VECTOR_FREE(&codecs->payloads);
00591 
00592    ast_rwlock_destroy(&codecs->codecs_lock);
00593 }

int ast_rtp_codecs_payloads_initialize ( struct ast_rtp_codecs codecs  ) 

Initialize an RTP codecs structure.

Parameters:
codecs The codecs structure to initialize
Return values:
0 success
-1 failure
Example usage:

Since:
11

Definition at line 569 of file rtp_engine.c.

References AST_RTP_MAX_PT, ast_rwlock_init, AST_VECTOR_INIT, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.

Referenced by ast_rtp_codecs_payloads_clear(), ast_rtp_instance_new(), get_codecs(), jingle_interpret_description(), and process_sdp().

00570 {
00571    int res;
00572 
00573    codecs->framing = 0;
00574    ast_rwlock_init(&codecs->codecs_lock);
00575    res = AST_VECTOR_INIT(&codecs->payloads, AST_RTP_MAX_PT);
00576 
00577    return res;
00578 }

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.

Parameters:
codecs The codecs structure to muck with
instance Optionally the instance that the codecs structure belongs to
payload Numerical payload that was seen in the m= SDP line
Example usage:

This records that the numerical payload '0' was seen in the codecs structure.

Since:
1.8

Definition at line 639 of file rtp_engine.c.

References ao2_bump, ao2_t_cleanup, ast_debug, ast_rtp_engine_alloc_payload_type(), AST_RTP_MAX_PT, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_INSERT, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, format, ast_rtp_payload_type::format, 31cd4f4891ec_add_auto_dtmf_mode::new_type, ast_rtp_payload_type::payload, ast_rtp_engine::payload_set, ast_rtp_payload_type::rtp_code, and static_RTP_PT.

Referenced by get_codecs(), and process_sdp().

00640 {
00641    struct ast_rtp_payload_type *new_type;
00642 
00643    new_type = ast_rtp_engine_alloc_payload_type();
00644    if (!new_type) {
00645       return;
00646    }
00647 
00648    ast_rwlock_rdlock(&static_RTP_PT_lock);
00649    if (payload < 0 || payload >= AST_RTP_MAX_PT) {
00650       ast_rwlock_unlock(&static_RTP_PT_lock);
00651       return;
00652    }
00653 
00654    ast_rwlock_wrlock(&codecs->codecs_lock);
00655    if (payload < AST_VECTOR_SIZE(&codecs->payloads)) {
00656       ao2_t_cleanup(AST_VECTOR_GET(&codecs->payloads, payload), "cleaning up replaced payload type");
00657    }
00658 
00659    new_type->asterisk_format = static_RTP_PT[payload].asterisk_format;
00660    new_type->rtp_code = static_RTP_PT[payload].rtp_code;
00661    new_type->payload = payload;
00662    new_type->format = ao2_bump(static_RTP_PT[payload].format);
00663 
00664    ast_debug(1, "Setting payload %d (%p) based on m type on %p\n", payload, new_type, codecs);
00665    AST_VECTOR_INSERT(&codecs->payloads, payload, new_type);
00666 
00667    if (instance && instance->engine && instance->engine->payload_set) {
00668       instance->engine->payload_set(instance, payload, new_type->asterisk_format, new_type->format, new_type->rtp_code);
00669    }
00670 
00671    ast_rwlock_unlock(&codecs->codecs_lock);
00672    ast_rwlock_unlock(&static_RTP_PT_lock);
00673 }

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.

Parameters:
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
Return values:
0 success
-1 failure, invalid payload numbe
-2 failure, unknown mimetype
Example usage:

 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.

Since:
1.8

Definition at line 744 of file rtp_engine.c.

References ast_rtp_codecs_payloads_set_rtpmap_type_rate().

Referenced by configure_local_rtp(), jingle_interpret_description(), ooh323_set_write_format(), process_sdp(), and setup_rtp_connection().

00745 {
00746    return ast_rtp_codecs_payloads_set_rtpmap_type_rate(codecs, instance, payload, mimetype, mimesubtype, options, 0);
00747 }

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.

Parameters:
codecs RTP structure to modify
instance Optionally the instance that the codecs structure belongs to
pt Payload type entry to modify
mimetype top-level MIME type of media stream (typically "audio", "video", "text", etc.)
mimesubtype MIME subtype of media stream (typically a codec name)
options Zero or more flags from the ast_rtp_options enum
sample_rate The sample rate of the media stream
This function 'fills in' an entry in the list of possible formats for a media stream associated with an RTP structure.

Return values:
0 on success
-1 if the payload type is out of range
-2 if the mimeType/mimeSubtype combination was not found
Since:
1.8

Definition at line 675 of file rtp_engine.c.

References ao2_bump, ao2_t_cleanup, ast_format_cmp(), AST_FORMAT_CMP_EQUAL, ast_format_g726, ast_format_g726_aal2, ast_rtp_engine_alloc_payload_type(), AST_RTP_MAX_PT, ast_rtp_mime_types, AST_RTP_OPT_G726_NONSTANDARD, ast_rwlock_rdlock, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_INSERT, AST_VECTOR_SIZE, ast_rtp_payload_type::asterisk_format, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, ast_rtp_payload_type::format, 31cd4f4891ec_add_auto_dtmf_mode::new_type, ast_rtp_payload_type::payload, ast_rtp_engine::payload_set, ast_rtp_mime_type::payload_type, ast_rtp_payload_type::rtp_code, ast_rtp_mime_type::sample_rate, ast_rtp_mime_type::subtype, and ast_rtp_mime_type::type.

Referenced by ast_rtp_codecs_payloads_set_rtpmap_type(), get_codecs(), jingle_interpret_description(), process_sdp_a_audio(), process_sdp_a_text(), and process_sdp_a_video().

00679 {
00680    unsigned int i;
00681    int found = 0;
00682 
00683    ast_rwlock_rdlock(&mime_types_lock);
00684    if (pt < 0 || pt >= AST_RTP_MAX_PT) {
00685       ast_rwlock_unlock(&mime_types_lock);
00686       return -1; /* bogus payload type */
00687    }
00688 
00689    ast_rwlock_wrlock(&codecs->codecs_lock);
00690    for (i = 0; i < mime_types_len; ++i) {
00691       const struct ast_rtp_mime_type *t = &ast_rtp_mime_types[i];
00692       struct ast_rtp_payload_type *new_type;
00693 
00694       if (strcasecmp(mimesubtype, t->subtype)) {
00695          continue;
00696       }
00697 
00698       if (strcasecmp(mimetype, t->type)) {
00699          continue;
00700       }
00701 
00702       /* if both sample rates have been supplied, and they don't match,
00703        * then this not a match; if one has not been supplied, then the
00704        * rates are not compared */
00705       if (sample_rate && t->sample_rate &&
00706           (sample_rate != t->sample_rate)) {
00707          continue;
00708       }
00709 
00710       found = 1;
00711 
00712       new_type = ast_rtp_engine_alloc_payload_type();
00713       if (!new_type) {
00714          continue;
00715       }
00716 
00717       if (pt < AST_VECTOR_SIZE(&codecs->payloads)) {
00718          ao2_t_cleanup(AST_VECTOR_GET(&codecs->payloads, pt), "cleaning up replaced payload type");
00719       }
00720 
00721       new_type->payload = pt;
00722       new_type->asterisk_format = t->payload_type.asterisk_format;
00723       new_type->rtp_code = t->payload_type.rtp_code;
00724       if ((ast_format_cmp(t->payload_type.format, ast_format_g726) == AST_FORMAT_CMP_EQUAL) &&
00725             t->payload_type.asterisk_format && (options & AST_RTP_OPT_G726_NONSTANDARD)) {
00726          new_type->format = ao2_bump(ast_format_g726_aal2);
00727       } else {
00728          new_type->format = ao2_bump(t->payload_type.format);
00729       }
00730       AST_VECTOR_INSERT(&codecs->payloads, pt, new_type);
00731 
00732       if (instance && instance->engine && instance->engine->payload_set) {
00733          instance->engine->payload_set(instance, pt, new_type->asterisk_format, new_type->format, new_type->rtp_code);
00734       }
00735 
00736       break;
00737    }
00738    ast_rwlock_unlock(&codecs->codecs_lock);
00739    ast_rwlock_unlock(&mime_types_lock);
00740 
00741    return (found ? 0 : -2);
00742 }

void ast_rtp_codecs_payloads_unset ( struct ast_rtp_codecs codecs,
struct ast_rtp_instance instance,
int  payload 
)

Remove payload information.

Parameters:
codecs The codecs structure to muck with
instance Optionally the instance that the codecs structure belongs to
payload Numerical payload to unset
Example usage:

This clears the payload '0' from the codecs structure. It will be as if it was never set.

Since:
1.8

Definition at line 749 of file rtp_engine.c.

References ao2_cleanup, ast_debug, AST_RTP_MAX_PT, ast_rwlock_unlock, ast_rwlock_wrlock, AST_VECTOR_GET, AST_VECTOR_INSERT, AST_VECTOR_SIZE, ast_rtp_codecs::codecs_lock, ast_rtp_instance::engine, NULL, ast_rtp_engine::payload_set, and type.

Referenced by process_sdp_a_audio(), and process_sdp_a_video().

00750 {
00751    struct ast_rtp_payload_type *type;
00752 
00753    if (payload < 0 || payload >= AST_RTP_MAX_PT) {
00754       return;
00755    }
00756 
00757    ast_debug(2, "Unsetting payload %d on %p\n", payload, codecs);
00758 
00759    ast_rwlock_wrlock(&codecs->codecs_lock);
00760    if (payload < AST_VECTOR_SIZE(&codecs->payloads)) {
00761       type = AST_VECTOR_GET(&codecs->payloads, payload);
00762       ao2_cleanup(type);
00763       AST_VECTOR_INSERT(&codecs->payloads, payload, NULL);
00764    }
00765 
00766    if (instance && instance->engine && instance->engine->payload_set) {
00767       instance->engine->payload_set(instance, payload, 0, NULL, 0);
00768    }
00769 
00770    ast_rwlock_unlock(&codecs->codecs_lock);
00771 }

void ast_rtp_codecs_set_framing ( struct ast_rtp_codecs codecs,
unsigned int  framing 
)

Set the framing used for a set of codecs.

Parameters:
codecs Codecs structure to set framing on
framing The framing value to set on the codecs
Since:
13.0.0

Definition at line 845 of file rtp_engine.c.

References ast_rwlock_unlock, ast_rwlock_wrlock, ast_rtp_codecs::codecs_lock, and ast_rtp_codecs::framing.

Referenced by check_peer_ok(), configure_local_rtp(), create_addr_from_peer(), get_codecs(), jingle_enable_video(), jingle_new(), process_sdp_a_audio(), start_rtp(), and transmit_response_with_sdp().

00846 {
00847    if (!framing) {
00848       return;
00849    }
00850 
00851    ast_rwlock_wrlock(&codecs->codecs_lock);
00852    codecs->framing = framing;
00853    ast_rwlock_unlock(&codecs->codecs_lock);
00854 }

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.

Parameters:
src_cfg source DTLS configuration structure
dst_cfg destination DTLS configuration structure

Definition at line 1660 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::hash, ast_rtp_dtls_cfg::pvtfile, ast_rtp_dtls_cfg::rekey, ast_rtp_dtls_cfg::suite, and ast_rtp_dtls_cfg::verify.

Referenced by build_peer(), check_peer_ok(), and create_addr_from_peer().

01661 {
01662    dst_cfg->enabled = src_cfg->enabled;
01663    dst_cfg->verify = src_cfg->verify;
01664    dst_cfg->rekey = src_cfg->rekey;
01665    dst_cfg->suite = src_cfg->suite;
01666    dst_cfg->hash = src_cfg->hash;
01667    dst_cfg->certfile = ast_strdup(src_cfg->certfile);
01668    dst_cfg->pvtfile = ast_strdup(src_cfg->pvtfile);
01669    dst_cfg->cipher = ast_strdup(src_cfg->cipher);
01670    dst_cfg->cafile = ast_strdup(src_cfg->cafile);
01671    dst_cfg->capath = ast_strdup(src_cfg->capath);
01672    dst_cfg->default_setup = src_cfg->default_setup;
01673 }

void ast_rtp_dtls_cfg_free ( struct ast_rtp_dtls_cfg dtls_cfg  ) 

Free contents of a DTLS configuration structure.

Parameters:
dtls_cfg a DTLS configuration structure

Definition at line 1675 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(), build_peer(), reload_config(), sip_destroy_peer(), and unload_module().

01676 {
01677    ast_free(dtls_cfg->certfile);
01678    ast_free(dtls_cfg->pvtfile);
01679    ast_free(dtls_cfg->cipher);
01680    ast_free(dtls_cfg->cafile);
01681    ast_free(dtls_cfg->capath);
01682 }

int ast_rtp_dtls_cfg_parse ( struct ast_rtp_dtls_cfg dtls_cfg,
const char *  name,
const char *  value 
)

Parse DTLS related configuration options.

Parameters:
dtls_cfg a DTLS configuration structure
name name of the configuration option
value value of the configuration option
Return values:
0 if handled
-1 if not handled

Definition at line 1604 of file rtp_engine.c.

References ast_free, AST_RTP_DTLS_HASH_SHA1, AST_RTP_DTLS_HASH_SHA256, AST_RTP_DTLS_SETUP_ACTIVE, AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_SETUP_PASSIVE, AST_RTP_DTLS_VERIFY_CERTIFICATE, AST_RTP_DTLS_VERIFY_FINGERPRINT, AST_RTP_DTLS_VERIFY_NONE, ast_strdup, ast_true(), ast_rtp_dtls_cfg::cafile, ast_rtp_dtls_cfg::capath, ast_rtp_dtls_cfg::certfile, ast_rtp_dtls_cfg::cipher, ast_rtp_dtls_cfg::default_setup, ast_rtp_dtls_cfg::enabled, ast_rtp_dtls_cfg::hash, ast_rtp_dtls_cfg::pvtfile, ast_rtp_dtls_cfg::rekey, and ast_rtp_dtls_cfg::verify.

Referenced by build_peer(), dtls_handler(), media_encryption_handler(), and reload_config().

01605 {
01606    if (!strcasecmp(name, "dtlsenable")) {
01607       dtls_cfg->enabled = ast_true(value) ? 1 : 0;
01608    } else if (!strcasecmp(name, "dtlsverify")) {
01609       if (!strcasecmp(value, "yes")) {
01610          dtls_cfg->verify = AST_RTP_DTLS_VERIFY_FINGERPRINT | AST_RTP_DTLS_VERIFY_CERTIFICATE;
01611       } else if (!strcasecmp(value, "fingerprint")) {
01612          dtls_cfg->verify = AST_RTP_DTLS_VERIFY_FINGERPRINT;
01613       } else if (!strcasecmp(value, "certificate")) {
01614          dtls_cfg->verify = AST_RTP_DTLS_VERIFY_CERTIFICATE;
01615       } else if (!strcasecmp(value, "no")) {
01616          dtls_cfg->verify = AST_RTP_DTLS_VERIFY_NONE;
01617       } else {
01618          return -1;
01619       }
01620    } else if (!strcasecmp(name, "dtlsrekey")) {
01621       if (sscanf(value, "%30u", &dtls_cfg->rekey) != 1) {
01622          return -1;
01623       }
01624    } else if (!strcasecmp(name, "dtlscertfile")) {
01625       ast_free(dtls_cfg->certfile);
01626       dtls_cfg->certfile = ast_strdup(value);
01627    } else if (!strcasecmp(name, "dtlsprivatekey")) {
01628       ast_free(dtls_cfg->pvtfile);
01629       dtls_cfg->pvtfile = ast_strdup(value);
01630    } else if (!strcasecmp(name, "dtlscipher")) {
01631       ast_free(dtls_cfg->cipher);
01632       dtls_cfg->cipher = ast_strdup(value);
01633    } else if (!strcasecmp(name, "dtlscafile")) {
01634       ast_free(dtls_cfg->cafile);
01635       dtls_cfg->cafile = ast_strdup(value);
01636    } else if (!strcasecmp(name, "dtlscapath") || !strcasecmp(name, "dtlscadir")) {
01637       ast_free(dtls_cfg->capath);
01638       dtls_cfg->capath = ast_strdup(value);
01639    } else if (!strcasecmp(name, "dtlssetup")) {
01640       if (!strcasecmp(value, "active")) {
01641          dtls_cfg->default_setup = AST_RTP_DTLS_SETUP_ACTIVE;
01642       } else if (!strcasecmp(value, "passive")) {
01643          dtls_cfg->default_setup = AST_RTP_DTLS_SETUP_PASSIVE;
01644       } else if (!strcasecmp(value, "actpass")) {
01645          dtls_cfg->default_setup = AST_RTP_DTLS_SETUP_ACTPASS;
01646       }
01647    } else if (!strcasecmp(name, "dtlsfingerprint")) {
01648       if (!strcasecmp(value, "sha-256")) {
01649          dtls_cfg->hash = AST_RTP_DTLS_HASH_SHA256;
01650       } else if (!strcasecmp(value, "sha-1")) {
01651          dtls_cfg->hash = AST_RTP_DTLS_HASH_SHA1;
01652       }
01653    } else {
01654       return -1;
01655    }
01656 
01657    return 0;
01658 }

struct ast_rtp_payload_type* ast_rtp_engine_alloc_payload_type ( void   )  [read]

Allocation routine for ast_rtp_payload_type.

Return values:
NULL on error
An ao2 ref counted ast_rtp_payload_type on success.
Note:
The ast_rtp_payload_type returned by this function is an ao2 ref counted object.

Definition at line 243 of file rtp_engine.c.

References ao2_alloc, ast_rtp_payload_type::payload, and rtp_payload_type_dtor().

Referenced by ast_rtp_codecs_get_payload(), ast_rtp_codecs_payloads_set_m_type(), and ast_rtp_codecs_payloads_set_rtpmap_type_rate().

00244 {
00245    struct ast_rtp_payload_type *payload;
00246 
00247    payload = ao2_alloc(sizeof(*payload), rtp_payload_type_dtor);
00248 
00249    return payload;
00250 }

int ast_rtp_engine_load_format ( struct ast_format format  ) 

Custom formats declared in codecs.conf at startup must be communicated to the rtp_engine so their mime type can payload number can be initialized.

Definition at line 1757 of file rtp_engine.c.

References add_static_payload(), ast_codec_media_type2str(), ast_format_get_name(), ast_format_get_sample_rate(), ast_format_get_type(), ast_str_to_upper(), ast_strdupa, and set_next_mime_type().

01758 {
01759    char *codec_name = ast_strdupa(ast_format_get_name(format));
01760 
01761    codec_name = ast_str_to_upper(codec_name);
01762 
01763    set_next_mime_type(format,
01764       0,
01765       ast_codec_media_type2str(ast_format_get_type(format)),
01766       codec_name,
01767       ast_format_get_sample_rate(format));
01768    add_static_payload(-1, format, 0);
01769 
01770    return 0;
01771 }

int ast_rtp_engine_register2 ( struct ast_rtp_engine engine,
struct ast_module module 
)

Register an RTP engine.

Parameters:
engine Structure of the RTP engine to register
module Module that the RTP engine is part of
Return values:
0 success
-1 failure
Example usage:

 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.

Note:
It is recommended that you use the ast_rtp_engine_register macro so that the module is associated with the RTP engine and use counting is performed.
Since:
1.8

Definition at line 252 of file rtp_engine.c.

References ast_log, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero, ast_verb, ast_rtp_engine::destroy, LOG_WARNING, ast_rtp_engine::mod, ast_rtp_engine::name, ast_rtp_engine::new, ast_rtp_engine::read, and ast_rtp_engine::write.

00253 {
00254    struct ast_rtp_engine *current_engine;
00255 
00256    /* Perform a sanity check on the engine structure to make sure it has the basics */
00257    if (ast_strlen_zero(engine->name) || !engine->new || !engine->destroy || !engine->write || !engine->read) {
00258       ast_log(LOG_WARNING, "RTP Engine '%s' failed sanity check so it was not registered.\n", !ast_strlen_zero(engine->name) ? engine->name : "Unknown");
00259       return -1;
00260    }
00261 
00262    /* Link owner module to the RTP engine for reference counting purposes */
00263    engine->mod = module;
00264 
00265    AST_RWLIST_WRLOCK(&engines);
00266 
00267    /* Ensure that no two modules with the same name are registered at the same time */
00268    AST_RWLIST_TRAVERSE(&engines, current_engine, entry) {
00269       if (!strcmp(current_engine->name, engine->name)) {
00270          ast_log(LOG_WARNING, "An RTP engine with the name '%s' has already been registered.\n", engine->name);
00271          AST_RWLIST_UNLOCK(&engines);
00272          return -1;
00273       }
00274    }
00275 
00276    /* The engine survived our critique. Off to the list it goes to be used */
00277    AST_RWLIST_INSERT_TAIL(&engines, engine, entry);
00278 
00279    AST_RWLIST_UNLOCK(&engines);
00280 
00281    ast_verb(2, "Registered RTP engine '%s'\n", engine->name);
00282 
00283    return 0;
00284 }

int ast_rtp_engine_register_srtp ( struct ast_srtp_res srtp_res,
struct ast_srtp_policy_res policy_res 
)

Definition at line 1534 of file rtp_engine.c.

Referenced by res_srtp_init().

01535 {
01536    if (res_srtp || res_srtp_policy) {
01537       return -1;
01538    }
01539    if (!srtp_res || !policy_res) {
01540       return -1;
01541    }
01542 
01543    res_srtp = srtp_res;
01544    res_srtp_policy = policy_res;
01545 
01546    return 0;
01547 }

int ast_rtp_engine_srtp_is_registered ( void   ) 

int ast_rtp_engine_unload_format ( struct ast_format format  ) 

Formats requiring the use of a format attribute interface must have that interface registered in order for the rtp engine to handle it correctly. If an attribute interface is unloaded, this function must be called to notify the rtp_engine.

Definition at line 1773 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, rtp_engine_mime_type_cleanup(), rtp_engine_static_RTP_PT_cleanup(), and static_RTP_PT.

01774 {
01775    int x;
01776    int y = 0;
01777 
01778    ast_rwlock_wrlock(&static_RTP_PT_lock);
01779    /* remove everything pertaining to this format id from the lists */
01780    for (x = 0; x < AST_RTP_MAX_PT; x++) {
01781       if (ast_format_cmp(static_RTP_PT[x].format, format) == AST_FORMAT_CMP_EQUAL) {
01782          rtp_engine_static_RTP_PT_cleanup(x);
01783       }
01784    }
01785    ast_rwlock_unlock(&static_RTP_PT_lock);
01786 
01787    ast_rwlock_wrlock(&mime_types_lock);
01788    /* rebuild the list skipping the items matching this id */
01789    for (x = 0; x < mime_types_len; x++) {
01790       if (ast_format_cmp(ast_rtp_mime_types[x].payload_type.format, format) == AST_FORMAT_CMP_EQUAL) {
01791          rtp_engine_mime_type_cleanup(x);
01792          continue;
01793       }
01794       ast_rtp_mime_types[y] = ast_rtp_mime_types[x];
01795       y++;
01796    }
01797    mime_types_len = y;
01798    ast_rwlock_unlock(&mime_types_lock);
01799    return 0;
01800 }

int ast_rtp_engine_unregister ( struct ast_rtp_engine engine  ) 

Unregister an RTP engine.

Parameters:
engine Structure of the RTP engine to unregister
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 286 of file rtp_engine.c.

References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, ast_rtp_engine::name, and NULL.

Referenced by load_module(), and unload_module().

00287 {
00288    struct ast_rtp_engine *current_engine = NULL;
00289 
00290    AST_RWLIST_WRLOCK(&engines);
00291 
00292    if ((current_engine = AST_RWLIST_REMOVE(&engines, engine, entry))) {
00293       ast_verb(2, "Unregistered RTP engine '%s'\n", engine->name);
00294    }
00295 
00296    AST_RWLIST_UNLOCK(&engines);
00297 
00298    return current_engine ? 0 : -1;
00299 }

void ast_rtp_engine_unregister_srtp ( void   ) 

Definition at line 1549 of file rtp_engine.c.

References NULL.

Referenced by res_srtp_shutdown().

01550 {
01551    res_srtp = NULL;
01552    res_srtp_policy = NULL;
01553 }

int ast_rtp_glue_register2 ( struct ast_rtp_glue glue,
struct ast_module module 
)

Register RTP glue.

Parameters:
glue The glue to register
module Module that the RTP glue is part of
Return values:
0 success
-1 failure
Example usage:

 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.

Note:
It is recommended that you use the ast_rtp_glue_register macro so that the module is associated with the RTP glue and use counting is performed.
Since:
1.8

Definition at line 301 of file rtp_engine.c.

References ast_log, AST_RWLIST_INSERT_TAIL, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_strlen_zero, ast_verb, LOG_WARNING, ast_rtp_glue::mod, NULL, and ast_rtp_glue::type.

00302 {
00303    struct ast_rtp_glue *current_glue = NULL;
00304 
00305    if (ast_strlen_zero(glue->type)) {
00306       return -1;
00307    }
00308 
00309    glue->mod = module;
00310 
00311    AST_RWLIST_WRLOCK(&glues);
00312 
00313    AST_RWLIST_TRAVERSE(&glues, current_glue, entry) {
00314       if (!strcasecmp(current_glue->type, glue->type)) {
00315          ast_log(LOG_WARNING, "RTP glue with the name '%s' has already been registered.\n", glue->type);
00316          AST_RWLIST_UNLOCK(&glues);
00317          return -1;
00318       }
00319    }
00320 
00321    AST_RWLIST_INSERT_TAIL(&glues, glue, entry);
00322 
00323    AST_RWLIST_UNLOCK(&glues);
00324 
00325    ast_verb(2, "Registered RTP glue '%s'\n", glue->type);
00326 
00327    return 0;
00328 }

int ast_rtp_glue_unregister ( struct ast_rtp_glue glue  ) 

Unregister RTP glue.

Parameters:
glue The glue to unregister
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 330 of file rtp_engine.c.

References AST_RWLIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, NULL, and ast_rtp_glue::type.

Referenced by load_module(), and unload_module().

00331 {
00332    struct ast_rtp_glue *current_glue = NULL;
00333 
00334    AST_RWLIST_WRLOCK(&glues);
00335 
00336    if ((current_glue = AST_RWLIST_REMOVE(&glues, glue, entry))) {
00337       ast_verb(2, "Unregistered RTP glue '%s'\n", glue->type);
00338    }
00339 
00340    AST_RWLIST_UNLOCK(&glues);
00341 
00342    return current_glue ? 0 : -1;
00343 }

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.

Parameters:
instance The RTP instance
Return values:
0 success
-1 failure
Example usage:

This tells the underlying RTP engine of instance that packets will now flow.

Since:
1.8

Definition at line 1480 of file rtp_engine.c.

References ast_rtp_engine::activate, and ast_rtp_instance::engine.

Referenced by apply_negotiated_sdp_stream(), handle_response_invite(), rtp_call(), and transmit_response_with_sdp().

01481 {
01482    return instance->engine->activate ? instance->engine->activate(instance) : 0;
01483 }

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.

Parameters:
instance the RTP instance
remote_policy the remote endpoint's policy
local_policy our policy for this RTP instance's remote endpoint
Return values:
0 Success
non-zero Failure

Definition at line 1560 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 crypto_activate().

01561 {
01562    int res = 0;
01563 
01564    if (!res_srtp) {
01565       return -1;
01566    }
01567 
01568    if (!instance->srtp) {
01569       res = res_srtp->create(&instance->srtp, instance, remote_policy);
01570    } else {
01571       res = res_srtp->replace(&instance->srtp, instance, remote_policy);
01572    }
01573    if (!res) {
01574       res = res_srtp->add_stream(instance->srtp, local_policy);
01575    }
01576 
01577    return res;
01578 }

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.

Parameters:
instance The RTP instance
to_endpoint Formats being sent/received towards the endpoint
to_asterisk Formats being sent/received towards Asterisk
result capabilities structure to store and return supported formats in.
Example usage:

 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.

Since:
1.8

Definition at line 1468 of file rtp_engine.c.

References ast_format_cap_count(), ast_translate_available_formats(), ast_rtp_engine::available_formats, and ast_rtp_instance::engine.

Referenced by sip_call().

01469 {
01470    if (instance->engine->available_formats) {
01471       instance->engine->available_formats(instance, to_endpoint, to_asterisk, result);
01472       if (ast_format_cap_count(result)) {
01473          return;
01474       }
01475    }
01476 
01477    ast_translate_available_formats(to_endpoint, to_asterisk, result);
01478 }

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.

Parameters:
instance Instance that the new media source is feeding into
Example usage:

This indicates that the source of media that is feeding the instance pointed to by instance has changed and that the marker bit should be set and the SSRC updated.

Since:
1.8

Definition at line 1072 of file rtp_engine.c.

References ast_rtp_engine::change_source, and ast_rtp_instance::engine.

Referenced by jingle_indicate(), mgcp_indicate(), ooh323_indicate(), sip_indicate(), skinny_indicate(), and unistim_indicate().

01073 {
01074    if (instance->engine->change_source) {
01075       instance->engine->change_source(instance);
01076    }
01077 }

int ast_rtp_instance_destroy ( struct ast_rtp_instance instance  ) 

Destroy an RTP instance.

Parameters:
instance The RTP instance to destroy
Return values:
0 success
-1 failure
Example usage:

This destroys the RTP instance pointed to by instance. Once this function returns instance no longer points to valid memory and may not be used again.

Since:
1.8

Definition at line 367 of file rtp_engine.c.

References ao2_ref.

Referenced by __sip_destroy(), destroy_endpoint(), destroy_rtp(), jingle_session_destructor(), mgcp_hangup(), multicast_rtp_request(), ooh323_destroy(), rtp_hangup(), start_rtp(), stream_destroy(), unalloc_sub(), unicast_rtp_request(), and unistim_hangup_clean().

00368 {
00369    ao2_ref(instance, -1);
00370 
00371    return 0;
00372 }

int ast_rtp_instance_dtmf_begin ( struct ast_rtp_instance instance,
char  digit 
)

Begin sending a DTMF digit.

Parameters:
instance The RTP instance to send the DTMF on
digit What DTMF digit to send
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 1041 of file rtp_engine.c.

References ast_rtp_engine::dtmf_begin, and ast_rtp_instance::engine.

Referenced by chan_pjsip_digit_begin(), jingle_digit_begin(), mgcp_senddigit_begin(), ooh323_digit_begin(), and sip_senddigit_begin().

01042 {
01043    return instance->engine->dtmf_begin ? instance->engine->dtmf_begin(instance, digit) : -1;
01044 }

int ast_rtp_instance_dtmf_end ( struct ast_rtp_instance instance,
char  digit 
)

Stop sending a DTMF digit.

Parameters:
instance The RTP instance to stop the DTMF on
digit What DTMF digit to stop
Return values:
0 success
-1 failure
Example usage:

 ast_rtp_instance_dtmf_end(instance, '1');

This stops sending the DTMF '1' on the RTP instance pointed to by instance.

Since:
1.8

Definition at line 1046 of file rtp_engine.c.

References ast_rtp_engine::dtmf_end, and ast_rtp_instance::engine.

Referenced by mgcp_senddigit_end(), and ooh323_digit_end().

01047 {
01048    return instance->engine->dtmf_end ? instance->engine->dtmf_end(instance, digit) : -1;
01049 }

int ast_rtp_instance_dtmf_end_with_duration ( struct ast_rtp_instance instance,
char  digit,
unsigned int  duration 
)

Definition at line 1050 of file rtp_engine.c.

References ast_rtp_engine::dtmf_end_with_duration, and ast_rtp_instance::engine.

Referenced by chan_pjsip_digit_end(), jingle_digit_end(), and sip_senddigit_end().

01051 {
01052    return instance->engine->dtmf_end_with_duration ? instance->engine->dtmf_end_with_duration(instance, digit, duration) : -1;
01053 }

enum ast_rtp_dtmf_mode ast_rtp_instance_dtmf_mode_get ( struct ast_rtp_instance instance  ) 

Get the DTMF mode of an RTP instance.

Parameters:
instance The RTP instance to get the DTMF mode of
Return values:
DTMF mode
Example usage:

This gets the DTMF mode set on the RTP instance pointed to by 'instance'.

Since:
1.8

Definition at line 1060 of file rtp_engine.c.

References ast_rtp_engine::dtmf_mode_get, and ast_rtp_instance::engine.

Referenced by chan_pjsip_digit_begin(), chan_pjsip_digit_end(), native_rtp_bridge_compatible(), and set_caps().

01061 {
01062    return instance->engine->dtmf_mode_get ? instance->engine->dtmf_mode_get(instance) : 0;
01063 }

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.

Parameters:
instance the RTP instance to set DTMF mode on
dtmf_mode The DTMF mode that is in use
Return values:
0 success
-1 failure
Example usage:

This sets the RTP instance to use RFC2833 for DTMF transmission and receiving.

Since:
1.8

Definition at line 1055 of file rtp_engine.c.

References ast_rtp_engine::dtmf_mode_set, and ast_rtp_instance::engine.

Referenced by create_rtp(), enable_dsp_detect(), get_codecs(), and sip_new().

01056 {
01057    return (!instance->engine->dtmf_mode_set || instance->engine->dtmf_mode_set(instance, dtmf_mode)) ? -1 : 0;
01058 }

int ast_rtp_instance_early_bridge ( struct ast_channel c0,
struct ast_channel c1 
)

Early bridge two channels that use RTP instances.

Parameters:
c0 First channel part of the bridge
c1 Second channel part of the bridge
Return values:
0 success
-1 failure
Note:
This should only be used by channel drivers in their technology declaration.
Since:
1.8

Definition at line 1220 of file rtp_engine.c.

References ao2_cleanup, ast_channel_lock_both, ast_channel_name(), ast_channel_tech(), ast_channel_unlock, ast_debug, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_iscompatible(), ast_log, AST_RTP_GLUE_RESULT_FORBID, AST_RTP_GLUE_RESULT_REMOTE, ast_rtp_instance_get_glue(), ast_rtp_glue::get_codec, ast_rtp_glue::get_rtp_info, ast_rtp_glue::get_vrtp_info, LOG_WARNING, NULL, type, unref_instance_cond(), and ast_rtp_glue::update_peer.

01221 {
01222    struct ast_rtp_instance *instance0 = NULL, *instance1 = NULL,
01223          *vinstance0 = NULL, *vinstance1 = NULL,
01224          *tinstance0 = NULL, *tinstance1 = NULL;
01225    struct ast_rtp_glue *glue0, *glue1;
01226    enum ast_rtp_glue_result audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID, video_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
01227    enum ast_rtp_glue_result audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID, video_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
01228    struct ast_format_cap *cap0 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
01229    struct ast_format_cap *cap1 = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
01230 
01231    /* If there is no second channel just immediately bail out, we are of no use in that scenario */
01232    if (!c1 || !cap1 || !cap0) {
01233       ao2_cleanup(cap0);
01234       ao2_cleanup(cap1);
01235       return -1;
01236    }
01237 
01238    /* Lock both channels so we can look for the glue that binds them together */
01239    ast_channel_lock_both(c0, c1);
01240 
01241    /* Grab glue that binds each channel to something using the RTP engine */
01242    if (!(glue0 = ast_rtp_instance_get_glue(ast_channel_tech(c0)->type)) || !(glue1 = ast_rtp_instance_get_glue(ast_channel_tech(c1)->type))) {
01243       ast_log(LOG_WARNING, "Can't find native functions for channel '%s'\n", glue0 ? ast_channel_name(c1) : ast_channel_name(c0));
01244       goto done;
01245    }
01246 
01247    audio_glue0_res = glue0->get_rtp_info(c0, &instance0);
01248    video_glue0_res = glue0->get_vrtp_info ? glue0->get_vrtp_info(c0, &vinstance0) : AST_RTP_GLUE_RESULT_FORBID;
01249 
01250    audio_glue1_res = glue1->get_rtp_info(c1, &instance1);
01251    video_glue1_res = glue1->get_vrtp_info ? glue1->get_vrtp_info(c1, &vinstance1) : AST_RTP_GLUE_RESULT_FORBID;
01252 
01253    /* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */
01254    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)) {
01255       audio_glue0_res = AST_RTP_GLUE_RESULT_FORBID;
01256    }
01257    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)) {
01258       audio_glue1_res = AST_RTP_GLUE_RESULT_FORBID;
01259    }
01260    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) {
01261       glue0->get_codec(c0, cap0);
01262    }
01263    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) {
01264       glue1->get_codec(c1, cap1);
01265    }
01266 
01267    /* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
01268    if (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE) {
01269       goto done;
01270    }
01271 
01272    /* Make sure we have matching codecs */
01273    if (!ast_format_cap_iscompatible(cap0, cap1)) {
01274       goto done;
01275    }
01276 
01277    /* Bridge media early */
01278    if (glue0->update_peer(c0, instance1, vinstance1, tinstance1, cap1, 0)) {
01279       ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
01280    }
01281 
01282 done:
01283    ast_channel_unlock(c0);
01284    ast_channel_unlock(c1);
01285 
01286    ao2_cleanup(cap0);
01287    ao2_cleanup(cap1);
01288 
01289    unref_instance_cond(&instance0);
01290    unref_instance_cond(&instance1);
01291    unref_instance_cond(&vinstance0);
01292    unref_instance_cond(&vinstance1);
01293    unref_instance_cond(&tinstance0);
01294    unref_instance_cond(&tinstance1);
01295 
01296    ast_debug(1, "Setting early bridge SDP of '%s' with that of '%s'\n", ast_channel_name(c0), c1 ? ast_channel_name(c1) : "<unspecified>");
01297 
01298    return 0;
01299 }

void ast_rtp_instance_early_bridge_make_compatible ( struct ast_channel c_dst,
struct ast_channel c_src 
)

Make two channels compatible for early bridging.

Parameters:
c_dst Destination channel to copy to
c_src Source channel to copy from
Since:
1.8

Definition at line 1134 of file rtp_engine.c.

References ao2_cleanup, ast_channel_lock_both, ast_channel_name(), ast_channel_tech(), ast_channel_unlock, ast_debug, ast_format_cap_alloc, AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_iscompatible(), ast_log, ast_rtp_codecs_payloads_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, NULL, type, unref_instance_cond(), and ast_rtp_glue::update_peer.

Referenced by dial_exec_full(), and do_forward().

01135 {
01136    struct ast_rtp_instance *instance_dst = NULL, *instance_src = NULL,
01137       *vinstance_dst = NULL, *vinstance_src = NULL,
01138       *tinstance_dst = NULL, *tinstance_src = NULL;
01139    struct ast_rtp_glue *glue_dst, *glue_src;
01140    enum ast_rtp_glue_result audio_glue_dst_res = AST_RTP_GLUE_RESULT_FORBID, video_glue_dst_res = AST_RTP_GLUE_RESULT_FORBID;
01141    enum ast_rtp_glue_result audio_glue_src_res = AST_RTP_GLUE_RESULT_FORBID, video_glue_src_res = AST_RTP_GLUE_RESULT_FORBID;
01142    struct ast_format_cap *cap_dst = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
01143    struct ast_format_cap *cap_src = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
01144 
01145    /* Lock both channels so we can look for the glue that binds them together */
01146    ast_channel_lock_both(c_dst, c_src);
01147 
01148    if (!cap_src || !cap_dst) {
01149       goto done;
01150    }
01151 
01152    /* Grab glue that binds each channel to something using the RTP engine */
01153    if (!(glue_dst = ast_rtp_instance_get_glue(ast_channel_tech(c_dst)->type)) || !(glue_src = ast_rtp_instance_get_glue(ast_channel_tech(c_src)->type))) {
01154       ast_debug(1, "Can't find native functions for channel '%s'\n", glue_dst ? ast_channel_name(c_src) : ast_channel_name(c_dst));
01155       goto done;
01156    }
01157 
01158    audio_glue_dst_res = glue_dst->get_rtp_info(c_dst, &instance_dst);
01159    video_glue_dst_res = glue_dst->get_vrtp_info ? glue_dst->get_vrtp_info(c_dst, &vinstance_dst) : AST_RTP_GLUE_RESULT_FORBID;
01160 
01161    audio_glue_src_res = glue_src->get_rtp_info(c_src, &instance_src);
01162    video_glue_src_res = glue_src->get_vrtp_info ? glue_src->get_vrtp_info(c_src, &vinstance_src) : AST_RTP_GLUE_RESULT_FORBID;
01163 
01164    /* If we are carrying video, and both sides are not going to remotely bridge... fail the native bridge */
01165    if (video_glue_dst_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue_dst_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue_dst_res != AST_RTP_GLUE_RESULT_REMOTE)) {
01166       audio_glue_dst_res = AST_RTP_GLUE_RESULT_FORBID;
01167    }
01168    if (video_glue_src_res != AST_RTP_GLUE_RESULT_FORBID && (audio_glue_src_res != AST_RTP_GLUE_RESULT_REMOTE || video_glue_src_res != AST_RTP_GLUE_RESULT_REMOTE)) {
01169       audio_glue_src_res = AST_RTP_GLUE_RESULT_FORBID;
01170    }
01171    if (audio_glue_dst_res == AST_RTP_GLUE_RESULT_REMOTE && (video_glue_dst_res == AST_RTP_GLUE_RESULT_FORBID || video_glue_dst_res == AST_RTP_GLUE_RESULT_REMOTE) && glue_dst->get_codec) {
01172       glue_dst->get_codec(c_dst, cap_dst);
01173    }
01174    if (audio_glue_src_res == AST_RTP_GLUE_RESULT_REMOTE && (video_glue_src_res == AST_RTP_GLUE_RESULT_FORBID || video_glue_src_res == AST_RTP_GLUE_RESULT_REMOTE) && glue_src->get_codec) {
01175       glue_src->get_codec(c_src, cap_src);
01176    }
01177 
01178    /* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
01179    if (audio_glue_dst_res != AST_RTP_GLUE_RESULT_REMOTE || audio_glue_src_res != AST_RTP_GLUE_RESULT_REMOTE) {
01180       goto done;
01181    }
01182 
01183    /* Make sure we have matching codecs */
01184    if (!ast_format_cap_iscompatible(cap_dst, cap_src)) {
01185       goto done;
01186    }
01187 
01188    ast_rtp_codecs_payloads_copy(&instance_src->codecs, &instance_dst->codecs, instance_dst);
01189 
01190    if (vinstance_dst && vinstance_src) {
01191       ast_rtp_codecs_payloads_copy(&vinstance_src->codecs, &vinstance_dst->codecs, vinstance_dst);
01192    }
01193    if (tinstance_dst && tinstance_src) {
01194       ast_rtp_codecs_payloads_copy(&tinstance_src->codecs, &tinstance_dst->codecs, tinstance_dst);
01195    }
01196 
01197    if (glue_dst->update_peer(c_dst, instance_src, vinstance_src, tinstance_src, cap_src, 0)) {
01198       ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n",
01199          ast_channel_name(c_dst), ast_channel_name(c_src));
01200    } else {
01201       ast_debug(1, "Seeded SDP of '%s' with that of '%s'\n",
01202          ast_channel_name(c_dst), ast_channel_name(c_src));
01203    }
01204 
01205 done:
01206    ast_channel_unlock(c_dst);
01207    ast_channel_unlock(c_src);
01208 
01209    ao2_cleanup(cap_dst);
01210    ao2_cleanup(cap_src);
01211 
01212    unref_instance_cond(&instance_dst);
01213    unref_instance_cond(&instance_src);
01214    unref_instance_cond(&vinstance_dst);
01215    unref_instance_cond(&vinstance_src);
01216    unref_instance_cond(&tinstance_dst);
01217    unref_instance_cond(&tinstance_src);
01218 }

int ast_rtp_instance_fd ( struct ast_rtp_instance instance,
int  rtcp 
)

Get the file descriptor for an RTP session (or RTCP).

Parameters:
instance Instance to get the file descriptor for
rtcp Whether to retrieve the file descriptor for RTCP or not
Return values:
fd success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 1091 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::fd.

Referenced by apply_negotiated_sdp_stream(), check_for_rtp_changes(), configure_local_rtp(), jingle_enable_video(), jingle_new(), mgcp_new(), process_sdp(), sip_new(), sip_set_rtp_peer(), skinny_new(), start_rtp(), unicast_rtp_request(), and unistim_new().

01092 {
01093    return instance->engine->fd ? instance->engine->fd(instance, rtcp) : -1;
01094 }

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.

Parameters:
instance The RTP instance
Return values:
pointer to the glue
Example:

This gets the RTP glue currently in use on the RTP instance pointed to by 'instance'.

Since:
1.8

Definition at line 1529 of file rtp_engine.c.

References ast_rtp_instance::glue.

01530 {
01531    return instance->glue;
01532 }

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.

Parameters:
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
Return values:
0 address was not changed
1 address was changed Example usage:

This retrieves the current local address set on the instance pointed to by instance and puts the value into the address structure.

Since:
1.8

Definition at line 494 of file rtp_engine.c.

References ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::local_address.

00496 {
00497    if (ast_sockaddr_cmp(address, &instance->local_address) != 0) {
00498       ast_sockaddr_copy(address, &instance->local_address);
00499       return 1;
00500    }
00501 
00502    return 0;
00503 }

int ast_rtp_instance_get_and_cmp_requested_target_address ( struct ast_rtp_instance instance,
struct ast_sockaddr address 
)

Get the requested target address of the remote endpoint and compare it to the given address.

Parameters:
instance The instance that we want to get the remote address for
address An initialized address that may be overwritten addresses differ
Return values:
0 address was not changed
1 address was changed

Definition at line 511 of file rtp_engine.c.

References ast_sockaddr_cmp(), ast_sockaddr_copy(), and ast_rtp_instance::requested_target_address.

00513 {
00514    if (ast_sockaddr_cmp(address, &instance->requested_target_address) != 0) {
00515       ast_sockaddr_copy(address, &instance->requested_target_address);
00516       return 1;
00517    }
00518 
00519    return 0;
00520 }

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.

Parameters:
instance The RTP instance that we want
Return values:
non-NULL success
NULL failure
Example usage:

This gets the RTP instance that instance0 is bridged to.

Since:
1.8

Definition at line 1124 of file rtp_engine.c.

References ast_rtp_instance::bridged.

Referenced by ast_rtp_read(), bridge_p2p_rtp_write(), and dialog_needdestroy().

01125 {
01126    return instance->bridged;
01127 }

const char* ast_rtp_instance_get_channel_id ( struct ast_rtp_instance instance  ) 

Get the unique ID of the channel that owns this RTP instance.

Note that this should remain valid for the lifetime of the RTP instance.

Parameters:
instance The RTP instance
Return values:
The unique ID of the channel
Empty string if no channel owns this RTP instance
Since:
12

Definition at line 435 of file rtp_engine.c.

References ast_rtp_instance::channel_uniqueid.

Referenced by ast_rtp_get_stat().

00436 {
00437    return instance->channel_uniqueid;
00438 }

struct ast_rtp_codecs* ast_rtp_instance_get_codecs ( struct ast_rtp_instance instance  )  [read]

void* ast_rtp_instance_get_data ( struct ast_rtp_instance instance  ) 

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.

Parameters:
instance the RTP instance
Return values:
DTLS support if present
NULL if no DTLS support available

Definition at line 1599 of file rtp_engine.c.

References ast_rtp_engine::dtls, and ast_rtp_instance::engine.

Referenced by add_crypto_to_stream(), add_dtls_to_sdp(), apply_dtls_attrib(), ast_sdp_get_rtp_profile(), dialog_initialize_dtls_srtp(), process_crypto(), process_sdp(), process_sdp_a_dtls(), and setup_dtls_srtp().

01600 {
01601    return instance->engine->dtls;
01602 }

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.

Parameters:
instance The RTP instance
Return values:
pointer to the engine
Example usage:

 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'.

Since:
1.8

Definition at line 1524 of file rtp_engine.c.

References ast_rtp_instance::engine.

Referenced by native_rtp_bridge_compatible(), native_rtp_bridge_start(), and native_rtp_bridge_stop().

01525 {
01526    return instance->engine;
01527 }

void* ast_rtp_instance_get_extended_prop ( struct ast_rtp_instance instance,
int  property 
)

Get the value of an RTP instance extended property.

Parameters:
instance The RTP instance to get the extended property on
property The extended property to get
Since:
1.8

Definition at line 541 of file rtp_engine.c.

References ast_rtp_instance::engine, ast_rtp_engine::extended_prop_get, and NULL.

00542 {
00543    if (instance->engine->extended_prop_get) {
00544       return instance->engine->extended_prop_get(instance, property);
00545    }
00546 
00547    return NULL;
00548 }

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.

Parameters:
type Name of the glue we want
Return values:
non-NULL success
NULL failure
Example usage:

 struct ast_rtp_glue *glue = ast_rtp_instance_get_glue("Example");

This retrieves the RTP glue that has the name 'Example'.

Since:
1.8

Definition at line 1096 of file rtp_engine.c.

References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, NULL, and ast_rtp_glue::type.

Referenced by ast_rtp_instance_early_bridge(), ast_rtp_instance_early_bridge_make_compatible(), ast_rtp_instance_make_compatible(), and native_rtp_bridge_get().

01097 {
01098    struct ast_rtp_glue *glue = NULL;
01099 
01100    AST_RWLIST_RDLOCK(&glues);
01101 
01102    AST_RWLIST_TRAVERSE(&glues, glue, entry) {
01103       if (!strcasecmp(glue->type, type)) {
01104          break;
01105       }
01106    }
01107 
01108    AST_RWLIST_UNLOCK(&glues);
01109 
01110    return glue;
01111 }

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.

Parameters:
instance The RTP instance
Return values:
timeout value
Example usage:

This gets the RTP hold timeout value for the RTP instance pointed to by 'instance'.

Since:
1.8

Definition at line 1514 of file rtp_engine.c.

References ast_rtp_instance::holdtimeout.

Referenced by check_rtp_timeout().

01515 {
01516    return instance->holdtimeout;
01517 }

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.

Parameters:
instance the RTP instance
Return values:
ICE support if present
NULL if no ICE support available

Definition at line 1594 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::ice.

Referenced by add_ice_to_sdp(), add_ice_to_stream(), create_rtp(), dialog_initialize_rtp(), jingle_add_google_candidates_to_transport(), jingle_add_ice_udp_candidates_to_transport(), jingle_enable_video(), jingle_interpret_google_transport(), jingle_interpret_ice_udp_transport(), jingle_new(), jingle_outgoing_hook(), jingle_request(), process_ice_attributes(), process_sdp_a_ice(), and start_ice().

01595 {
01596    return instance->engine->ice;
01597 }

void ast_rtp_instance_get_incoming_source_address ( struct ast_rtp_instance instance,
struct ast_sockaddr address 
)

Get the incoming source address of the remote endpoint.

This returns the remote address the engine is sending RTP to. Usually this will be the same as the requested target address, however in the case where the engine "learns" the address (for instance, symmetric RTP enabled) this will then contain the learned address.

Parameters:
instance The instance that we want to get the incoming source address for
address A structure to put the address into

Definition at line 522 of file rtp_engine.c.

References ast_sockaddr_copy(), and ast_rtp_instance::incoming_source_address.

00524 {
00525    ast_sockaddr_copy(address, &instance->incoming_source_address);
00526 }

int ast_rtp_instance_get_keepalive ( struct ast_rtp_instance instance  ) 

Get the RTP keepalive interval.

Parameters:
instance The RTP instance
Return values:
period Keepalive interval value
Example usage:

 int interval = ast_rtp_instance_get_keepalive(instance);

This gets the RTP keepalive interval value for the RTP instance pointed to by 'instance'.

Since:
1.8

Definition at line 1519 of file rtp_engine.c.

References ast_rtp_instance::keepalive.

Referenced by check_rtp_timeout().

01520 {
01521    return instance->keepalive;
01522 }

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.

Parameters:
instance The RTP instance to get the address from
address The variable to store the address in
Example usage:

This gets the local address that we are expecting RTP on and stores it in the 'address' structure.

Since:
1.8

Definition at line 505 of file rtp_engine.c.

References ast_sockaddr_copy(), and ast_rtp_instance::local_address.

Referenced by add_sdp(), ast_rtcp_read(), ast_rtcp_write_report(), ast_rtp_prop_set(), channel_read_rtp(), configure_local_rtp(), create_outgoing_sdp_stream(), get_our_media_address(), handle_open_receive_channel_ack_message(), multicast_send_control_packet(), send_start_rtp(), sip_acf_channel_read(), sip_allow_anyrtp_remote(), skinny_set_rtp_peer(), unicast_rtp_request(), and unistim_set_rtp_peer().

00507 {
00508    ast_sockaddr_copy(address, &instance->local_address);
00509 }

int ast_rtp_instance_get_prop ( struct ast_rtp_instance instance,
enum ast_rtp_property  property 
)

Get the value of an RTP instance property.

Parameters:
instance The RTP instance to get the property from
property The property to get
Return values:
Current value of the property
Example usage:

This returns the current value of the NAT property on the instance pointed to by instance.

Since:
1.8

Definition at line 559 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().

00560 {
00561    return instance->properties[property];
00562 }

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.

Parameters:
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
Return values:
non-NULL success
NULL failure
Example usage:

This retrieves general quality statistics and places a text representation into the buf pointed to by buf.

Since:
1.8

Definition at line 1316 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, NULL, ast_rtp_instance_stats::remote_maxjitter, ast_rtp_instance_stats::remote_maxrxploss, ast_rtp_instance_stats::remote_minjitter, ast_rtp_instance_stats::remote_minrxploss, ast_rtp_instance_stats::remote_normdevjitter, ast_rtp_instance_stats::remote_normdevrxploss, ast_rtp_instance_stats::remote_ssrc, ast_rtp_instance_stats::remote_stdevjitter, ast_rtp_instance_stats::remote_stdevrxploss, ast_rtp_instance_stats::rtt, ast_rtp_instance_stats::rxcount, ast_rtp_instance_stats::rxjitter, ast_rtp_instance_stats::rxploss, ast_rtp_instance_stats::stdevrtt, ast_rtp_instance_stats::txcount, ast_rtp_instance_stats::txjitter, and ast_rtp_instance_stats::txploss.

Referenced by ast_rtp_instance_set_stats_vars(), channel_read_rtcp(), handle_request_bye(), sip_acf_channel_read(), and sip_hangup().

01317 {
01318    struct ast_rtp_instance_stats stats = { 0, };
01319    enum ast_rtp_instance_stat stat;
01320 
01321    /* Determine what statistics we will need to retrieve based on field passed in */
01322    if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY) {
01323       stat = AST_RTP_INSTANCE_STAT_ALL;
01324    } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER) {
01325       stat = AST_RTP_INSTANCE_STAT_COMBINED_JITTER;
01326    } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS) {
01327       stat = AST_RTP_INSTANCE_STAT_COMBINED_LOSS;
01328    } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT) {
01329       stat = AST_RTP_INSTANCE_STAT_COMBINED_RTT;
01330    } else {
01331       return NULL;
01332    }
01333 
01334    /* Attempt to actually retrieve the statistics we need to generate the quality string */
01335    if (ast_rtp_instance_get_stats(instance, &stats, stat)) {
01336       return NULL;
01337    }
01338 
01339    /* Now actually fill the buffer with the good information */
01340    if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY) {
01341       snprintf(buf, size, "ssrc=%u;themssrc=%u;lp=%u;rxjitter=%f;rxcount=%u;txjitter=%f;txcount=%u;rlp=%u;rtt=%f",
01342           stats.local_ssrc, stats.remote_ssrc, stats.rxploss, stats.rxjitter, stats.rxcount, stats.txjitter, stats.txcount, stats.txploss, stats.rtt);
01343    } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER) {
01344       snprintf(buf, size, "minrxjitter=%f;maxrxjitter=%f;avgrxjitter=%f;stdevrxjitter=%f;reported_minjitter=%f;reported_maxjitter=%f;reported_avgjitter=%f;reported_stdevjitter=%f;",
01345           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));
01346    } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS) {
01347       snprintf(buf, size, "minrxlost=%f;maxrxlost=%f;avgrxlost=%f;stdevrxlost=%f;reported_minlost=%f;reported_maxlost=%f;reported_avglost=%f;reported_stdevlost=%f;",
01348           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));
01349    } else if (field == AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT) {
01350       snprintf(buf, size, "minrtt=%f;maxrtt=%f;avgrtt=%f;stdevrtt=%f;", stats.minrtt, stats.maxrtt, stats.normdevrtt, stats.stdevrtt);
01351    }
01352 
01353    return buf;
01354 }

void ast_rtp_instance_get_requested_target_address ( struct ast_rtp_instance instance,
struct ast_sockaddr address 
)

Get the requested target address of the remote endpoint.

This returns the explicitly set address of a remote endpoint. Meaning this won't change unless specifically told to change. In most cases this should be the same as the incoming source address, except in cases where the engine "learns" the address in which case this and the incoming source address might differ.

Parameters:
instance The instance that we want to get the requested target address for
address A structure to put the address into

Definition at line 528 of file rtp_engine.c.

References ast_sockaddr_copy(), and ast_rtp_instance::requested_target_address.

Referenced by handle_response_invite(), and sip_allow_anyrtp_remote().

00530 {
00531    ast_sockaddr_copy(address, &instance->requested_target_address);
00532 }

struct ast_srtp* ast_rtp_instance_get_srtp ( struct ast_rtp_instance instance  )  [read]

Obtain the SRTP instance associated with an RTP instance.

Parameters:
instance the RTP instance
Return values:
the SRTP instance on success
NULL if no SRTP instance exists

Definition at line 1580 of file rtp_engine.c.

References ast_rtp_instance::srtp.

Referenced by __rtp_recvfrom(), __rtp_sendto(), and ast_rtp_change_source().

01581 {
01582    return instance->srtp;
01583 }

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.

Parameters:
instance Instance to get statistics on
stats Structure to put results into
stat What statistic(s) to retrieve
Return values:
0 success
-1 failure
Example usage:

This retrieves all statistics the underlying RTP engine supports and puts the values into the stats structure.

Since:
1.8

Definition at line 1311 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(), channel_read_rtcp(), crypto_activate(), show_chanstats_cb(), and sip_acf_channel_read().

01312 {
01313    return instance->engine->get_stat ? instance->engine->get_stat(instance, stats, stat) : -1;
01314 }

int ast_rtp_instance_get_timeout ( struct ast_rtp_instance instance  ) 

Get the RTP timeout value.

Parameters:
instance The RTP instance
Return values:
timeout value
Example usage:

This gets the RTP timeout value for the RTP instance pointed to by 'instance'.

Since:
1.8

Definition at line 1509 of file rtp_engine.c.

References ast_rtp_instance::timeout.

Referenced by check_rtp_timeout().

01510 {
01511    return instance->timeout;
01512 }

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.

Parameters:
chan Our own Asterisk channel
instance The first RTP instance
peer The peer Asterisk channel
Return values:
0 success
-1 failure
Example usage:

This makes the RTP instance for 'peer' compatible with 'instance' and vice versa.

Since:
1.8

Definition at line 1428 of file rtp_engine.c.

References ao2_ref, ast_channel_lock, ast_channel_tech(), ast_channel_unlock, ast_log, ast_rtp_instance_get_glue(), ast_rtp_instance::engine, ast_rtp_glue::get_rtp_info, LOG_ERROR, ast_rtp_engine::make_compatible, NULL, ast_rtp_glue::type, and type.

01429 {
01430    struct ast_rtp_glue *glue;
01431    struct ast_rtp_instance *peer_instance = NULL;
01432    int res = -1;
01433 
01434    if (!instance->engine->make_compatible) {
01435       return -1;
01436    }
01437 
01438    ast_channel_lock(peer);
01439 
01440    if (!(glue = ast_rtp_instance_get_glue(ast_channel_tech(peer)->type))) {
01441       ast_channel_unlock(peer);
01442       return -1;
01443    }
01444 
01445    glue->get_rtp_info(peer, &peer_instance);
01446    if (!peer_instance) {
01447       ast_log(LOG_ERROR, "Unable to get_rtp_info for peer type %s\n", glue->type);
01448       ast_channel_unlock(peer);
01449       return -1;
01450    }
01451    if (peer_instance->engine != instance->engine) {
01452       ast_log(LOG_ERROR, "Peer engine mismatch for type %s\n", glue->type);
01453       ast_channel_unlock(peer);
01454       ao2_ref(peer_instance, -1);
01455       return -1;
01456    }
01457 
01458    res = instance->engine->make_compatible(chan, instance, peer, peer_instance);
01459 
01460    ast_channel_unlock(peer);
01461 
01462    ao2_ref(peer_instance, -1);
01463    peer_instance = NULL;
01464 
01465    return res;
01466 }

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.

Parameters:
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
Return values:
non-NULL success
NULL failure
Example usage:

 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.

Note:
The RTP engine does not have to use the address provided when creating an RTP instance. It may choose to use another depending on it's own configuration.
Since:
1.8

Definition at line 374 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, instance_destructor(), ast_rtp_instance::local_address, LOG_ERROR, ast_rtp_engine::mod, ast_rtp_engine::name, ast_rtp_engine::new, and NULL.

Referenced by configure_local_rtp(), create_rtp(), dialog_initialize_rtp(), jingle_alloc(), jingle_enable_video(), multicast_rtp_request(), start_rtp(), and unicast_rtp_request().

00377 {
00378    struct ast_sockaddr address = {{0,}};
00379    struct ast_rtp_instance *instance = NULL;
00380    struct ast_rtp_engine *engine = NULL;
00381 
00382    AST_RWLIST_RDLOCK(&engines);
00383 
00384    /* If an engine name was specified try to use it or otherwise use the first one registered */
00385    if (!ast_strlen_zero(engine_name)) {
00386       AST_RWLIST_TRAVERSE(&engines, engine, entry) {
00387          if (!strcmp(engine->name, engine_name)) {
00388             break;
00389          }
00390       }
00391    } else {
00392       engine = AST_RWLIST_FIRST(&engines);
00393    }
00394 
00395    /* If no engine was actually found bail out now */
00396    if (!engine) {
00397       ast_log(LOG_ERROR, "No RTP engine was found. Do you have one loaded?\n");
00398       AST_RWLIST_UNLOCK(&engines);
00399       return NULL;
00400    }
00401 
00402    /* Bump up the reference count before we return so the module can not be unloaded */
00403    ast_module_ref(engine->mod);
00404 
00405    AST_RWLIST_UNLOCK(&engines);
00406 
00407    /* Allocate a new RTP instance */
00408    if (!(instance = ao2_alloc(sizeof(*instance), instance_destructor))) {
00409       ast_module_unref(engine->mod);
00410       return NULL;
00411    }
00412    instance->engine = engine;
00413    ast_sockaddr_copy(&instance->local_address, sa);
00414    ast_sockaddr_copy(&address, sa);
00415 
00416    if (ast_rtp_codecs_payloads_initialize(&instance->codecs)) {
00417       ao2_ref(instance, -1);
00418       return NULL;
00419    }
00420 
00421    ast_debug(1, "Using engine '%s' for RTP instance '%p'\n", engine->name, instance);
00422 
00423    /* And pass it off to the engine to setup */
00424    if (instance->engine->new(instance, sched, &address, data)) {
00425       ast_debug(1, "Engine '%s' failed to setup RTP instance '%p'\n", engine->name, instance);
00426       ao2_ref(instance, -1);
00427       return NULL;
00428    }
00429 
00430    ast_debug(1, "RTP instance '%p' is setup and ready to go\n", instance);
00431 
00432    return instance;
00433 }

struct ast_frame* ast_rtp_instance_read ( struct ast_rtp_instance instance,
int  rtcp 
) [read]

Receive a frame over RTP.

Parameters:
instance The RTP instance to receive frame on
rtcp Whether to read in RTCP or not
Return values:
non-NULL success
NULL failure
Example usage:

 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.

Since:
1.8

Definition at line 460 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::read.

Referenced by chan_pjsip_read(), jingle_read(), mgcp_rtp_read(), ooh323_rtp_read(), rtp_read(), sip_rtp_read(), skinny_rtp_read(), and unistim_rtp_read().

00461 {
00462    return instance->engine->read(instance, rtcp);
00463 }

int ast_rtp_instance_sendcng ( struct ast_rtp_instance instance,
int  level 
)

Send a comfort noise packet to the RTP instance.

Parameters:
instance The RTP instance
level Magnitude of the noise level
Return values:
0 Success
non-zero Failure

Definition at line 1585 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::sendcng.

Referenced by check_rtp_timeout(), and do_monitor().

01586 {
01587    if (instance->engine->sendcng) {
01588       return instance->engine->sendcng(instance, level);
01589    }
01590 
01591    return -1;
01592 }

void ast_rtp_instance_set_bridged ( struct ast_rtp_instance instance,
struct ast_rtp_instance bridged 
)

Set the other RTP instance that an instance is bridged to.

Parameters:
instance The RTP instance that we want to set the bridged value on
bridged The RTP instance they are bridged to
Since:
12

Definition at line 1129 of file rtp_engine.c.

References ast_rtp_instance::bridged.

Referenced by native_rtp_bridge_start(), and native_rtp_bridge_stop().

01130 {
01131    instance->bridged = bridged;
01132 }

void ast_rtp_instance_set_channel_id ( struct ast_rtp_instance instance,
const char *  uniqueid 
)

Set the channel that owns this RTP instance.

Parameters:
instance The RTP instance
uniqueid The uniqueid of the channel
Since:
12

Definition at line 440 of file rtp_engine.c.

References ast_copy_string(), and ast_rtp_instance::channel_uniqueid.

Referenced by jingle_enable_video(), jingle_set_owner(), mgcp_set_owner(), multicast_rtp_request(), set_channel_on_rtp_instance(), sip_set_owner(), skinny_set_owner(), start_rtp(), unicast_rtp_request(), and unistim_set_owner().

00441 {
00442    ast_copy_string(instance->channel_uniqueid, uniqueid, sizeof(instance->channel_uniqueid));
00443 }

void ast_rtp_instance_set_data ( struct ast_rtp_instance instance,
void *  data 
)

Set the data portion of an RTP instance.

Parameters:
instance The RTP instance to manipulate
data Pointer to data
Example usage:

 ast_rtp_instance_set_data(instance, blob);

This sets the data pointer on the RTP instance pointed to by 'instance' to blob.

Since:
1.8

Definition at line 445 of file rtp_engine.c.

References ast_rtp_instance::data.

Referenced by ast_rtp_new(), and multicast_rtp_new().

00446 {
00447    instance->data = data;
00448 }

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.

Parameters:
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
Since:
1.8

Definition at line 534 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::extended_prop_set.

00535 {
00536    if (instance->engine->extended_prop_set) {
00537       instance->engine->extended_prop_set(instance, property, value);
00538    }
00539 }

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.

Parameters:
instance The RTP instance
timeout Value to set the timeout to
Example usage:

This sets the RTP hold timeout value on 'instance' to be 5000.

Since:
1.8

Definition at line 1499 of file rtp_engine.c.

References ast_rtp_instance::holdtimeout.

Referenced by check_rtp_timeout(), and dialog_initialize_rtp().

01500 {
01501    instance->holdtimeout = timeout;
01502 }

int ast_rtp_instance_set_incoming_source_address ( struct ast_rtp_instance instance,
const struct ast_sockaddr address 
)

Set the incoming source address of the remote endpoint that we are sending RTP to.

This sets the incoming source address the engine is sending RTP to. Usually this will be the same as the requested target address, however in the case where the engine "learns" the address (for instance, symmetric RTP enabled) this will then contain the learned address.

Parameters:
instance The RTP instance to change the address on
address Address to set it to
Return values:
0 success
-1 failure

Definition at line 472 of file rtp_engine.c.

References ast_sockaddr_copy(), ast_rtp_instance::engine, ast_rtp_instance::incoming_source_address, and ast_rtp_engine::remote_address_set.

Referenced by ast_rtp_instance_set_requested_target_address(), and ast_rtp_read().

00474 {
00475    ast_sockaddr_copy(&instance->incoming_source_address, address);
00476 
00477    /* moo */
00478 
00479    if (instance->engine->remote_address_set) {
00480       instance->engine->remote_address_set(instance, &instance->incoming_source_address);
00481    }
00482 
00483    return 0;
00484 }

void ast_rtp_instance_set_keepalive ( struct ast_rtp_instance instance,
int  timeout 
)

Set the RTP keepalive interval.

Parameters:
instance The RTP instance
timeout Value to set the keepalive interval to
Example usage:

This sets the RTP keepalive interval on 'instance' to be 5000.

Since:
1.8

Definition at line 1504 of file rtp_engine.c.

References ast_rtp_instance::keepalive.

Referenced by dialog_initialize_rtp().

01505 {
01506    instance->keepalive = interval;
01507 }

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.

Parameters:
instance The RTP instance to change the address on
address Address to set it to
Return values:
0 success
-1 failure
Example usage:

This changes the local address that RTP is expected on to the address given in the sin structure.

Since:
1.8

Definition at line 465 of file rtp_engine.c.

References ast_sockaddr_copy(), and ast_rtp_instance::local_address.

Referenced by ast_rtp_new().

00467 {
00468    ast_sockaddr_copy(&instance->local_address, address);
00469    return 0;
00470 }

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.

Parameters:
instance The RTP instance to set the property on
property The property to modify
value The value to set the property to
Example usage:

This enables the AST_RTP_PROPERTY_NAT property on the instance pointed to by instance.

Since:
1.8

Definition at line 550 of file rtp_engine.c.

References ast_rtp_instance::engine, ast_rtp_engine::prop_set, and ast_rtp_instance::properties.

Referenced by check_for_rtp_changes(), configure_local_rtp(), create_addr_from_peer(), create_rtp(), dialog_initialize_rtp(), do_setnat(), handle_request_invite(), jingle_alloc(), jingle_enable_video(), process_sdp(), sip_dtmfmode(), sip_set_rtp_peer(), and start_rtp().

00551 {
00552    instance->properties[property] = value;
00553 
00554    if (instance->engine->prop_set) {
00555       instance->engine->prop_set(instance, property, value);
00556    }
00557 }

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.

Parameters:
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
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 1079 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::qos.

Referenced by configure_local_rtp(), create_rtp(), dialog_initialize_rtp(), and start_rtp().

01080 {
01081    return instance->engine->qos ? instance->engine->qos(instance, tos, cos, desc) : -1;
01082 }

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.

Parameters:
instance The RTP instance to change read format on
format Format that frames are wanted in
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 1418 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::set_read_format.

Referenced by sip_new(), and sip_setoption().

01419 {
01420    return instance->engine->set_read_format ? instance->engine->set_read_format(instance, format) : -1;
01421 }

int ast_rtp_instance_set_requested_target_address ( struct ast_rtp_instance instance,
const struct ast_sockaddr address 
)

Set the requested target address of the remote endpoint.

This should always be the address of the remote endpoint. Consequently, this can differ from the address the engine is sending RTP to. However, usually they will be the same except in some circumstances (for instance when the engine "learns" the address if symmetric RTP is enabled).

Parameters:
instance The RTP instance to change the address on
address Address to set it to
Return values:
0 success
-1 failure

Definition at line 486 of file rtp_engine.c.

References ast_rtp_instance_set_incoming_source_address(), ast_sockaddr_copy(), and ast_rtp_instance::requested_target_address.

00488 {
00489    ast_sockaddr_copy(&instance->requested_target_address, address);
00490 
00491    return ast_rtp_instance_set_incoming_source_address(instance, address);
00492 }

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.

Parameters:
chan Channel to set the statistics on
instance The RTP instance that statistics will be retrieved from
Note:
Absolutely _NO_ channel locks should be held before calling this function.
Example usage:

This retrieves standard statistics from the RTP instance rtp and sets it on the channel pointed to by chan.

Since:
1.8

Definition at line 1356 of file rtp_engine.c.

References ast_channel_bridge_peer(), ast_channel_lock, ast_channel_stage_snapshot(), ast_channel_stage_snapshot_done(), ast_channel_unlock, ast_channel_unref, AST_MAX_USER_FIELD, ast_rtp_instance_get_quality(), AST_RTP_INSTANCE_STAT_FIELD_QUALITY, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, ast_channel::bridge, pbx_builtin_setvar_helper(), and quality.

Referenced by handle_request_bye(), and sip_hangup().

01357 {
01358    char quality_buf[AST_MAX_USER_FIELD];
01359    char *quality;
01360    struct ast_channel *bridge = ast_channel_bridge_peer(chan);
01361 
01362    ast_channel_lock(chan);
01363    ast_channel_stage_snapshot(chan);
01364    ast_channel_unlock(chan);
01365    if (bridge) {
01366       ast_channel_lock(bridge);
01367       ast_channel_stage_snapshot(bridge);
01368       ast_channel_unlock(bridge);
01369    }
01370 
01371    quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY,
01372       quality_buf, sizeof(quality_buf));
01373    if (quality) {
01374       pbx_builtin_setvar_helper(chan, "RTPAUDIOQOS", quality);
01375       if (bridge) {
01376          pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSBRIDGED", quality);
01377       }
01378    }
01379 
01380    quality = ast_rtp_instance_get_quality(instance,
01381       AST_RTP_INSTANCE_STAT_FIELD_QUALITY_JITTER, quality_buf, sizeof(quality_buf));
01382    if (quality) {
01383       pbx_builtin_setvar_helper(chan, "RTPAUDIOQOSJITTER", quality);
01384       if (bridge) {
01385          pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSJITTERBRIDGED", quality);
01386       }
01387    }
01388 
01389    quality = ast_rtp_instance_get_quality(instance,
01390       AST_RTP_INSTANCE_STAT_FIELD_QUALITY_LOSS, quality_buf, sizeof(quality_buf));
01391    if (quality) {
01392       pbx_builtin_setvar_helper(chan, "RTPAUDIOQOSLOSS", quality);
01393       if (bridge) {
01394          pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSLOSSBRIDGED", quality);
01395       }
01396    }
01397 
01398    quality = ast_rtp_instance_get_quality(instance,
01399       AST_RTP_INSTANCE_STAT_FIELD_QUALITY_RTT, quality_buf, sizeof(quality_buf));
01400    if (quality) {
01401       pbx_builtin_setvar_helper(chan, "RTPAUDIOQOSRTT", quality);
01402       if (bridge) {
01403          pbx_builtin_setvar_helper(bridge, "RTPAUDIOQOSRTTBRIDGED", quality);
01404       }
01405    }
01406 
01407    ast_channel_lock(chan);
01408    ast_channel_stage_snapshot_done(chan);
01409    ast_channel_unlock(chan);
01410    if (bridge) {
01411       ast_channel_lock(bridge);
01412       ast_channel_stage_snapshot_done(bridge);
01413       ast_channel_unlock(bridge);
01414       ast_channel_unref(bridge);
01415    }
01416 }

void ast_rtp_instance_set_timeout ( struct ast_rtp_instance instance,
int  timeout 
)

Set the RTP timeout value.

Parameters:
instance The RTP instance
timeout Value to set the timeout to
Example usage:

 ast_rtp_instance_set_timeout(instance, 5000);

This sets the RTP timeout value on 'instance' to be 5000.

Since:
1.8

Definition at line 1494 of file rtp_engine.c.

References ast_rtp_instance::timeout.

Referenced by check_rtp_timeout(), configure_local_rtp(), and dialog_initialize_rtp().

01495 {
01496    instance->timeout = timeout;
01497 }

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.

Parameters:
instance The RTP instance to change write format on
format Format that frames will be provided in
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 1423 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::set_write_format.

Referenced by sip_new(), and sip_setoption().

01424 {
01425    return instance->engine->set_write_format ? instance->engine->set_write_format(instance, format) : -1;
01426 }

void ast_rtp_instance_stop ( struct ast_rtp_instance instance  ) 

Stop an RTP instance.

Parameters:
instance Instance that media is no longer going to at this time
Example usage:

This tells the RTP engine being used for the instance pointed to by instance that media is no longer going to it at this time, but may in the future.

Since:
1.8

Definition at line 1084 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::stop.

Referenced by apply_negotiated_sdp_stream(), close_rtp_connection(), destroy_rtp(), jingle_session_destructor(), process_sdp(), stop_media_flows(), and stream_destroy().

01085 {
01086    if (instance->engine->stop) {
01087       instance->engine->stop(instance);
01088    }
01089 }

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.

Parameters:
instance The RTP instance
suggestion The suggested destination
username Optionally a username for the request
Example usage:

This requests that the RTP engine send a STUN BIND request on the session pointed to by 'instance'.

Since:
1.8

Definition at line 1485 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::stun_request.

Referenced by jingle_interpret_google_transport().

01488 {
01489    if (instance->engine->stun_request) {
01490       instance->engine->stun_request(instance, suggestion, username);
01491    }
01492 }

void ast_rtp_instance_update_source ( struct ast_rtp_instance instance  ) 

Indicate that the RTP marker bit should be set on an RTP stream.

Parameters:
instance Instance that the new media source is feeding into
Example usage:

This indicates that the source of media that is feeding the instance pointed to by instance has been updated and that the marker bit should be set.

Since:
1.8

Definition at line 1065 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::update_source.

Referenced by jingle_indicate(), mgcp_indicate(), ooh323_indicate(), sip_answer(), sip_indicate(), sip_write(), and skinny_indicate().

01066 {
01067    if (instance->engine->update_source) {
01068       instance->engine->update_source(instance);
01069    }
01070 }

int ast_rtp_instance_write ( struct ast_rtp_instance instance,
struct ast_frame frame 
)

Send a frame out over RTP.

Parameters:
instance The RTP instance to send frame out on
frame the frame to send out
Return values:
0 success
-1 failure
Example usage:

 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.

Since:
1.8

Definition at line 455 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::write.

Referenced by chan_pjsip_indicate(), chan_pjsip_write(), jingle_write(), mgcp_write(), ooh323_write(), rtp_write(), sip_indicate(), sip_write(), skinny_write(), and unistim_write().

00456 {
00457    return instance->engine->write(instance, frame);
00458 }

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.

Parameters:
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
Return values:
non-NULL success
NULL failure
Example usage:

 char buf[256] = "";
 struct ast_format tmp_fmt;
 struct ast_format_cap *cap = ast_format_cap_alloc_nolock();
 ast_format_cap_append(cap, ast_format_set(&tmp_fmt, AST_FORMAT_ULAW, 0));
 ast_format_cap_append(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.

Since:
1.8

Definition at line 1005 of file rtp_engine.c.

References ao2_ref, ast_format_cap_count(), ast_format_cap_get_format(), ast_rtp_lookup_mime_subtype2(), AST_RTP_MAX, ast_str_append(), ast_str_buffer(), name, and NULL.

Referenced by process_sdp().

01006 {
01007    int found = 0;
01008    const char *name;
01009    if (!buf) {
01010       return NULL;
01011    }
01012 
01013 
01014    if (asterisk_format) {
01015       int x;
01016       struct ast_format *tmp_fmt;
01017       for (x = 0; x < ast_format_cap_count(ast_format_capability); x++) {
01018          tmp_fmt = ast_format_cap_get_format(ast_format_capability, x);
01019          name = ast_rtp_lookup_mime_subtype2(asterisk_format, tmp_fmt, 0, options);
01020          ao2_ref(tmp_fmt, -1);
01021          ast_str_append(&buf, 0, "%s|", name);
01022          found = 1;
01023       }
01024    } else {
01025       int x;
01026       ast_str_append(&buf, 0, "0x%x (", (unsigned int) rtp_capability);
01027       for (x = 1; x <= AST_RTP_MAX; x <<= 1) {
01028          if (rtp_capability & x) {
01029             name = ast_rtp_lookup_mime_subtype2(asterisk_format, NULL, x, options);
01030             ast_str_append(&buf, 0, "%s|", name);
01031             found = 1;
01032          }
01033       }
01034    }
01035 
01036    ast_str_append(&buf, 0, "%s", found ? ")" : "nothing)");
01037 
01038    return ast_str_buffer(buf);
01039 }

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.

Parameters:
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
Return values:
Mime subtype success
NULL failure
Example usage:

 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.

Since:
1.8

Definition at line 954 of file rtp_engine.c.

References ast_format_cmp(), AST_FORMAT_CMP_EQUAL, 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_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(), generate_rtpmap_attr(), jingle_add_payloads_to_description(), transmit_connect(), transmit_connect_with_sdp(), transmit_modify_request(), and transmit_modify_with_sdp().

00955 {
00956    int i;
00957    const char *res = "";
00958 
00959    ast_rwlock_rdlock(&mime_types_lock);
00960    for (i = 0; i < mime_types_len; i++) {
00961       if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format &&
00962          (ast_format_cmp(format, ast_rtp_mime_types[i].payload_type.format) != AST_FORMAT_CMP_NOT_EQUAL)) {
00963          if ((ast_format_cmp(format, ast_format_g726_aal2) == AST_FORMAT_CMP_EQUAL) &&
00964                (options & AST_RTP_OPT_G726_NONSTANDARD)) {
00965             res = "G726-32";
00966             break;
00967          } else {
00968             res = ast_rtp_mime_types[i].subtype;
00969             break;
00970          }
00971       } else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format &&
00972          ast_rtp_mime_types[i].payload_type.rtp_code == code) {
00973 
00974          res = ast_rtp_mime_types[i].subtype;
00975          break;
00976       }
00977    }
00978    ast_rwlock_unlock(&mime_types_lock);
00979 
00980    return res;
00981 }

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.

Parameters:
asterisk_format True if the value in format is to be used.
format An asterisk format
code from AST_RTP list
Returns:
the sample rate if the format was found, zero if it was not found
Since:
1.8

Definition at line 983 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(), generate_rtpmap_attr(), and jingle_add_payloads_to_description().

00984 {
00985    unsigned int i;
00986    unsigned int res = 0;
00987 
00988    ast_rwlock_rdlock(&mime_types_lock);
00989    for (i = 0; i < mime_types_len; ++i) {
00990       if (ast_rtp_mime_types[i].payload_type.asterisk_format && asterisk_format && format &&
00991          (ast_format_cmp(format, ast_rtp_mime_types[i].payload_type.format) != AST_FORMAT_CMP_NOT_EQUAL)) {
00992          res = ast_rtp_mime_types[i].sample_rate;
00993          break;
00994       } else if (!ast_rtp_mime_types[i].payload_type.asterisk_format && !asterisk_format &&
00995          ast_rtp_mime_types[i].payload_type.rtp_code == code) {
00996          res = ast_rtp_mime_types[i].sample_rate;
00997          break;
00998       }
00999    }
01000    ast_rwlock_unlock(&mime_types_lock);
01001 
01002    return res;
01003 }

void ast_rtp_publish_rtcp_message ( struct ast_rtp_instance rtp,
struct stasis_message_type message_type,
struct ast_rtp_rtcp_report report,
struct ast_json blob 
)

Publish an RTCP message to Stasis Message Bus API.

Since:
12
Parameters:
rtp The rtp instance object
message_type The RTP message type to publish
report The RTCP report object to publish. This should be an ao2 ref counted object. This routine will increase the reference count of the object.
blob Additional JSON objects to publish along with the RTCP information

Definition at line 2007 of file rtp_engine.c.

References ao2_alloc, ao2_cleanup, ao2_ref, ast_channel_snapshot_get_latest(), ast_json_ref(), ast_rtp_topic(), ast_strlen_zero, ast_rtp_instance::channel_uniqueid, NULL, RAII_VAR, rtcp_message_payload_dtor(), stasis_message_create(), and stasis_publish().

Referenced by ast_rtcp_read(), and ast_rtcp_write_report().

02011 {
02012    RAII_VAR(struct rtcp_message_payload *, payload, NULL, ao2_cleanup);
02013    RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
02014 
02015    if (!message_type) {
02016       return;
02017    }
02018 
02019    payload = ao2_alloc(sizeof(*payload), rtcp_message_payload_dtor);
02020    if (!payload || !report) {
02021       return;
02022    }
02023 
02024    if (!ast_strlen_zero(rtp->channel_uniqueid)) {
02025       payload->snapshot = ast_channel_snapshot_get_latest(rtp->channel_uniqueid);
02026    }
02027    if (blob) {
02028       payload->blob = blob;
02029       ast_json_ref(blob);
02030    }
02031    ao2_ref(report, +1);
02032    payload->report = report;
02033 
02034    message = stasis_message_create(message_type, payload);
02035    if (!message) {
02036       return;
02037    }
02038 
02039    stasis_publish(ast_rtp_topic(), message);
02040 }

int ast_rtp_red_buffer ( struct ast_rtp_instance instance,
struct ast_frame frame 
)

Buffer a frame in an RTP instance for RED.

Parameters:
instance The instance to buffer the frame on
frame Frame that we want to buffer
Return values:
0 success
-1 failure
Since:
1.8

Definition at line 1306 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::red_buffer.

Referenced by sip_write().

01307 {
01308    return instance->engine->red_buffer ? instance->engine->red_buffer(instance, frame) : -1;
01309 }

int ast_rtp_red_init ( struct ast_rtp_instance instance,
int  buffer_time,
int *  payloads,
int  generations 
)

Initialize RED support on an RTP instance.

Parameters:
instance The instance to initialize RED support on
buffer_time How long to buffer before sending
payloads Payload values
generations Number of generations
Return values:
0 success
-1 failure
Since:
1.8

Definition at line 1301 of file rtp_engine.c.

References ast_rtp_instance::engine, and ast_rtp_engine::red_init.

Referenced by process_sdp().

01302 {
01303    return instance->engine->red_init ? instance->engine->red_init(instance, buffer_time, payloads, generations) : -1;
01304 }

struct ast_rtp_rtcp_report* ast_rtp_rtcp_report_alloc ( unsigned int  report_blocks  )  [read]

Allocate an ao2 ref counted instance of ast_rtp_rtcp_report.

Parameters:
report_blocks The number of report blocks to allocate
Return values:
An ao2 ref counted ast_rtp_rtcp_report object on success
NULL on error

Definition at line 1996 of file rtp_engine.c.

References ao2_alloc, and rtp_rtcp_report_dtor().

Referenced by ast_rtcp_read(), and ast_rtcp_write_report().

01997 {
01998    struct ast_rtp_rtcp_report *rtcp_report;
01999 
02000    /* Size of object is sizeof the report + the number of report_blocks * sizeof pointer */
02001    rtcp_report = ao2_alloc((sizeof(*rtcp_report) + report_blocks * sizeof(struct ast_rtp_rtcp_report_block *)),
02002       rtp_rtcp_report_dtor);
02003 
02004    return rtcp_report;
02005 }


Generated on Thu Apr 16 06:33:38 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6