summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-03-27 20:32:45 +0000
committerJoshua Colp <jcolp@digium.com>2017-03-30 18:26:10 +0000
commitf3290d6b664bd2b6ed840b7501666e26b341acb1 (patch)
tree7a796814363551c54ee07364265102b9a7b47243 /include/asterisk
parent3bdf876b045653c427df0a7a771e90dd15fa1527 (diff)
sdp: Add support for setting connection address and clean up state.
This change cleans up state management for media streams by moving RTP instances into their own session structure and adding additional details that are not relevant to the core (such as connection address). These can live either in the local capabilities or joint capabilities. The ability to set explicit connection address information for the purposes of direct media and NAT has also been added at the global and stream specific level. ASTERISK-26900 Change-Id: If7e5307239a9534420732de11c451a2705b6b681
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/sdp.h10
-rw-r--r--include/asterisk/sdp_options.h20
-rw-r--r--include/asterisk/sdp_state.h86
3 files changed, 91 insertions, 25 deletions
diff --git a/include/asterisk/sdp.h b/include/asterisk/sdp.h
index 4d6d2fbb5..3649b4037 100644
--- a/include/asterisk/sdp.h
+++ b/include/asterisk/sdp.h
@@ -395,20 +395,20 @@ struct ast_sdp_a_line *ast_sdp_get_a(const struct ast_sdp *sdp, int index);
int ast_sdp_add_m(struct ast_sdp *sdp, struct ast_sdp_m_line *m_line);
/*!
- * \brief Add a Media Description to an SDP
+ * \brief Add an RTP Media Description to an SDP
*
* \param sdp SDP
+ * \param sdp_state SDP state information
* \param options SDP Options
- * \param rtp ast_rtp_instance
- * \param stream stream
+ * \param stream_index stream
*
* \retval 0 Success
* \retval non-0 Failure
*
* \since 15
*/
-int ast_sdp_add_m_from_stream(struct ast_sdp *sdp, const struct ast_sdp_options *options,
- struct ast_rtp_instance *rtp, const struct ast_stream *stream);
+int ast_sdp_add_m_from_rtp_stream(struct ast_sdp *sdp, const struct ast_sdp_state *sdp_state,
+ const struct ast_sdp_options *options, int stream_index);
/*!
* \brief Get the count of Media Descriptions on an SDP
diff --git a/include/asterisk/sdp_options.h b/include/asterisk/sdp_options.h
index 3995faf4a..0186eea57 100644
--- a/include/asterisk/sdp_options.h
+++ b/include/asterisk/sdp_options.h
@@ -270,26 +270,6 @@ unsigned int ast_sdp_options_get_g726_non_standard(struct ast_sdp_options *optio
/*!
* \since 15.0.0
- * \brief Set SDP Options locally_held
- *
- * \param options SDP Options
- * \param locally_held
- */
-void ast_sdp_options_set_locally_held(struct ast_sdp_options *options,
- unsigned int locally_held);
-
-/*!
- * \since 15.0.0
- * \brief Get SDP Options locally_held
- *
- * \param options SDP Options
- *
- * \returns locally_held
- */
-unsigned int ast_sdp_options_get_locally_held(struct ast_sdp_options *options);
-
-/*!
- * \since 15.0.0
* \brief Set SDP Options tos_audio
*
* \param options SDP Options
diff --git a/include/asterisk/sdp_state.h b/include/asterisk/sdp_state.h
index e2f13eb61..a186d7eef 100644
--- a/include/asterisk/sdp_state.h
+++ b/include/asterisk/sdp_state.h
@@ -23,6 +23,7 @@
#include "asterisk/sdp_options.h"
struct ast_sdp_state;
+struct ast_sockaddr;
/*!
* \brief Allocate a new SDP state
@@ -51,6 +52,26 @@ struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(const struct ast_sdp_sta
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);
+
+/*!
+ * \brief Get the connection address for a particular stream.
+ *
+ * \param sdp_state
+ * \param stream_index The particular stream to get the connection address of
+ * \param address[out] A place to store the address in
+ *
+ * \retval 0 Success
+ *
+ * \note
+ * Stream numbers correspond to the streams in the topology of the associated channel
+ */
+int ast_sdp_state_get_stream_connection_address(const struct ast_sdp_state *sdp_state,
+ int stream_index, struct ast_sockaddr *address);
+
+/*!
* \brief Get the joint negotiated streams based on local and remote capabilities.
*
* If this is called prior to receiving a remote SDP, then this will just mirror
@@ -149,4 +170,69 @@ int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, void
*/
int ast_sdp_state_reset(struct ast_sdp_state *sdp_state);
+/*!
+ * \brief Update the local stream topology on the SDP state.
+ *
+ * \param sdp_state
+ * \param streams The new stream topology.
+ *
+ * \retval 0 Success
+ *
+ * \since 15
+ */
+int ast_sdp_state_update_local_topology(struct ast_sdp_state *sdp_state, struct ast_stream_topology *streams);
+
+/*!
+ * \brief Set the local address (IP address) to use for connection addresses
+ *
+ * \param sdp_state
+ * \param address The local address
+ *
+ * \note
+ * Passing NULL as an address will unset the explicit local connection address.
+ *
+ * \since 15
+ */
+void ast_sdp_state_set_local_address(struct ast_sdp_state *sdp_state, struct ast_sockaddr *address);
+
+/*!
+ * \brief Set the connection address (IP address and port) to use for a specific stream
+ *
+ * \param sdp_state
+ * \param stream_index The stream to set the connection address for
+ * \param address The connection address
+ *
+ * \retval 0 Success
+ *
+ * \note
+ * Passing NULL as an address will unset the explicit local connection address.
+ *
+ * \since 15
+ */
+int ast_sdp_state_set_connection_address(struct ast_sdp_state *sdp_state, int stream_index,
+ struct ast_sockaddr *address);
+
+/*!
+ * \since 15.0.0
+ * \brief Set a stream to be held or unheld
+ *
+ * \param sdp_state
+ * \param stream_index The stream to set the held value for
+ * \param locally_held
+ */
+void ast_sdp_state_set_locally_held(struct ast_sdp_state *sdp_state,
+ int stream_index, unsigned int locally_held);
+
+/*!
+ * \since 15.0.0
+ * \brief Get whether a stream is held or not
+ *
+ * \param sdp_state
+ * \param stream_index The stream to get the held state for
+ *
+ * \returns locally_held
+ */
+unsigned int ast_sdp_state_get_locally_held(const struct ast_sdp_state *sdp_state,
+ int stream_index);
+
#endif /* _ASTERISK_SDP_STATE_H */