Asterisk - The Open Source Telephony Project GIT-master-0bf3178
|
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 pjmedia_sdp_attr * | generate_rtpmap_attr2 (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, int sample_rate) |
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, struct ast_format_cap *astformats) |
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 void | set_session_media_remotely_held (struct ast_sip_session_media *session_media, const struct ast_sip_session *session, const pjmedia_sdp_media *media, const struct ast_stream *stream, const struct ast_sockaddr *addrs) |
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 = AST_BUILDOPT_SUM, .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 2549 of file res_pjsip_sdp_rtp.c.
|
static |
Definition at line 2549 of file res_pjsip_sdp_rtp.c.
|
static |
Definition at line 1648 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_SIP_SECURITY_NEG_MEDIASEC, ast_str_buffer(), ast_str_create, ast_str_set(), ast_sip_session_media::encryption, 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, RAII_VAR, ast_sip_session_media::rtp, ast_sdp_srtp::sdp_srtp_list, session, setup_dtls_srtp(), ast_sip_session_media::srtp, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 1412 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_media::rtp, session, and ast_sip_session_media::type.
Referenced by create_outgoing_sdp_stream().
|
static |
Function which adds ICE attributes to a media stream.
Definition at line 733 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_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_rtp_engine_ice_candidate::id, ast_rtp_engine_ice_candidate::priority, ast_rtp_engine_ice_candidate::relay_address, ast_sip_session_media::remote_ice, ast_sip_session_media::rtp, session, 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 1330 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_media::label, ast_sip_session_media::mslabel, and session.
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 1377 of file res_pjsip_sdp_rtp.c.
References AST_MEDIA_TYPE_VIDEO, session, and ast_sip_session_media::type.
Referenced by create_outgoing_sdp_stream().
|
static |
Function which adds ssrc attributes to a media stream.
Definition at line 1260 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_get_cname(), ast_rtp_instance_get_ssrc(), ast_sip_session_media::bundle_group, ast_sip_session_media::rtp, session, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 428 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, and ast_sip_session_media::rtp.
Referenced by negotiate_incoming_sdp_stream(), and set_caps().
|
static |
Definition at line 1108 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 2216 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_MEDIA_TYPE_VIDEO, 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, check_endpoint_media_transport(), create_rtp(), enable_rtcp(), ast_sip_session_media::encryption, ast_sip_session_media::keepalive_sched_id, ast_sip_session_media::locally_held, media_session_rtcp_read_callback(), media_session_rtp_read_callback(), media_session_rtp_write_callback(), 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_session_media::rtp, rtp_check_timeout(), SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, send_keepalive(), session, set_caps(), set_ice_components(), set_session_media_remotely_held(), setup_media_encryption(), ast_sip_session_media::timeout_sched_id, and ast_sip_session_media::type.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 2549 of file res_pjsip_sdp_rtp.c.
|
static |
Function which updates the media stream with external media address, if applicable.
Definition at line 2386 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(), PARSE_PORT_FORBID, RAII_VAR, and ast_sip_session_media::transport.
|
static |
Checks whether the encryption offered in SDP is compatible with the endpoint's configuration.
Definition at line 1028 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 808 of file res_pjsip_sdp_rtp.c.
References ast_rtp_instance_get_ice(), ast_sip_session_media::remote_ice, ast_sip_session_media::rtp, and session.
Referenced by negotiate_incoming_sdp_stream().
|
static |
Function which creates an outgoing stream.
Definition at line 1778 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(), 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_code_sample_rate(), 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_lookup_sample_rate2(), 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_sorcery_object_get_id(), 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, AST_VECTOR_APPEND, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_INIT, AST_VECTOR_SIZE, ast_sip_session_media::bundle_group, ast_sip_session_media::bundled, create_rtp(), DEFAULT_DTMF_SAMPLE_RATE_MS, ast_sip_session_media::direct_media_addr, enable_rtcp(), ast_sip_session_media::encryption, generate_fmtp_attr(), generate_rtpmap_attr(), generate_rtpmap_attr2(), ast_sip_session_media::locally_held, LOG_ERROR, LOG_WARNING, NULL, RAII_VAR, ast_sip_session_media::remote_rtcp_mux, ast_sip_session_media::remotely_held, ast_sip_session_media::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, set_ice_components(), ast_sip_session_media::stream_num, tmp(), ast_sip_session_media::transport, and ast_sip_session_media::type.
|
static |
Internal function which creates an RTP instance.
Definition at line 225 of file res_pjsip_sdp_rtp.c.
References 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(), enable_rtp_extension(), ast_sip_transport_state::host, LOG_ERROR, NULL, ast_sip_session_media::rtp, session, ast_rtp_engine_ice::stop, ast_sip_transport_state::transport, and ast_sip_session_media::type.
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 162 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_media::remote_rtcp_mux, ast_sip_session_media::rtp, and session.
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 179 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_media::rtp, and session.
Referenced by create_rtp().
|
static |
Definition at line 707 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 636 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, NULL, options, session, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 672 of file res_pjsip_sdp_rtp.c.
References ast_rtp_lookup_mime_subtype2(), AST_RTP_OPT_G726_NONSTANDARD, AST_RTP_PT_LAST_STATIC, NULL, options, session, and tmp().
Referenced by create_outgoing_sdp_stream().
|
static |
Definition at line 312 of file res_pjsip_sdp_rtp.c.
References ao2_ref, ast_copy_pj_str(), ast_format_cap_append, ast_format_cap_remove_by_type(), ast_format_cap_set_framing(), ast_format_parse_sdp_fmtp(), AST_MEDIA_TYPE_UNKNOWN, 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_codecs_set_preferred_dtmf_format(), 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(), codecs, name, NULL, options, ast_sip_session_media::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN, and session.
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 996 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(), RAII_VAR, and ast_rtp_engine_ice_candidate::transport.
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 2506 of file res_pjsip_sdp_rtp.c.
References address_rtp, ast_check_ipv6(), ast_log, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_sched_context_create(), ast_sched_start_thread(), ast_sip_session_register_sdp_handler(), ast_sip_session_register_supplement, ast_sockaddr_parse(), audio_sdp_handler, end, LOG_ERROR, STR_AUDIO, STR_VIDEO, unload_module(), video_info_supplement, and video_sdp_handler.
|
static |
Definition at line 2189 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 2171 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 2207 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 976 of file res_pjsip_sdp_rtp.c.
Referenced by get_media_encryption_type().
|
static |
Function which negotiates an incoming media stream.
Definition at line 1543 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_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_media_get_transport(), ast_sockaddr_resolve(), ast_sip_session_media::bundled, check_endpoint_media_transport(), check_ice_support(), create_rtp(), enable_rtcp(), ast_sip_session_media::encryption, 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::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, set_ice_components(), set_incoming_call_offer_cap(), set_session_media_remotely_held(), setup_media_encryption(), ast_sip_session_media::transport, and ast_sip_session_media::type.
|
static |
Definition at line 1157 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 1462 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(), id, ast_sip_session_media::rtp, session, and ast_sip_session_media::type.
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Function which processes ICE attributes in an audio stream.
Definition at line 872 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_rtp_engine_ice_candidate::foundation, ast_rtp_engine_ice::ice_lite, ast_rtp_engine_ice_candidate::id, 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_session_media::rtp, session, 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 834 of file res_pjsip_sdp_rtp.c.
References ast_copy_pj_str(), ast_rtp_instance_get_ice(), NULL, ast_sip_session_media::rtp, session, 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 1276 of file res_pjsip_sdp_rtp.c.
References ast_copy_pj_str(), ast_rtp_instance_get_stats(), ast_rtp_instance_set_remote_ssrc(), AST_RTP_INSTANCE_STAT_REMOTE_SSRC, ast_sip_session_media::changed, NULL, ast_rtp_instance_stats::remote_ssrc, ast_sip_session_media::rtp, and session.
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_log, ast_rtp_instance_get_channel_id(), ast_rtp_instance_get_last_rx(), ast_rtp_instance_get_timeout(), ast_rtp_instance_set_last_rx(), ast_sockaddr_isnull(), ast_softhangup(), AST_SOFTHANGUP_DEV, AST_STATE_UP, ast_sip_session_media::direct_media_addr, LOG_NOTICE, NULL, ast_sip_session_media::rtp, 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, ast_rtp_instance::keepalive, NULL, ast_sip_session_media::rtp, and send_keepalive().
Referenced by apply_negotiated_sdp_stream(), and send_keepalive().
|
static |
Definition at line 504 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_payloads_copy(), ast_rtp_codecs_payloads_destroy(), ast_rtp_codecs_payloads_xover(), ast_rtp_codecs_set_preferred_format(), 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, codecs, ast_sip_session_media::direct_media_addr, get_codecs(), LOG_ERROR, LOG_NOTICE, NULL, RAII_VAR, ast_sip_session_media::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, and ast_sip_session_media::type.
Referenced by apply_negotiated_sdp_stream().
|
static |
Definition at line 1239 of file res_pjsip_sdp_rtp.c.
References ast_assert, ast_rtp_instance_get_ice(), ast_rtp_engine_ice::change_components, NULL, ast_sip_session_media::remote_rtcp_mux, ast_sip_session_media::rtp, and session.
Referenced by apply_negotiated_sdp_stream(), create_outgoing_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Definition at line 459 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_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(), codecs, get_codecs(), LOG_ERROR, NULL, ast_sip_session_media::rtp, SCOPE_ENTER, SCOPE_EXIT_RTN_VALUE, session, and ast_sip_session_media::type.
Referenced by negotiate_incoming_sdp_stream().
|
static |
Definition at line 1519 of file res_pjsip_sdp_rtp.c.
References AST_MEDIA_TYPE_AUDIO, ast_sip_session_is_pending_stream_default(), ast_sockaddr_is_any(), ast_sockaddr_isnull(), NULL, ast_sip_session_media::remotely_held, ast_sip_session_media::remotely_held_changed, session, and ast_sip_session_media::type.
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Definition at line 1081 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(), LOG_ERROR, ast_sip_session_media::rtp, session, ast_rtp_engine_dtls::set_configuration, and setup_srtp().
Referenced by add_crypto_to_stream(), and setup_media_encryption().
|
static |
Definition at line 1212 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(), session, setup_dtls_srtp(), and setup_sdes_srtp().
Referenced by apply_negotiated_sdp_stream(), and negotiate_incoming_sdp_stream().
|
static |
Definition at line 1176 of file res_pjsip_sdp_rtp.c.
References ast_debug, ast_free, ast_sdp_crypto_process(), ast_strndup, 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 1062 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 2424 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 2412 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 2483 of file res_pjsip_sdp_rtp.c.
References ast_sched_context_destroy(), ast_sip_session_unregister_sdp_handler(), ast_sip_session_unregister_supplement(), audio_sdp_handler, STR_AUDIO, STR_VIDEO, video_info_supplement, and video_sdp_handler.
Referenced by load_module().
|
static |
Definition at line 2455 of file res_pjsip_sdp_rtp.c.
References AST_CONTROL_VIDUPDATE, ast_queue_control(), ast_sip_are_media_types_equal(), NULL, pjsip_media_type_application_media_control_xml, and session.
|
static |
Definition at line 2549 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 2549 of file res_pjsip_sdp_rtp.c.
|
static |
SDP handler for 'audio' media stream.
Definition at line 2434 of file res_pjsip_sdp_rtp.c.
Referenced by load_module(), and unload_module().
|
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 2477 of file res_pjsip_sdp_rtp.c.
Referenced by load_module(), and unload_module().
|
static |
SDP handler for 'video' media stream.
Definition at line 2445 of file res_pjsip_sdp_rtp.c.
Referenced by load_module(), and unload_module().