summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/codec.h11
-rw-r--r--include/asterisk/format_cache.h5
-rw-r--r--include/asterisk/rtp_engine.h6
-rw-r--r--include/asterisk/sdp.h99
-rw-r--r--include/asterisk/sdp_options.h133
-rw-r--r--include/asterisk/sdp_state.h23
6 files changed, 255 insertions, 22 deletions
diff --git a/include/asterisk/codec.h b/include/asterisk/codec.h
index 2ae955181..2f5756cd1 100644
--- a/include/asterisk/codec.h
+++ b/include/asterisk/codec.h
@@ -166,6 +166,17 @@ int ast_codec_get_max(void);
const char *ast_codec_media_type2str(enum ast_media_type type);
/*!
+ * \brief Conversion function to take a media string and convert it to a media type
+ *
+ * \param media_type_str The media type string
+ *
+ * \retval The ast_media_type that corresponds to the string
+ *
+ * \since 15.0.0
+ */
+enum ast_media_type ast_media_type_from_str(const char *media_type_str);
+
+/*!
* \brief Get the number of samples contained within a frame
*
* \param frame The frame itself
diff --git a/include/asterisk/format_cache.h b/include/asterisk/format_cache.h
index 6099c59ea..92272e8eb 100644
--- a/include/asterisk/format_cache.h
+++ b/include/asterisk/format_cache.h
@@ -224,6 +224,11 @@ extern struct ast_format *ast_format_t140;
extern struct ast_format *ast_format_t140_red;
/*!
+ * \brief Built-in cached T.38 format.
+ */
+extern struct ast_format *ast_format_t38;
+
+/*!
* \brief Built-in "null" format.
*/
extern struct ast_format *ast_format_none;
diff --git a/include/asterisk/rtp_engine.h b/include/asterisk/rtp_engine.h
index fa7fed8a1..55acf6529 100644
--- a/include/asterisk/rtp_engine.h
+++ b/include/asterisk/rtp_engine.h
@@ -81,6 +81,12 @@ extern "C" {
/*! Maximum number of payload types RTP can support. */
#define AST_RTP_MAX_PT 128
+/*!
+ * Last RTP payload type statically assigned, see
+ * http://www.iana.org/assignments/rtp-parameters
+ */
+#define AST_RTP_PT_LAST_STATIC 34
+
/*! First dynamic RTP payload type */
#define AST_RTP_PT_FIRST_DYNAMIC 96
diff --git a/include/asterisk/sdp.h b/include/asterisk/sdp.h
index 3649b4037..d5bf9147b 100644
--- a/include/asterisk/sdp.h
+++ b/include/asterisk/sdp.h
@@ -147,6 +147,22 @@ struct ast_sdp {
};
/*!
+ * \brief A structure representing an SDP rtpmap attribute
+ */
+struct ast_sdp_rtpmap {
+ /*! The RTP payload number for the rtpmap */
+ int payload;
+ /*! The Name of the codec */
+ char *encoding_name;
+ /*! The clock rate of the codec */
+ int clock_rate;
+ /*! Optional encoding parameters */
+ char *encoding_parameters;
+ /*! Area where strings are stored */
+ char buf[0];
+};
+
+/*!
* \brief Free an SDP Attribute
*
* \param a_line The attribute to free
@@ -545,15 +561,88 @@ struct ast_sdp *ast_sdp_alloc(struct ast_sdp_o_line *o_line,
struct ast_sdp_t_line *t_line);
/*!
- * \brief Create an SDP from an existing SDP State local topology
+ * \brief Find an attribute on the top-level SDP
+ *
+ * \note This will not search within streams for the given attribute.
+ *
+ * \param sdp The SDP in which to search
+ * \param attr_name The name of the attribute to search for
+ * \param payload Optional payload number to search for. If irrelevant, set to -1
+ *
+ * \retval NULL Could not find the given attribute
+ * \retval Non-NULL The attribute to find
+ *
+ * \since 15.0.0
+ */
+struct ast_sdp_a_line *ast_sdp_find_attribute(const struct ast_sdp *sdp,
+ const char *attr_name, int payload);
+
+/*!
+ * \brief Find an attribute on an SDP stream (m-line)
*
- * \param sdp_state SDP State
+ * \param sdp The SDP in which to search
+ * \param attr_name The name of the attribute to search for
+ * \param payload Optional payload number to search for. If irrelevant, set to -1
*
+ * \retval NULL Could not find the given attribute
+ * \retval Non-NULL The attribute to find
+ *
+ * \since 15.0.0
+ */
+struct ast_sdp_a_line *ast_sdp_m_find_attribute(const struct ast_sdp_m_line *m_line,
+ const char *attr_name, int payload);
+
+/*!
+ * \brief Convert an SDP a_line into an rtpmap
+ *
+ * The returned value is heap-allocated and must be freed with
+ * ast_sdp_rtpmap_free()
+ *
+ * \param a_line The SDP a_line to convert
+ *
+ * \retval NULL Fail
* \retval non-NULL Success
- * \retval NULL Failure
*
- * \since 15
+ * \since 15.0.0
*/
-struct ast_sdp *ast_sdp_create_from_state(const struct ast_sdp_state *sdp_state);
+struct ast_sdp_rtpmap *ast_sdp_a_get_rtpmap(const struct ast_sdp_a_line *a_line);
+
+/*!
+ * \brief Allocate a new SDP rtpmap
+ *
+ * \param payload The RTP payload number
+ * \param encoding_name The human-readable name for the codec
+ * \param clock_rate The rate of the codec, in cycles per second
+ * \param encoding_parameters Optional codec-specific parameters (such as number of channels)
+ *
+ * \retval NULL Fail
+ * \retval non-NULL Success
+ *
+ * \since 15.0.0
+ */
+struct ast_sdp_rtpmap *ast_sdp_rtpmap_alloc(int payload, const char *encoding_name,
+ int clock_rate, const char *encoding_parameters);
+
+/*!
+ * \brief Free an SDP rtpmap
+ *
+ * \since 15.0.0
+ */
+void ast_sdp_rtpmap_free(struct ast_sdp_rtpmap *rtpmap);
+
+/*!
+ * \brief Turn an SDP into a stream topology
+ *
+ * This traverses the m-lines of the SDP and creates a stream topology, with
+ * each m-line corresponding to a stream in the created topology.
+ *
+ * \param sdp The SDP to convert
+ *
+ * \retval NULL An error occurred when converting
+ * \retval non-NULL The generated stream topology
+ *
+ * \since 15.0.0
+ */
+struct ast_stream_topology *ast_get_topology_from_sdp(const struct ast_sdp *sdp);
#endif /* _SDP_PRIV_H */
diff --git a/include/asterisk/sdp_options.h b/include/asterisk/sdp_options.h
index 0186eea57..af694cd14 100644
--- a/include/asterisk/sdp_options.h
+++ b/include/asterisk/sdp_options.h
@@ -19,6 +19,8 @@
#ifndef _ASTERISK_SDP_OPTIONS_H
#define _ASTERISK_SDP_OPTIONS_H
+#include "asterisk/udptl.h"
+
struct ast_sdp_options;
/*!
@@ -106,7 +108,7 @@ void ast_sdp_options_set_media_address(struct ast_sdp_options *options,
*
* \returns media_address
*/
-const char *ast_sdp_options_get_media_address(struct ast_sdp_options *options);
+const char *ast_sdp_options_get_media_address(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -126,7 +128,7 @@ void ast_sdp_options_set_sdpowner(struct ast_sdp_options *options,
*
* \returns sdpowner
*/
-const char *ast_sdp_options_get_sdpowner(struct ast_sdp_options *options);
+const char *ast_sdp_options_get_sdpowner(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -146,7 +148,7 @@ void ast_sdp_options_set_sdpsession(struct ast_sdp_options *options,
*
* \returns sdpsession
*/
-const char *ast_sdp_options_get_sdpsession(struct ast_sdp_options *options);
+const char *ast_sdp_options_get_sdpsession(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -166,7 +168,7 @@ void ast_sdp_options_set_rtp_engine(struct ast_sdp_options *options,
*
* \returns rtp_engine
*/
-const char *ast_sdp_options_get_rtp_engine(struct ast_sdp_options *options);
+const char *ast_sdp_options_get_rtp_engine(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -186,7 +188,7 @@ void ast_sdp_options_set_bind_rtp_to_media_address(struct ast_sdp_options *optio
*
* \returns bind_rtp_to_media_address
*/
-unsigned int ast_sdp_options_get_bind_rtp_to_media_address(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_bind_rtp_to_media_address(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -206,7 +208,7 @@ void ast_sdp_options_set_rtp_symmetric(struct ast_sdp_options *options,
*
* \returns rtp_symmetric
*/
-unsigned int ast_sdp_options_get_rtp_symmetric(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_rtp_symmetric(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -226,7 +228,7 @@ void ast_sdp_options_set_telephone_event(struct ast_sdp_options *options,
*
* \returns telephone_event
*/
-unsigned int ast_sdp_options_get_telephone_event(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_telephone_event(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -246,7 +248,7 @@ void ast_sdp_options_set_rtp_ipv6(struct ast_sdp_options *options,
*
* \returns rtp_ipv6
*/
-unsigned int ast_sdp_options_get_rtp_ipv6(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_rtp_ipv6(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -266,7 +268,7 @@ void ast_sdp_options_set_g726_non_standard(struct ast_sdp_options *options,
*
* \returns g726_non_standard
*/
-unsigned int ast_sdp_options_get_g726_non_standard(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_g726_non_standard(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -286,7 +288,7 @@ void ast_sdp_options_set_tos_audio(struct ast_sdp_options *options,
*
* \returns tos_audio
*/
-unsigned int ast_sdp_options_get_tos_audio(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_tos_audio(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -306,7 +308,7 @@ void ast_sdp_options_set_cos_audio(struct ast_sdp_options *options,
*
* \returns cos_audio
*/
-unsigned int ast_sdp_options_get_cos_audio(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_cos_audio(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -326,7 +328,7 @@ void ast_sdp_options_set_tos_video(struct ast_sdp_options *options,
*
* \returns tos_video
*/
-unsigned int ast_sdp_options_get_tos_video(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_tos_video(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -346,7 +348,7 @@ void ast_sdp_options_set_cos_video(struct ast_sdp_options *options,
*
* \returns cos_video
*/
-unsigned int ast_sdp_options_get_cos_video(struct ast_sdp_options *options);
+unsigned int ast_sdp_options_get_cos_video(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -366,7 +368,7 @@ void ast_sdp_options_set_ice(struct ast_sdp_options *options,
*
* \returns ice
*/
-enum ast_sdp_options_ice ast_sdp_options_get_ice(struct ast_sdp_options *options);
+enum ast_sdp_options_ice ast_sdp_options_get_ice(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -386,7 +388,7 @@ void ast_sdp_options_set_impl(struct ast_sdp_options *options,
*
* \returns impl
*/
-enum ast_sdp_options_impl ast_sdp_options_get_impl(struct ast_sdp_options *options);
+enum ast_sdp_options_impl ast_sdp_options_get_impl(const struct ast_sdp_options *options);
/*!
* \since 15.0.0
@@ -406,6 +408,105 @@ void ast_sdp_options_set_encryption(struct ast_sdp_options *options,
*
* \returns encryption
*/
-enum ast_sdp_options_encryption ast_sdp_options_get_encryption(struct ast_sdp_options *options);
+enum ast_sdp_options_encryption ast_sdp_options_get_encryption(const struct ast_sdp_options *options);
+
+/*!
+ * \since 15.0.0
+ * \brief Get SDP Options RTCP MUX
+ *
+ * \param options SDP Options
+ *
+ * \returns Boolean indicating if RTCP MUX is enabled.
+ */
+unsigned int ast_sdp_options_get_rtcp_mux(const struct ast_sdp_options *options);
+
+/*!
+ * \since 15.0.0
+ * \brief Set SDP Options RTCP MUX
+ *
+ * \param options SDP Options
+ * \param value Boolean that indicates if RTCP MUX should be enabled.
+ */
+void ast_sdp_options_set_rtcp_mux(struct ast_sdp_options *options, unsigned int value);
+
+/*!
+ * \since 15.0.0
+ * \brief Set SDP Options udptl_symmetric
+ *
+ * \param options SDP Options
+ * \param udptl_symmetric
+ */
+void ast_sdp_options_set_udptl_symmetric(struct ast_sdp_options *options,
+ unsigned int udptl_symmetric);
+
+/*!
+ * \since 15.0.0
+ * \brief Get SDP Options udptl_symmetric
+ *
+ * \param options SDP Options
+ *
+ * \returns udptl_symmetric
+ */
+unsigned int ast_sdp_options_get_udptl_symmetric(const struct ast_sdp_options *options);
+
+/*!
+ * \since 15.0.0
+ * \brief Set SDP Options udptl_error_correction
+ *
+ * \param options SDP Options
+ * \param error_correction
+ */
+void ast_sdp_options_set_udptl_error_correction(struct ast_sdp_options *options,
+ enum ast_t38_ec_modes error_correction);
+
+/*!
+ * \since 15.0.0
+ * \brief Get SDP Options udptl_error_correction
+ *
+ * \param options SDP Options
+ *
+ * \returns udptl_error_correction
+ */
+enum ast_t38_ec_modes ast_sdp_options_get_udptl_error_correction(const struct ast_sdp_options *options);
+
+/*!
+ * \since 15.0.0
+ * \brief Set SDP Options udptl_far_max_datagram
+ *
+ * \param options SDP Options
+ * \param far_max_datagram
+ */
+void ast_sdp_options_set_udptl_far_max_datagram(struct ast_sdp_options *options,
+ unsigned int far_max_datagram);
+
+/*!
+ * \since 15.0.0
+ * \brief Get SDP Options udptl_far_max_datagram
+ *
+ * \param options SDP Options
+ *
+ * \returns udptl_far_max_datagram
+ */
+unsigned int ast_sdp_options_get_udptl_far_max_datagram(const struct ast_sdp_options *options);
+
+/*!
+ * \since 15.0.0
+ * \brief Set SDP Options bind_udptl_to_media_address
+ *
+ * \param options SDP Options
+ * \param bind_udptl_to_media_address
+ */
+void ast_sdp_options_set_bind_udptl_to_media_address(struct ast_sdp_options *options,
+ unsigned int bind_udptl_to_media_address);
+
+/*!
+ * \since 15.0.0
+ * \brief Get SDP Options bind_udptl_to_media_address
+ *
+ * \param options SDP Options
+ *
+ * \returns bind_udptl_to_media_address
+ */
+unsigned int ast_sdp_options_get_bind_udptl_to_media_address(const struct ast_sdp_options *options);
#endif /* _ASTERISK_SDP_OPTIONS_H */
diff --git a/include/asterisk/sdp_state.h b/include/asterisk/sdp_state.h
index a186d7eef..1382ed6af 100644
--- a/include/asterisk/sdp_state.h
+++ b/include/asterisk/sdp_state.h
@@ -24,6 +24,8 @@
struct ast_sdp_state;
struct ast_sockaddr;
+struct ast_udptl;
+struct ast_control_t38_parameters;
/*!
* \brief Allocate a new SDP state
@@ -52,6 +54,14 @@ struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(const struct ast_sdp_sta
int stream_index);
/*!
+ * \brief Get the associated UDPTL instance for a particular stream on the SDP state.
+ *
+ * Stream numbers correspond to the streams in the topology of the associated channel
+ */
+struct ast_udptl *ast_sdp_state_get_udptl_instance(const struct ast_sdp_state *sdp_state,
+ int stream_index);
+
+/*!
* \brief Get the global connection address on the SDP state.
*/
const struct ast_sockaddr *ast_sdp_state_get_connection_address(const struct ast_sdp_state *sdp_state);
@@ -138,7 +148,7 @@ const void *ast_sdp_state_get_local_sdp_impl(struct ast_sdp_state *sdp_state);
*
* \since 15
*/
-void ast_sdp_state_set_remote_sdp(struct ast_sdp_state *sdp_state, struct ast_sdp *sdp);
+void ast_sdp_state_set_remote_sdp(struct ast_sdp_state *sdp_state, const struct ast_sdp *sdp);
/*!
* \brief Set the remote SDP from an Implementation
@@ -225,6 +235,17 @@ void ast_sdp_state_set_locally_held(struct ast_sdp_state *sdp_state,
/*!
* \since 15.0.0
+ * \brief Set the UDPTL session parameters
+ *
+ * \param sdp_state
+ * \param stream_index The stream to set the UDPTL session parameters for
+ * \param params
+ */
+void ast_sdp_state_set_t38_parameters(struct ast_sdp_state *sdp_state,
+ int stream_index, struct ast_control_t38_parameters *params);
+
+/*!
+ * \since 15.0.0
* \brief Get whether a stream is held or not
*
* \param sdp_state