Asterisk - The Open Source Telephony Project
18.5.0
|
SIP SDP media stream handling. More...
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_ua.h>
#include <pjmedia.h>
#include <pjlib.h>
#include "asterisk/utils.h"
#include "asterisk/module.h"
#include "asterisk/format.h"
#include "asterisk/format_cap.h"
#include "asterisk/rtp_engine.h"
#include "asterisk/netsock2.h"
#include "asterisk/channel.h"
#include "asterisk/causes.h"
#include "asterisk/sched.h"
#include "asterisk/acl.h"
#include "asterisk/sdp_srtp.h"
#include "asterisk/dsp.h"
#include "asterisk/linkedlists.h"
#include "asterisk/stream.h"
#include "asterisk/logger_category.h"
#include "asterisk/format_cache.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_session.h"
#include "asterisk/res_pjsip_session_caps.h"
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | add_crypto_to_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, pj_pool_t *pool, pjmedia_sdp_media *media) |
static void | add_extmap_to_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, pj_pool_t *pool, pjmedia_sdp_media *media) |
static void | add_ice_to_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, pj_pool_t *pool, pjmedia_sdp_media *media, unsigned int include_candidates) |
Function which adds ICE attributes to a media stream. More... | |
static void | add_msid_to_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, pj_pool_t *pool, pjmedia_sdp_media *media, struct ast_stream *stream) |
static void | add_rtcp_fb_to_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, pj_pool_t *pool, pjmedia_sdp_media *media) |
static void | add_ssrc_to_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, pj_pool_t *pool, pjmedia_sdp_media *media) |
Function which adds ssrc attributes to a media stream. More... | |
static int | apply_cap_to_bundled (struct ast_sip_session_media *session_media, struct ast_sip_session_media *session_media_transport, struct ast_stream *asterisk_stream, struct ast_format_cap *joint) |
static void | apply_dtls_attrib (struct ast_sip_session_media *session_media, pjmedia_sdp_attr *attr) |
static int | apply_negotiated_sdp_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *local, const struct pjmedia_sdp_session *remote, int index, struct ast_stream *asterisk_stream) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | change_outgoing_sdp_stream_media_address (pjsip_tx_data *tdata, struct pjmedia_sdp_media *stream, struct ast_sip_transport *transport) |
Function which updates the media stream with external media address, if applicable. More... | |
static enum ast_sip_session_media_encryption | check_endpoint_media_transport (struct ast_sip_endpoint *endpoint, const struct pjmedia_sdp_media *stream) |
Checks whether the encryption offered in SDP is compatible with the endpoint's configuration. More... | |
static void | check_ice_support (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_media *remote_stream) |
Function which checks for ice attributes in an audio stream. More... | |
static int | create_outgoing_sdp_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, struct pjmedia_sdp_session *sdp, const struct pjmedia_sdp_session *remote, struct ast_stream *stream) |
Function which creates an outgoing stream. More... | |
static int | create_rtp (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp) |
Internal function which creates an RTP instance. More... | |
static void | enable_rtcp (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_media *remote_media) |
Enable RTCP on an RTP session. More... | |
static void | enable_rtp_extension (struct ast_sip_session *session, struct ast_sip_session_media *session_media, enum ast_rtp_extension extension, enum ast_rtp_extension_direction direction, const pjmedia_sdp_session *sdp) |
Enable an RTP extension on an RTP session. More... | |
static pjmedia_sdp_attr * | generate_fmtp_attr (pj_pool_t *pool, struct ast_format *format, int rtp_code) |
static pjmedia_sdp_attr * | generate_rtpmap_attr (struct ast_sip_session *session, pjmedia_sdp_media *media, pj_pool_t *pool, int rtp_code, int asterisk_format, struct ast_format *format, int code) |
static void | get_codecs (struct ast_sip_session *session, const struct pjmedia_sdp_media *stream, struct ast_rtp_codecs *codecs, struct ast_sip_session_media *session_media) |
static enum ast_sip_session_media_encryption | get_media_encryption_type (pj_str_t transport, const struct pjmedia_sdp_media *stream, unsigned int *optimistic) |
figure out media transport encryption type from the media transport string More... | |
static int | load_module (void) |
Load the module. More... | |
static struct ast_frame * | media_session_rtcp_read_callback (struct ast_sip_session *session, struct ast_sip_session_media *session_media) |
static struct ast_frame * | media_session_rtp_read_callback (struct ast_sip_session *session, struct ast_sip_session_media *session_media) |
static int | media_session_rtp_write_callback (struct ast_sip_session *session, struct ast_sip_session_media *session_media, struct ast_frame *frame) |
static int | media_stream_has_crypto (const struct pjmedia_sdp_media *stream) |
figure out if media stream has crypto lines for sdes More... | |
static int | negotiate_incoming_sdp_stream (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const pjmedia_sdp_session *sdp, int index, struct ast_stream *asterisk_stream) |
Function which negotiates an incoming media stream. More... | |
static int | parse_dtls_attrib (struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream) |
static void | process_extmap_attributes (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_media *remote_stream) |
Function which processes extmap attributes in a stream. More... | |
static void | process_ice_attributes (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *remote, const struct pjmedia_sdp_media *remote_stream) |
Function which processes ICE attributes in an audio stream. More... | |
static void | process_ice_auth_attrb (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *remote, const struct pjmedia_sdp_media *remote_stream) |
static void | process_ssrc_attributes (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_media *remote_stream) |
Function which processes ssrc attributes in a stream. More... | |
static int | rtp_check_timeout (const void *data) |
Check whether RTP is being received or not. More... | |
static int | send_keepalive (const void *data) |
static int | set_caps (struct ast_sip_session *session, struct ast_sip_session_media *session_media, struct ast_sip_session_media *session_media_transport, const struct pjmedia_sdp_media *stream, int is_offer, struct ast_stream *asterisk_stream) |
static void | set_ice_components (struct ast_sip_session *session, struct ast_sip_session_media *session_media) |
static struct ast_format_cap * | set_incoming_call_offer_cap (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_media *stream) |
static int | setup_dtls_srtp (struct ast_sip_session *session, struct ast_sip_session_media *session_media) |
static int | setup_media_encryption (struct ast_sip_session *session, struct ast_sip_session_media *session_media, const struct pjmedia_sdp_session *sdp, const struct pjmedia_sdp_media *stream) |
static int | setup_sdes_srtp (struct ast_sip_session_media *session_media, const struct pjmedia_sdp_media *stream) |
static int | setup_srtp (struct ast_sip_session_media *session_media) |
static void | stream_destroy (struct ast_sip_session_media *session_media) |
Function which destroys the RTP instance when session ends. More... | |
static void | stream_stop (struct ast_sip_session_media *session_media) |
Function which stops the RTP instance. More... | |
static int | unload_module (void) |
Unloads the sdp RTP/AVP module from Asterisk. More... | |
static int | video_info_incoming_request (struct ast_sip_session *session, struct pjsip_rx_data *rdata) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "PJSIP SDP RTP/AVP stream handler" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DRIVER, .requires = "res_pjsip,res_pjsip_session", } |
static struct ast_sockaddr | address_rtp |
Address for RTP. More... | |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_sip_session_sdp_handler | audio_sdp_handler |
SDP handler for 'audio' media stream. More... | |
static struct ast_sched_context * | sched |
Scheduler for RTCP purposes. More... | |
static const char | STR_AUDIO [] = "audio" |
static const char | STR_VIDEO [] = "video" |
static struct ast_sip_session_supplement | video_info_supplement |
static struct ast_sip_session_sdp_handler | video_sdp_handler |
SDP handler for 'video' media stream. More... | |
SIP SDP media stream handling.
Definition in file res_pjsip_sdp_rtp.c.
|
static |
Definition at line 2390 of file res_pjsip_sdp_rtp.c.
|
static |
Definition at line 2390 of file res_pjsip_sdp_rtp.c.
|
static |
Definition at line 1580 of file res_pjsip_sdp_rtp.c.
References ast_free, AST_LIST_NEXT, AST_RTP_DTLS_CONNECTION_EXISTING, AST_RTP_DTLS_CONNECTION_NEW, AST_RTP_DTLS_HASH_SHA1, AST_RTP_DTLS_HASH_SHA256, AST_RTP_DTLS_SETUP_ACTIVE, AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_SETUP_HOLDCONN, AST_RTP_DTLS_SETUP_PASSIVE, ast_rtp_instance_get_dtls(), ast_sdp_srtp_alloc(), ast_sdp_srtp_get_attrib(), AST_SIP_MEDIA_ENCRYPT_DTLS, AST_SIP_MEDIA_ENCRYPT_NONE, AST_SIP_MEDIA_ENCRYPT_SDES, AST_SIP_MEDIA_TRANSPORT_INVALID, ast_str_buffer(), ast_str_create, ast_str_set(), ast_rtp_dtls_cfg::default_setup, ast_sip_media_rtp_configuration::dtls_cfg, ast_sip_session_media::encryption, ast_sip_session::endpoint, ast_rtp_engine_dtls::get_connection, ast_rtp_engine_dtls::get_fingerprint, ast_rtp_engine_dtls::get_fingerprint_hash, ast_rtp_engine_dtls::get_setup, ast_sip_session::inv_session, ast_sip_endpoint::media, RAII_VAR, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, ast_sdp_srtp::sdp_srtp_list, setup_dtls_srtp(), ast_sip_session_media::srtp, ast_sip_media_rtp_configuration::srtp_tag_32, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 1354 of file res_pjsip_sdp_rtp.c.
References AST_MEDIA_TYPE_VIDEO, AST_RTP_EXTENSION_DIRECTION_INACTIVE, AST_RTP_EXTENSION_DIRECTION_NONE, AST_RTP_EXTENSION_DIRECTION_RECVONLY, AST_RTP_EXTENSION_DIRECTION_SENDONLY, AST_RTP_EXTENSION_DIRECTION_SENDRECV, AST_RTP_EXTENSION_UNSUPPORTED, ast_rtp_instance_extmap_count(), ast_rtp_instance_extmap_get_direction(), ast_rtp_instance_extmap_get_extension(), ast_rtp_instance_extmap_get_uri(), ast_sip_session::endpoint, ast_sip_endpoint::media, ast_sip_session_media::rtp, ast_sip_session_media::type, and ast_sip_endpoint_media_configuration::webrtc.
Referenced by create_outgoing_sdp_stream().
|
static |
Function which adds ICE attributes to a media stream.
Definition at line 675 of file res_pjsip_sdp_rtp.c.
References ast_rtp_engine_ice_candidate::address, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, ast_free, AST_RTP_ICE_CANDIDATE_TYPE_HOST, AST_RTP_ICE_CANDIDATE_TYPE_RELAYED, AST_RTP_ICE_CANDIDATE_TYPE_SRFLX, ast_rtp_instance_get_ice(), ast_sockaddr_isnull(), ast_sockaddr_stringify_addr_remote(), ast_sockaddr_stringify_port(), ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_set(), ast_sip_session::endpoint, ast_rtp_engine_ice_candidate::foundation, ast_rtp_engine_ice::get_local_candidates, ast_rtp_engine_ice::get_password, ast_rtp_engine_ice::get_ufrag, ast_sip_media_rtp_configuration::ice_support, ast_rtp_engine_ice_candidate::id, ast_sip_endpoint::media, password, ast_rtp_engine_ice_candidate::priority, ast_rtp_engine_ice_candidate::relay_address, ast_sip_session_media::remote_ice, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, ast_rtp_engine_ice::stop, ast_rtp_engine_ice_candidate::transport, and ast_rtp_engine_ice_candidate::type.
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 1272 of file res_pjsip_sdp_rtp.c.
References ast_codec_media_type2str(), ast_copy_string(), ast_debug, ast_stream_get_group(), ast_stream_get_metadata(), ast_stream_get_type(), ast_stream_set_metadata(), ast_strlen_zero, ast_uuid_generate_str(), AST_UUID_STR_LEN, AST_VECTOR_GET, ast_sip_session::endpoint, ast_sip_session_media::label, ast_sip_endpoint::media, ast_sip_session_media::mslabel, ast_sip_session::pending_media_state, and ast_sip_endpoint_media_configuration::webrtc.
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 1319 of file res_pjsip_sdp_rtp.c.
References AST_MEDIA_TYPE_VIDEO, ast_sip_session::endpoint, ast_sip_endpoint::media, ast_sip_session_media::type, and ast_sip_endpoint_media_configuration::webrtc.
Referenced by create_outgoing_sdp_stream().
|
static |
Function which adds ssrc attributes to a media stream.
Definition at line 1202 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_get_cname(), ast_rtp_instance_get_ssrc(), ast_sip_endpoint_media_configuration::bundle, ast_sip_session_media::bundle_group, ast_sip_session::endpoint, ast_sip_endpoint::media, ast_sip_session_media::rtp, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 407 of file res_pjsip_sdp_rtp.c.
References ao2_ref, ast_format_cap_count(), ast_format_cap_get_format(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_set_rx(), ast_rtp_instance_get_codecs(), ast_stream_set_formats(), ast_sip_session_media::bundled, format, and ast_sip_session_media::rtp.
Referenced by negotiate_incoming_sdp_stream(), and set_caps().
|
static |
Definition at line 1050 of file res_pjsip_sdp_rtp.c.
References ast_copy_pj_str(), ast_log, AST_RTP_DTLS_HASH_SHA1, AST_RTP_DTLS_HASH_SHA256, AST_RTP_DTLS_SETUP_ACTIVE, AST_RTP_DTLS_SETUP_ACTPASS, AST_RTP_DTLS_SETUP_HOLDCONN, AST_RTP_DTLS_SETUP_PASSIVE, ast_rtp_instance_get_dtls(), LOG_WARNING, ast_rtp_engine_dtls::reset, ast_sip_session_media::rtp, ast_rtp_engine_dtls::set_fingerprint, ast_rtp_engine_dtls::set_setup, and value.
Referenced by parse_dtls_attrib().
|
static |
Definition at line 2065 of file res_pjsip_sdp_rtp.c.
References AST_AF_UNSPEC, ast_channel_lock, ast_channel_uniqueid(), ast_channel_unlock, AST_CONTROL_UPDATE_RTP_PEER, ast_copy_pj_str(), ast_free, AST_MEDIA_TYPE_AUDIO, ast_null_frame, ast_queue_control(), ast_queue_frame(), ast_queue_hold(), ast_queue_unhold(), ast_rtp_instance_activate(), ast_rtp_instance_bundle(), ast_rtp_instance_fd(), ast_rtp_instance_get_timeout(), ast_rtp_instance_set_channel_id(), ast_rtp_instance_set_keepalive(), ast_rtp_instance_set_remote_address, ast_rtp_instance_set_stream_num(), ast_rtp_instance_set_timeout(), ast_rtp_instance_stop(), ast_sched_add_variable(), AST_SCHED_DEL, AST_SIP_MEDIA_TRANSPORT_INVALID, ast_sip_session_get_name(), ast_sip_session_media_add_read_callback(), ast_sip_session_media_get_transport(), ast_sip_session_media_set_write_callback(), ast_sockaddr_resolve(), ast_sockaddr_set_port, ast_str_tmp, ast_stream_get_position(), ast_stream_to_str(), ast_sip_session_media::bundled, ast_sip_session::channel, check_endpoint_media_transport(), create_rtp(), enable_rtcp(), ast_sip_session_media::encryption, ast_sip_media_rtp_configuration::encryption, ast_sip_media_rtp_configuration::encryption_optimistic, ast_sip_session::endpoint, host, ast_sip_session::inv_session, ast_sip_media_rtp_configuration::keepalive, ast_sip_session_media::keepalive_sched_id, ast_sip_endpoint::media, media_session_rtcp_read_callback(), media_session_rtp_read_callback(), media_session_rtp_write_callback(), ast_sip_endpoint::mohsuggest, NULL, PARSE_PORT_FORBID, process_extmap_attributes(), process_ice_attributes(), process_ssrc_attributes(), RAII_VAR, ast_sip_session_media::remote_rtcp_mux, ast_sip_session_media::remotely_held, ast_sip_session_media::remotely_held_changed, ast_sip_endpoint_media_configuration::rtcp_mux, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, rtp_check_timeout(), SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, send_keepalive(), set_caps(), set_ice_components(), setup_media_encryption(), ast_sip_media_rtp_configuration::timeout, ast_sip_media_rtp_configuration::timeout_hold, ast_sip_session_media::timeout_sched_id, ast_sip_session_media::type, and ast_sip_media_rtp_configuration::use_received_transport.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2390 of file res_pjsip_sdp_rtp.c.
|
static |
Function which updates the media stream with external media address, if applicable.
Definition at line 2226 of file res_pjsip_sdp_rtp.c.
References ao2_cleanup, ast_copy_pj_str(), ast_debug, ast_sip_get_transport_state(), ast_sip_transport_is_nonlocal, ast_sockaddr_parse(), ast_sockaddr_stringify_addr_remote(), ast_sorcery_object_get_id(), host, PARSE_PORT_FORBID, and RAII_VAR.
|
static |
Checks whether the encryption offered in SDP is compatible with the endpoint's configuration.
Definition at line 970 of file res_pjsip_sdp_rtp.c.
References AST_SIP_MEDIA_ENCRYPT_NONE, AST_SIP_MEDIA_TRANSPORT_INVALID, ast_sip_media_rtp_configuration::encryption, ast_sip_media_rtp_configuration::encryption_optimistic, ast_sip_media_rtp_configuration::force_avp, get_media_encryption_type(), ast_sip_endpoint::media, ast_sip_endpoint_media_configuration::rtp, and ast_sip_media_rtp_configuration::use_avpf.
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Function which checks for ice attributes in an audio stream.
Definition at line 750 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_get_ice(), ast_sip_session::endpoint, ast_sip_media_rtp_configuration::ice_support, ast_sip_endpoint::media, ast_sip_session_media::remote_ice, ast_sip_session_media::rtp, and ast_sip_endpoint_media_configuration::rtp.
Referenced by negotiate_incoming_sdp_stream().
|
static |
Function which creates an outgoing stream.
Definition at line 1704 of file res_pjsip_sdp_rtp.c.
References add_crypto_to_stream(), add_extmap_to_stream(), add_ice_to_stream(), add_msid_to_stream(), add_rtcp_fb_to_stream(), add_ssrc_to_stream(), ast_sip_endpoint_media_configuration::address, ao2_cleanup, ao2_ref, ast_codec_media_type2str(), ast_format_cap_alloc, ast_format_cap_append_from_cap(), ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_compatible(), ast_format_cap_get_format(), ast_format_cap_get_framing(), ast_format_get_maximum_ms(), ast_format_get_name(), ast_format_get_type(), ast_log, AST_MEDIA_TYPE_VIDEO, ast_rtp_codecs_get_framing(), ast_rtp_codecs_payload_code(), ast_rtp_codecs_payload_set_rx(), AST_RTP_DTMF, ast_rtp_instance_change_source(), ast_rtp_instance_get_codecs(), ast_rtp_instance_get_local_address(), ast_rtp_instance_get_ssrc(), AST_RTP_MAX, ast_sdp_get_rtp_profile(), AST_SIP_DTMF_AUTO, AST_SIP_DTMF_AUTO_INFO, AST_SIP_DTMF_RFC_4733, ast_sip_get_host_ip_string(), AST_SIP_MEDIA_ENCRYPT_SDES, ast_sip_session_get_name(), ast_sip_session_is_pending_stream_default(), ast_sip_session_media_get_transport(), ast_sockaddr_isnull(), ast_sockaddr_port, AST_SOCKADDR_STR_ADDR, ast_sockaddr_stringify_fmt(), ast_str_tmp, ast_stream_get_formats(), ast_stream_get_position(), ast_stream_get_state(), ast_stream_set_state(), AST_STREAM_STATE_INACTIVE, AST_STREAM_STATE_RECVONLY, AST_STREAM_STATE_REMOVED, AST_STREAM_STATE_SENDONLY, ast_stream_to_str(), ast_strlen_zero, AST_VECTOR_GET, ast_sip_session_media::bundle_group, ast_sip_session_media::bundled, ast_sip_endpoint_media_configuration::codecs, create_rtp(), ast_sip_session_media::direct_media_addr, ast_sip_session::direct_media_cap, ast_sip_session::dtmf, enable_rtcp(), ast_sip_session_media::encryption, ast_sip_media_rtp_configuration::encryption_optimistic, ast_sip_session::endpoint, ast_sip_media_rtp_configuration::force_avp, format, generate_fmtp_attr(), generate_rtpmap_attr(), ast_sip_session::inv_session, ast_sip_media_rtp_configuration::ipv6, ast_sip_session_media::locally_held, LOG_ERROR, LOG_WARNING, ast_sip_endpoint::media, NULL, ast_sip_session::pending_media_state, pool, RAII_VAR, ast_sip_session_media::remote_rtcp_mux, ast_sip_session_media::remotely_held, ast_sip_endpoint_media_configuration::rtcp_mux, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, set_ice_components(), ast_sip_session_media::stream_num, tmp(), ast_sip_session_media::transport, ast_sip_session_media::type, and ast_sip_media_rtp_configuration::use_avpf.
|
static |
Internal function which creates an RTP instance.
Definition at line 228 of file res_pjsip_sdp_rtp.c.
References ast_sip_endpoint_media_configuration::address, address_rtp, ao2_ref, ast_debug_rtp, ast_log, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_VIDEO, AST_RTP_DTMF_MODE_INBAND, AST_RTP_DTMF_MODE_RFC2833, AST_RTP_EXTENSION_ABS_SEND_TIME, AST_RTP_EXTENSION_DIRECTION_SENDRECV, AST_RTP_EXTENSION_TRANSPORT_WIDE_CC, ast_rtp_instance_dtmf_mode_set(), ast_rtp_instance_get_ice(), ast_rtp_instance_new(), ast_rtp_instance_set_last_rx(), ast_rtp_instance_set_prop(), ast_rtp_instance_set_qos(), AST_RTP_PROPERTY_ASYMMETRIC_CODEC, AST_RTP_PROPERTY_DTMF, AST_RTP_PROPERTY_NAT, AST_RTP_PROPERTY_REMB, AST_RTP_PROPERTY_RETRANS_RECV, AST_RTP_PROPERTY_RETRANS_SEND, AST_SIP_DTMF_AUTO, AST_SIP_DTMF_AUTO_INFO, AST_SIP_DTMF_INBAND, AST_SIP_DTMF_RFC_4733, ast_sip_get_sorcery(), ast_sip_get_transport_state(), ast_sockaddr_parse(), ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), ast_strlen_zero, ast_sip_endpoint::asymmetric_rtp_codec, ast_sip_endpoint_media_configuration::bind_rtp_to_media_address, ast_sip_endpoint_media_configuration::cos_audio, ast_sip_endpoint_media_configuration::cos_video, ast_sip_session::dtmf, enable_rtp_extension(), ast_sip_session::endpoint, ast_sip_media_rtp_configuration::engine, ast_sip_transport_state::host, ast_sip_media_rtp_configuration::ice_support, LOG_ERROR, ast_sip_endpoint::media, media_address, NULL, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, ast_rtp_engine_ice::stop, ast_sip_media_rtp_configuration::symmetric, ast_sip_endpoint_media_configuration::tos_audio, ast_sip_endpoint_media_configuration::tos_video, ast_sip_endpoint::transport, ast_sip_session_media::type, and ast_sip_endpoint_media_configuration::webrtc.
Referenced by apply_negotiated_sdp_stream(), create_outgoing_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Enable RTCP on an RTP session.
Definition at line 165 of file res_pjsip_sdp_rtp.c.
References AST_RTP_INSTANCE_RTCP_MUX, AST_RTP_INSTANCE_RTCP_STANDARD, ast_rtp_instance_set_prop(), AST_RTP_PROPERTY_RTCP, ast_sip_session::endpoint, ast_sip_endpoint::media, ast_sip_session_media::remote_rtcp_mux, ast_sip_endpoint_media_configuration::rtcp_mux, and ast_sip_session_media::rtp.
Referenced by apply_negotiated_sdp_stream(), create_outgoing_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Enable an RTP extension on an RTP session.
Definition at line 182 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_extmap_count(), ast_rtp_instance_extmap_enable(), ast_rtp_instance_extmap_get_id(), AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_session_media::bundle_group, ast_sip_session::pending_media_state, and ast_sip_session_media::rtp.
Referenced by create_rtp().
|
static |
Definition at line 649 of file res_pjsip_sdp_rtp.c.
References ast_format_generate_sdp_fmtp(), ast_str_alloca, ast_str_buffer(), ast_str_strlen(), NULL, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 614 of file res_pjsip_sdp_rtp.c.
References ast_rtp_lookup_mime_subtype2(), ast_rtp_lookup_sample_rate2(), AST_RTP_OPT_G726_NONSTANDARD, AST_RTP_PT_LAST_STATIC, ast_sip_session::endpoint, ast_sip_endpoint_media_configuration::g726_non_standard, ast_sip_endpoint::media, NULL, options, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 315 of file res_pjsip_sdp_rtp.c.
References ao2_ref, ast_copy_pj_str(), ast_format_parse_sdp_fmtp(), ast_rtp_codecs_get_payload_format(), ast_rtp_codecs_payload_replace_format(), ast_rtp_codecs_payloads_initialize(), ast_rtp_codecs_payloads_set_m_type(), ast_rtp_codecs_payloads_set_rtpmap_type_rate(), ast_rtp_codecs_set_framing(), AST_RTP_DTMF_MODE_INBAND, AST_RTP_DTMF_MODE_NONE, AST_RTP_DTMF_MODE_RFC2833, ast_rtp_instance_dtmf_mode_set(), ast_rtp_instance_set_prop(), AST_RTP_OPT_G726_NONSTANDARD, AST_RTP_PROPERTY_DTMF, AST_SIP_DTMF_AUTO, AST_SIP_DTMF_AUTO_INFO, ast_sip_session_get_name(), ast_sip_session::dtmf, ast_sip_session::endpoint, format, ast_sip_endpoint_media_configuration::g726_non_standard, ast_sip_session::inv_session, ast_sip_endpoint::media, name, NULL, options, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN, and ast_sip_media_rtp_configuration::use_ptime.
Referenced by set_caps(), and set_incoming_call_offer_cap().
|
static |
figure out media transport encryption type from the media transport string
Definition at line 938 of file res_pjsip_sdp_rtp.c.
References ast_free, AST_SIP_MEDIA_ENCRYPT_DTLS, AST_SIP_MEDIA_ENCRYPT_NONE, AST_SIP_MEDIA_ENCRYPT_SDES, AST_SIP_MEDIA_TRANSPORT_INVALID, ast_strndup, media_stream_has_crypto(), and RAII_VAR.
Referenced by check_endpoint_media_transport().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 2347 of file res_pjsip_sdp_rtp.c.
References address_rtp, ast_check_ipv6(), ast_log, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CHANNEL_DRIVER, AST_MODULE_INFO(), AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, AST_MODULE_SUPPORT_CORE, ast_sched_context_create(), ast_sched_start_thread(), ast_sip_session_register_sdp_handler(), ast_sip_session_register_supplement, ast_sockaddr_parse(), ASTERISK_GPL_KEY, end, LOG_ERROR, STR_AUDIO, STR_VIDEO, and unload_module().
|
static |
Definition at line 2038 of file res_pjsip_sdp_rtp.c.
References ast_null_frame, ast_rtp_instance_read(), ast_rtp_instance_set_last_rx(), NULL, and ast_sip_session_media::rtp.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 2020 of file res_pjsip_sdp_rtp.c.
References ast_null_frame, ast_rtp_instance_read(), ast_rtp_instance_set_last_rx(), NULL, and ast_sip_session_media::rtp.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 2056 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_write(), and ast_sip_session_media::rtp.
Referenced by apply_negotiated_sdp_stream().
|
static |
figure out if media stream has crypto lines for sdes
Definition at line 918 of file res_pjsip_sdp_rtp.c.
Referenced by get_media_encryption_type().
|
static |
Function which negotiates an incoming media stream.
Definition at line 1462 of file res_pjsip_sdp_rtp.c.
References ao2_cleanup, apply_cap_to_bundled(), AST_AF_UNSPEC, ast_codec_media_type2str(), ast_copy_pj_str(), ast_debug, ast_format_cap_has_type(), ast_free, AST_MEDIA_TYPE_AUDIO, ast_rtp_instance_bundle(), AST_SIP_MEDIA_ENCRYPT_NONE, AST_SIP_MEDIA_ENCRYPT_SDES, AST_SIP_MEDIA_TRANSPORT_INVALID, ast_sip_session_get_name(), ast_sip_session_is_pending_stream_default(), ast_sip_session_media_get_transport(), ast_sockaddr_is_any(), ast_sockaddr_isnull(), ast_sockaddr_resolve(), ast_sip_session_media::bundled, check_endpoint_media_transport(), check_ice_support(), ast_sip_endpoint_media_configuration::codecs, create_rtp(), enable_rtcp(), ast_sip_session_media::encryption, ast_sip_media_rtp_configuration::encryption_optimistic, ast_sip_session::endpoint, host, ast_sip_session::inv_session, ast_sip_endpoint::media, NULL, PARSE_PORT_FORBID, process_extmap_attributes(), process_ice_auth_attrb(), process_ssrc_attributes(), RAII_VAR, ast_sip_session_media::remote_ice, ast_sip_session_media::remote_rtcp_mux, ast_sip_session_media::remotely_held, ast_sip_session_media::remotely_held_changed, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, set_ice_components(), set_incoming_call_offer_cap(), setup_media_encryption(), ast_sip_session_media::transport, ast_sip_session_media::type, and ast_sip_media_rtp_configuration::use_received_transport.
|
static |
Definition at line 1099 of file res_pjsip_sdp_rtp.c.
References apply_dtls_attrib(), ast_set_flag, AST_SRTP_CRYPTO_OFFER_OK, and ast_sip_session_media::srtp.
Referenced by setup_media_encryption().
|
static |
Function which processes extmap attributes in a stream.
Definition at line 1404 of file res_pjsip_sdp_rtp.c.
References ast_copy_pj_str(), AST_MEDIA_TYPE_VIDEO, AST_RTP_EXTENSION_DIRECTION_INACTIVE, AST_RTP_EXTENSION_DIRECTION_RECVONLY, AST_RTP_EXTENSION_DIRECTION_SENDONLY, AST_RTP_EXTENSION_DIRECTION_SENDRECV, ast_rtp_instance_extmap_clear(), ast_rtp_instance_extmap_negotiate(), ast_strlen_zero, ast_sip_session::endpoint, id, ast_sip_endpoint::media, ast_sip_session_media::rtp, ast_sip_session_media::type, and ast_sip_endpoint_media_configuration::webrtc.
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Function which processes ICE attributes in an audio stream.
Definition at line 814 of file res_pjsip_sdp_rtp.c.
References ast_rtp_engine_ice::add_remote_candidate, ast_rtp_engine_ice_candidate::address, ast_copy_pj_str(), ast_debug_ice, AST_RTP_ICE_CANDIDATE_TYPE_HOST, AST_RTP_ICE_CANDIDATE_TYPE_RELAYED, AST_RTP_ICE_CANDIDATE_TYPE_SRFLX, AST_RTP_ICE_ROLE_CONTROLLED, AST_RTP_ICE_ROLE_CONTROLLING, ast_rtp_instance_get_ice(), ast_sockaddr_parse(), ast_sockaddr_set_port, ast_strlen_zero, ast_sip_session::endpoint, ast_rtp_engine_ice_candidate::foundation, ast_rtp_engine_ice::ice_lite, ast_sip_media_rtp_configuration::ice_support, ast_rtp_engine_ice_candidate::id, ast_sip_session::inv_session, ast_sip_endpoint::media, NULL, PARSE_PORT_FORBID, ast_rtp_engine_ice_candidate::priority, ast_rtp_engine_ice_candidate::relay_address, ast_sip_session_media::remote_rtcp_mux, ast_sip_endpoint_media_configuration::rtcp_mux, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, ast_rtp_engine_ice::set_authentication, ast_rtp_engine_ice::set_role, ast_rtp_engine_ice::start, ast_rtp_engine_ice_candidate::transport, and ast_rtp_engine_ice_candidate::type.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 776 of file res_pjsip_sdp_rtp.c.
References ast_copy_pj_str(), ast_rtp_instance_get_ice(), ast_sip_session::endpoint, ast_sip_media_rtp_configuration::ice_support, ast_sip_endpoint::media, NULL, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, and ast_rtp_engine_ice::set_authentication.
Referenced by negotiate_incoming_sdp_stream().
|
static |
Function which processes ssrc attributes in a stream.
Definition at line 1218 of file res_pjsip_sdp_rtp.c.
References ast_sip_session::active_media_state, ast_copy_pj_str(), ast_rtp_instance_get_stats(), ast_rtp_instance_set_remote_ssrc(), AST_RTP_INSTANCE_STAT_REMOTE_SSRC, ast_sip_endpoint_media_configuration::bundle, ast_sip_session_media::changed, ast_sip_session::endpoint, ast_sip_session::inv_session, ast_sip_endpoint::media, NULL, ast_rtp_instance_stats::remote_ssrc, and ast_sip_session_media::rtp.
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Check whether RTP is being received or not.
Definition at line 105 of file res_pjsip_sdp_rtp.c.
References AST_CAUSE_REQUESTED_CHAN_UNAVAIL, ast_channel_get_by_name(), ast_channel_hangupcause_set(), ast_channel_lock, ast_channel_name(), ast_channel_unlock, ast_channel_unref, ast_codec_media_type2str(), ast_debug_rtp, ast_log, ast_rtp_instance_get_channel_id(), ast_rtp_instance_get_last_rx(), ast_rtp_instance_get_timeout(), ast_sockaddr_isnull(), ast_softhangup(), AST_SOFTHANGUP_DEV, ast_sip_session_media::direct_media_addr, LOG_NOTICE, NULL, ast_sip_session_media::rtp, timeout, and ast_sip_session_media::type.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 71 of file res_pjsip_sdp_rtp.c.
References ast_debug_rtp, ast_rtp_instance_get_keepalive(), ast_rtp_instance_get_last_tx(), ast_rtp_instance_sendcng(), ast_sockaddr_isnull(), ast_sip_session_media::direct_media_addr, keepalive, NULL, and ast_sip_session_media::rtp.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 485 of file res_pjsip_sdp_rtp.c.
References ao2_cleanup, ao2_ref, apply_cap_to_bundled(), ast_channel_is_bridged(), ast_channel_lock, ast_channel_nativeformats(), ast_channel_nativeformats_set(), ast_channel_readformat(), ast_channel_set_unbridged_nolock(), ast_channel_unlock, ast_channel_writeformat(), ast_codec_media_type2str(), ast_dsp_free(), ast_dsp_get_features(), ast_dsp_set_features(), ast_format_cap_alloc, ast_format_cap_append, ast_format_cap_append_from_cap(), ast_format_cap_count(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_format_cap_get_best_by_type(), ast_format_cap_get_compatible(), ast_format_cap_get_format(), ast_format_cap_get_framing(), ast_format_cap_get_names(), AST_FORMAT_CAP_NAMES_LEN, ast_format_cap_remove_by_type(), ast_log, AST_MEDIA_TYPE_AUDIO, AST_MEDIA_TYPE_UNKNOWN, AST_RTP_CODECS_NULL_INIT, ast_rtp_codecs_payload_formats(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_destroy(), ast_rtp_codecs_payloads_xover(), AST_RTP_DTMF_MODE_RFC2833, ast_rtp_instance_dtmf_mode_get(), ast_rtp_instance_get_codecs(), ast_set_read_format(), ast_set_write_format(), AST_SIP_DTMF_AUTO, AST_SIP_DTMF_AUTO_INFO, ast_sip_session_get_name(), ast_sip_session_is_pending_stream_default(), ast_sockaddr_isnull(), ast_str_alloca, ast_sip_endpoint::asymmetric_rtp_codec, ast_sip_session::channel, ast_sip_endpoint_media_configuration::codecs, ast_sip_session_media::direct_media_addr, ast_sip_session::direct_media_cap, ast_sip_session::dsp, DSP_FEATURE_DIGIT_DETECT, ast_sip_session::dtmf, ast_sip_session::endpoint, get_codecs(), LOG_ERROR, LOG_NOTICE, ast_sip_endpoint::media, NULL, ast_sip_endpoint::preferred_codec_only, RAII_VAR, ast_sip_session_media::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, and ast_sip_session_media::type.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 1181 of file res_pjsip_sdp_rtp.c.
References ast_assert, ast_rtp_instance_get_ice(), ast_rtp_engine_ice::change_components, ast_sip_session::endpoint, ast_sip_media_rtp_configuration::ice_support, ast_sip_endpoint::media, NULL, ast_sip_session_media::remote_rtcp_mux, ast_sip_endpoint_media_configuration::rtcp_mux, ast_sip_session_media::rtp, and ast_sip_endpoint_media_configuration::rtp.
Referenced by apply_negotiated_sdp_stream(), create_outgoing_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Definition at line 438 of file res_pjsip_sdp_rtp.c.
References ao2_cleanup, ao2_ref, ast_codec_media_type2str(), ast_format_cap_alloc, ast_format_cap_empty(), AST_FORMAT_CAP_FLAG_DEFAULT, ast_log, AST_RTP_CODECS_NULL_INIT, ast_rtp_codecs_payload_formats(), ast_rtp_codecs_payloads_copy(), ast_rtp_codecs_payloads_destroy(), ast_rtp_codecs_payloads_xover(), ast_rtp_instance_get_codecs(), ast_sip_session_create_joint_call_cap(), ast_sip_session_get_name(), get_codecs(), LOG_ERROR, NULL, ast_sip_session_media::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, and ast_sip_session_media::type.
Referenced by negotiate_incoming_sdp_stream().
|
static |
Definition at line 1023 of file res_pjsip_sdp_rtp.c.
References AST_AES_CM_128_HMAC_SHA1_32, AST_AES_CM_128_HMAC_SHA1_80, ast_log, ast_rtp_instance_get_dtls(), ast_sip_media_rtp_configuration::dtls_cfg, ast_rtp_dtls_cfg::enabled, ast_sip_session::endpoint, LOG_ERROR, ast_sip_endpoint::media, ast_sip_session_media::rtp, ast_sip_endpoint_media_configuration::rtp, ast_rtp_engine_dtls::set_configuration, setup_srtp(), ast_sip_media_rtp_configuration::srtp_tag_32, and ast_rtp_dtls_cfg::suite.
Referenced by add_crypto_to_stream(), and setup_media_encryption().
|
static |
Definition at line 1154 of file res_pjsip_sdp_rtp.c.
References AST_SIP_MEDIA_ENCRYPT_DTLS, AST_SIP_MEDIA_ENCRYPT_NONE, AST_SIP_MEDIA_ENCRYPT_SDES, AST_SIP_MEDIA_TRANSPORT_INVALID, ast_sip_session_media::encryption, parse_dtls_attrib(), setup_dtls_srtp(), and setup_sdes_srtp().
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Definition at line 1118 of file res_pjsip_sdp_rtp.c.
References ast_free, ast_log, ast_sdp_crypto_process(), ast_strndup, LOG_WARNING, NULL, RAII_VAR, ast_sip_session_media::rtp, setup_srtp(), and ast_sip_session_media::srtp.
Referenced by setup_media_encryption().
|
static |
Definition at line 1004 of file res_pjsip_sdp_rtp.c.
References ast_sdp_crypto_alloc(), ast_sdp_srtp_alloc(), ast_sdp_srtp::crypto, and ast_sip_session_media::srtp.
Referenced by setup_dtls_srtp(), and setup_sdes_srtp().
|
static |
Function which destroys the RTP instance when session ends.
Definition at line 2264 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_destroy(), NULL, ast_sip_session_media::rtp, and stream_stop().
|
static |
Function which stops the RTP instance.
Definition at line 2252 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_stop(), AST_SCHED_DEL, ast_sip_session_media::keepalive_sched_id, ast_sip_session_media::rtp, and ast_sip_session_media::timeout_sched_id.
Referenced by stream_destroy().
|
static |
Unloads the sdp RTP/AVP module from Asterisk.
Definition at line 2324 of file res_pjsip_sdp_rtp.c.
References ast_sched_context_destroy(), ast_sip_session_unregister_sdp_handler(), ast_sip_session_unregister_supplement(), STR_AUDIO, and STR_VIDEO.
Referenced by load_module().
|
static |
Definition at line 2295 of file res_pjsip_sdp_rtp.c.
References AST_CONTROL_VIDUPDATE, ast_queue_control(), ast_sip_is_content_type(), ast_sip_session::channel, ast_sip_session::inv_session, and NULL.
|
static |
Definition at line 2390 of file res_pjsip_sdp_rtp.c.
|
static |
Address for RTP.
Definition at line 66 of file res_pjsip_sdp_rtp.c.
Referenced by create_rtp(), and load_module().
|
static |
Definition at line 2390 of file res_pjsip_sdp_rtp.c.
|
static |
SDP handler for 'audio' media stream.
Definition at line 2274 of file res_pjsip_sdp_rtp.c.
|
static |
Scheduler for RTCP purposes.
Definition at line 63 of file res_pjsip_sdp_rtp.c.
|
static |
Definition at line 68 of file res_pjsip_sdp_rtp.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 69 of file res_pjsip_sdp_rtp.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 2318 of file res_pjsip_sdp_rtp.c.
|
static |
SDP handler for 'video' media stream.
Definition at line 2285 of file res_pjsip_sdp_rtp.c.