mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-29 18:19:30 +00:00
RFC sdp: Initial SDP creation
* Added additional fields to ast_sdp_options. * Re-organized ast_sdp. * Updated field names to correspond to RFC4566 terminology. * Created allocs/frees for SDP children. * Created getters/setters for SDP children where appropriate. * Added ast_sdp_create_from_state. * Refactored res_sdp_translator_pjmedia for changes. Change-Id: Iefbd877af7f5a4d3c74deead1bff8802661b0d48
This commit is contained in:
@@ -1432,7 +1432,8 @@ unsigned int ast_rtp_codecs_get_framing(struct ast_rtp_codecs *codecs);
|
||||
*
|
||||
* \since 1.8
|
||||
*/
|
||||
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format, struct ast_format *format, int code);
|
||||
unsigned int ast_rtp_lookup_sample_rate2(int asterisk_format,
|
||||
const struct ast_format *format, int code);
|
||||
|
||||
/*!
|
||||
* \brief Retrieve all formats that were found
|
||||
@@ -1537,7 +1538,8 @@ int ast_rtp_codecs_find_payload_code(struct ast_rtp_codecs *codecs, int payload)
|
||||
*
|
||||
* \since 1.8
|
||||
*/
|
||||
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format, struct ast_format *format, int code, enum ast_rtp_options options);
|
||||
const char *ast_rtp_lookup_mime_subtype2(const int asterisk_format,
|
||||
const struct ast_format *format, int code, enum ast_rtp_options options);
|
||||
|
||||
/*!
|
||||
* \brief Convert formats into a string and put them into a buffer
|
||||
|
559
include/asterisk/sdp.h
Normal file
559
include/asterisk/sdp.h
Normal file
@@ -0,0 +1,559 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 2017, Digium, Inc.
|
||||
*
|
||||
* Mark Michelson <mmichelson@digium.com>
|
||||
*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2. See the LICENSE file
|
||||
* at the top of the source tree.
|
||||
*/
|
||||
|
||||
/* NOTE: It is unlikely that you need to include this file. You probably will only need
|
||||
* this if you are an SDP translator, or if you are an inner part of the SDP API
|
||||
*/
|
||||
|
||||
#ifndef _SDP_PRIV_H
|
||||
#define _SDP_PRIV_H
|
||||
|
||||
#include "asterisk/vector.h"
|
||||
#include "asterisk/format.h"
|
||||
#include "asterisk/sdp_state.h"
|
||||
#include "asterisk/stream.h"
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP Attribute
|
||||
*/
|
||||
struct ast_sdp_a_line {
|
||||
/*! Attribute name */
|
||||
char *name;
|
||||
/*! Attribute value. For attributes that have no value, this will be an empty string */
|
||||
char *value;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief A collection of SDP Attributes
|
||||
*/
|
||||
AST_VECTOR(ast_sdp_a_lines, struct ast_sdp_a_line *);
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP Connection
|
||||
*/
|
||||
struct ast_sdp_c_line {
|
||||
/* IP family string (e.g. IP4 or IP6) */
|
||||
char *address_type;
|
||||
/* Connection address. Can be an IP address or FQDN */
|
||||
char *address;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Structre representing SDP Media Payloads
|
||||
*/
|
||||
struct ast_sdp_payload {
|
||||
/* Media format description */
|
||||
char *fmt;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief A collection of SDP Media Payloads
|
||||
*/
|
||||
AST_VECTOR(ast_sdp_payloads, struct ast_sdp_payload *);
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP Media Stream
|
||||
*
|
||||
* This contains both the m line, as well as its
|
||||
* constituent a lines.
|
||||
*/
|
||||
struct ast_sdp_m_line {
|
||||
/*! Media type (e.g. "audio" or "video") */
|
||||
char *type;
|
||||
/*! RTP profile string (e.g. "RTP/AVP") */
|
||||
char *proto;
|
||||
/*! Port number in m line */
|
||||
uint16_t port;
|
||||
/*! Number of ports specified in m line */
|
||||
uint16_t port_count;
|
||||
/*! RTP payloads */
|
||||
struct ast_sdp_payloads *payloads;
|
||||
/*! Connection information for this media stream */
|
||||
struct ast_sdp_c_line *c_line;
|
||||
/*! The attributes for this media stream */
|
||||
struct ast_sdp_a_lines *a_lines;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief A collection of SDP Media Streams
|
||||
*/
|
||||
AST_VECTOR(ast_sdp_m_lines, struct ast_sdp_m_line *);
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP Origin
|
||||
*/
|
||||
struct ast_sdp_o_line {
|
||||
/*! Origin user name */
|
||||
char *username;
|
||||
/*! Origin id */
|
||||
uint64_t session_id;
|
||||
/*! Origin version */
|
||||
uint64_t session_version;
|
||||
/*! Origin IP address type (e.g. "IP4" or "IP6") */
|
||||
char *address_type;
|
||||
/*! Origin address. Can be an IP address or FQDN */
|
||||
char *address;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP Session Name
|
||||
*/
|
||||
struct ast_sdp_s_line {
|
||||
/* Session Name */
|
||||
char *session_name;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Structure representing SDP Timing
|
||||
*/
|
||||
struct ast_sdp_t_line {
|
||||
/*! Session start time */
|
||||
uint64_t start_time;
|
||||
/*! Session end time */
|
||||
uint64_t stop_time;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief An SDP
|
||||
*/
|
||||
struct ast_sdp {
|
||||
/*! SDP Origin line */
|
||||
struct ast_sdp_o_line *o_line;
|
||||
/*! SDP Session name */
|
||||
struct ast_sdp_s_line *s_line;
|
||||
/*! SDP top-level connection information */
|
||||
struct ast_sdp_c_line *c_line;
|
||||
/*! SDP timing information */
|
||||
struct ast_sdp_t_line *t_line;
|
||||
/*! SDP top-level attributes */
|
||||
struct ast_sdp_a_lines *a_lines;
|
||||
/*! SDP media streams */
|
||||
struct ast_sdp_m_lines *m_lines;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Attribute
|
||||
*
|
||||
* \param a_line The attribute to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_a_free(struct ast_sdp_a_line *a_line);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Attribute collection
|
||||
*
|
||||
* \param a_lines The attribute collection to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_a_lines_free(struct ast_sdp_a_lines *a_lines);
|
||||
|
||||
/*!
|
||||
* \brief Free SDP Connection Data
|
||||
*
|
||||
* \param c_line The connection data to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_c_free(struct ast_sdp_c_line *c_line);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Media Description Payload
|
||||
*
|
||||
* \param payload The payload to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_payload_free(struct ast_sdp_payload *payload);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Media Description Payload collection
|
||||
*
|
||||
* \param payloads collection to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_payloads_free(struct ast_sdp_payloads *payloads);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Media Description
|
||||
* Frees the media description and all resources it contains
|
||||
*
|
||||
* \param m_line The media description to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_m_free(struct ast_sdp_m_line *m_line);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Media Description collection
|
||||
*
|
||||
* \param m_lines The collection description to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_m_lines_free(struct ast_sdp_m_lines *m_lines);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Origin
|
||||
*
|
||||
* \param o_line The origin description to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_o_free(struct ast_sdp_o_line *o_line);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP Session
|
||||
*
|
||||
* \param s_line The session to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_s_free(struct ast_sdp_s_line *s_line);
|
||||
|
||||
/*!
|
||||
* \brief Free SDP Timing
|
||||
*
|
||||
* \param t_line The timing description to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_t_free(struct ast_sdp_t_line *t_line);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP
|
||||
* Frees the sdp and all resources it contains
|
||||
*
|
||||
* \param sdp The sdp to free
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_free(struct ast_sdp *sdp);
|
||||
|
||||
/*!
|
||||
* \brief Allocate an SDP Attribute
|
||||
*
|
||||
* \param name Attribute Name
|
||||
* \param value Attribute Name
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_a_line *ast_sdp_a_alloc(const char *name, const char *value);
|
||||
|
||||
/*!
|
||||
* \brief Allocate an SDP Connection
|
||||
*
|
||||
* \param family Family ("IN", etc)
|
||||
* \param addr Address
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_c_line *ast_sdp_c_alloc(const char *family, const char *addr);
|
||||
|
||||
/*!
|
||||
* \brief Allocate an SDP Media Description Payload
|
||||
*
|
||||
* \param fmt The media format description
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_payload *ast_sdp_payload_alloc(const char *fmt);
|
||||
|
||||
/*!
|
||||
* \brief Allocate an SDP Media Description
|
||||
*
|
||||
* \param type ("audio", "video", etc)
|
||||
* \param port Starting port
|
||||
* \param port_count Port pairs to allocate
|
||||
* \param proto ("RTP/AVP", "RTP/SAVP", "udp")
|
||||
* \param c_line Connection to add. May be NULL
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_m_line *ast_sdp_m_alloc(const char *type, uint16_t port,
|
||||
uint16_t port_count, const char *proto, struct ast_sdp_c_line *c_line);
|
||||
|
||||
/*!
|
||||
* \brief Allocate an SDP Session
|
||||
*
|
||||
* \param session_name The session name
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_s_line *ast_sdp_s_alloc(const char *session_name);
|
||||
|
||||
/*!
|
||||
* \brief Allocate SDP Timing
|
||||
*
|
||||
* \param start_time (Seconds since 1900)
|
||||
* \param end_time (Seconds since 1900)
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_t_line *ast_sdp_t_alloc(uint64_t start_time, uint64_t stop_time);
|
||||
|
||||
/*!
|
||||
* \brief Allocate an SDP Origin
|
||||
*
|
||||
* \param username User name
|
||||
* \param sesison_id Session ID
|
||||
* \param sesison_version Session Version
|
||||
* \param address_type Address type ("IN4", "IN6", etc)
|
||||
* \param address Unicast address
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_o_line *ast_sdp_o_alloc(const char *username, uint64_t session_id,
|
||||
uint64_t session_version, const char *address_type, const char *address);
|
||||
|
||||
/*!
|
||||
* \brief Add an SDP Attribute to an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
* \param a_line Attribute
|
||||
*
|
||||
* \retval 0 Success
|
||||
* \retval non-0 Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_add_a(struct ast_sdp *sdp, struct ast_sdp_a_line *a_line);
|
||||
|
||||
/*!
|
||||
* \brief Get the count of Attributes on an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
*
|
||||
* \returns Number of Attributes
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_get_a_count(const struct ast_sdp *sdp);
|
||||
|
||||
/*!
|
||||
* \brief Get an Attribute from an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
* \param index Attribute index
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_a_line *ast_sdp_get_a(const struct ast_sdp *sdp, int index);
|
||||
|
||||
/*!
|
||||
* \brief Add a Media Description to an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
* \param m_line Media Description
|
||||
*
|
||||
* \retval 0 Success
|
||||
* \retval non-0 Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_add_m(struct ast_sdp *sdp, struct ast_sdp_m_line *m_line);
|
||||
|
||||
/*!
|
||||
* \brief Add a Media Description to an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
* \param options SDP Options
|
||||
* \param rtp ast_rtp_instance
|
||||
* \param stream 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);
|
||||
|
||||
/*!
|
||||
* \brief Get the count of Media Descriptions on an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
*
|
||||
* \returns The number of Media Descriptions
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_get_m_count(const struct ast_sdp *sdp);
|
||||
|
||||
/*!
|
||||
* \brief Get a Media Descriptions from an SDP
|
||||
*
|
||||
* \param sdp SDP
|
||||
* \param index Media Description index
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_m_line *ast_sdp_get_m(const struct ast_sdp *sdp, int index);
|
||||
|
||||
/*!
|
||||
* \brief Add an SDP Attribute to a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
* \param a_line Attribute
|
||||
*
|
||||
* \retval 0 Success
|
||||
* \retval non-0 Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_m_add_a(struct ast_sdp_m_line *m_line, struct ast_sdp_a_line *a_line);
|
||||
|
||||
/*!
|
||||
* \brief Get the count of Attributes on a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
*
|
||||
* \returns Number of Attributes
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_m_get_a_count(const struct ast_sdp_m_line *m_line);
|
||||
|
||||
/*!
|
||||
* \brief Get an Attribute from a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
* \param index Attribute index
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_a_line *ast_sdp_m_get_a(const struct ast_sdp_m_line *m_line, int index);
|
||||
|
||||
/*!
|
||||
* \brief Add a Payload to a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
* \param payload Payload
|
||||
*
|
||||
* \retval 0 Success
|
||||
* \retval non-0 Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_m_add_payload(struct ast_sdp_m_line *m_line,
|
||||
struct ast_sdp_payload *payload);
|
||||
|
||||
/*!
|
||||
* \brief Get the count of Payloads on a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
*
|
||||
* \returns Number of Attributes
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_m_get_payload_count(const struct ast_sdp_m_line *m_line);
|
||||
|
||||
/*!
|
||||
* \brief Get a Payload from a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
* \param index Payload index
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp_payload *ast_sdp_m_get_payload(const struct ast_sdp_m_line *m_line, int index);
|
||||
|
||||
/*!
|
||||
* \brief Add a Format to a Media Description
|
||||
*
|
||||
* \param m_line Media Description
|
||||
* \param options SDP Options
|
||||
* \param rtp_code rtp_code from ast_rtp_codecs_payload_code
|
||||
* \param asterisk_format True if the value in format is to be used.
|
||||
* \param format Format
|
||||
* \param code from AST_RTP list
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_m_add_format(struct ast_sdp_m_line *m_line, const struct ast_sdp_options *options,
|
||||
int rtp_code, int asterisk_format, const struct ast_format *format, int code);
|
||||
|
||||
/*!
|
||||
* \brief Create an SDP
|
||||
*
|
||||
* \param o_line Origin
|
||||
* \param c_line Connection
|
||||
* \param s_line Session
|
||||
* \param t_line Timing
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp *ast_sdp_alloc(struct ast_sdp_o_line *o_line,
|
||||
struct ast_sdp_c_line *c_line, struct ast_sdp_s_line *s_line,
|
||||
struct ast_sdp_t_line *t_line);
|
||||
|
||||
/*!
|
||||
* \brief Create an SDP from an existing SDP State local topology
|
||||
*
|
||||
* \param sdp_state SDP State
|
||||
*
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_sdp *ast_sdp_create_from_state(const struct ast_sdp_state *sdp_state);
|
||||
|
||||
#endif /* _SDP_PRIV_H */
|
@@ -21,6 +21,48 @@
|
||||
|
||||
struct ast_sdp_options;
|
||||
|
||||
/*!
|
||||
* \brief ICE options
|
||||
*
|
||||
* This is an enum because it will support a TRICKLE-ICE option
|
||||
* in the future.
|
||||
*/
|
||||
enum ast_sdp_options_ice {
|
||||
/*! ICE is not enabled on this session */
|
||||
AST_SDP_ICE_DISABLED,
|
||||
/*! Standard ICE is enabled on this session */
|
||||
AST_SDP_ICE_ENABLED_STANDARD,
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Implementation of the SDP
|
||||
*
|
||||
* Users of the SDP API set the implementation based on what they
|
||||
* natively handle. This indicates the type of SDP that the API expects
|
||||
* when being given an SDP, and it indicates the type of SDP that the API
|
||||
* returns when asked for one.
|
||||
*/
|
||||
enum ast_sdp_options_impl {
|
||||
/*! SDP is represented as a string */
|
||||
AST_SDP_IMPL_STRING,
|
||||
/*! SDP is represented as a pjmedia_sdp_session */
|
||||
AST_SDP_IMPL_PJMEDIA,
|
||||
/*! End of the list */
|
||||
AST_SDP_IMPL_END,
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief SDP encryption options
|
||||
*/
|
||||
enum ast_sdp_options_encryption {
|
||||
/*! No encryption */
|
||||
AST_SDP_ENCRYPTION_DISABLED,
|
||||
/*! SRTP SDES encryption */
|
||||
AST_SDP_ENCRYPTION_SRTP_SDES,
|
||||
/*! DTLS encryption */
|
||||
AST_SDP_ENCRYPTION_DTLS,
|
||||
};
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Allocate a new SDP options structure.
|
||||
@@ -47,111 +89,343 @@ struct ast_sdp_options *ast_sdp_options_alloc(void);
|
||||
void ast_sdp_options_free(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \brief ICE options
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options media_address
|
||||
*
|
||||
* This is an enum because it is predicted that this eventually
|
||||
* support a TRICKLE-ICE option.
|
||||
* \param options SDP Options
|
||||
* \param media_address
|
||||
*/
|
||||
enum ast_sdp_options_ice {
|
||||
/*! ICE is not enabled on this session */
|
||||
AST_SDP_ICE_DISABLED,
|
||||
/*! Standard ICE is enabled on this session */
|
||||
AST_SDP_ICE_ENABLED_STANDARD,
|
||||
};
|
||||
void ast_sdp_options_set_media_address(struct ast_sdp_options *options,
|
||||
const char *media_address);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set ICE options
|
||||
* \brief Get SDP Options media_address
|
||||
*
|
||||
* The default is AST_SDP_ICE_DISABLED
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns media_address
|
||||
*/
|
||||
int ast_sdp_options_set_ice(struct ast_sdp_options *options,
|
||||
enum ast_sdp_options_ice ice_setting);
|
||||
const char *ast_sdp_options_get_media_address(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Retrieve ICE options
|
||||
* \brief Set SDP Options sdpowner
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param sdpowner
|
||||
*/
|
||||
enum ast_sdp_options_ice ast_sdp_options_get_ice(const struct ast_sdp_options *options);
|
||||
void ast_sdp_options_set_sdpowner(struct ast_sdp_options *options,
|
||||
const char *sdpowner);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Enable or disable telephone events.
|
||||
* \brief Get SDP Options sdpowner
|
||||
*
|
||||
* A non-zero value indicates telephone events are enabled.
|
||||
* A zero value indicates telephone events are disabled.
|
||||
* \param options SDP Options
|
||||
*
|
||||
* The default is 0
|
||||
* \returns sdpowner
|
||||
*/
|
||||
int ast_sdp_options_set_telephone_event(struct ast_sdp_options *options,
|
||||
int telephone_event_enabled);
|
||||
const char *ast_sdp_options_get_sdpowner(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Retrieve telephone event setting.
|
||||
* \brief Set SDP Options sdpsession
|
||||
*
|
||||
* \retval 0 Telephone events are currently disabled.
|
||||
* \retval non-zero Telephone events are currently enabled.
|
||||
* \param options SDP Options
|
||||
* \param sdpsession
|
||||
*/
|
||||
int ast_sdp_options_get_telephone_event(const struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \brief Representation of the SDP
|
||||
*
|
||||
* Users of the SDP API set the representation based on what they
|
||||
* natively handle. This indicates the type of SDP that the API expects
|
||||
* when being given an SDP, and it indicates the type of SDP that the API
|
||||
* returns when asked for one.
|
||||
*/
|
||||
enum ast_sdp_options_repr {
|
||||
/*! SDP is represented as a string */
|
||||
AST_SDP_REPR_STRING,
|
||||
/*! SDP is represented as a pjmedia_sdp_session */
|
||||
AST_SDP_REPR_PJMEDIA,
|
||||
/*! End of the list */
|
||||
AST_SDP_REPR_END,
|
||||
};
|
||||
void ast_sdp_options_set_sdpsession(struct ast_sdp_options *options,
|
||||
const char *sdpsession);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set the SDP representation
|
||||
* \brief Get SDP Options sdpsession
|
||||
*
|
||||
* The default is AST_SDP_REPR_STRING
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns sdpsession
|
||||
*/
|
||||
int ast_sdp_options_set_repr(struct ast_sdp_options *options,
|
||||
enum ast_sdp_options_repr repr);
|
||||
const char *ast_sdp_options_get_sdpsession(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get the SDP representation
|
||||
* \brief Set SDP Options rtp_engine
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param rtp_engine
|
||||
*/
|
||||
enum ast_sdp_options_repr ast_sdp_options_get_repr(const struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \brief SDP encryption options
|
||||
*/
|
||||
enum ast_sdp_options_encryption {
|
||||
/*! No encryption */
|
||||
AST_SDP_ENCRYPTION_DISABLED,
|
||||
/*! SRTP SDES encryption */
|
||||
AST_SDP_ENCRYPTION_SRTP_SDES,
|
||||
/*! DTLS encryption */
|
||||
AST_SDP_ENCRYPTION_DTLS,
|
||||
};
|
||||
void ast_sdp_options_set_rtp_engine(struct ast_sdp_options *options,
|
||||
const char *rtp_engine);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set the SDP encryption
|
||||
* \brief Get SDP Options rtp_engine
|
||||
*
|
||||
* The default is AST_SDP_ENCRYPTION_DISABLED
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns rtp_engine
|
||||
*/
|
||||
int ast_sdp_options_set_encryption(struct ast_sdp_options *options,
|
||||
const char *ast_sdp_options_get_rtp_engine(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options bind_rtp_to_media_address
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param bind_rtp_to_media_address
|
||||
*/
|
||||
void ast_sdp_options_set_bind_rtp_to_media_address(struct ast_sdp_options *options,
|
||||
unsigned int bind_rtp_to_media_address);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options bind_rtp_to_media_address
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns bind_rtp_to_media_address
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_bind_rtp_to_media_address(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options rtp_symmetric
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param rtp_symmetric
|
||||
*/
|
||||
void ast_sdp_options_set_rtp_symmetric(struct ast_sdp_options *options,
|
||||
unsigned int rtp_symmetric);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options rtp_symmetric
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns rtp_symmetric
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_rtp_symmetric(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options telephone_event
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param telephone_event
|
||||
*/
|
||||
void ast_sdp_options_set_telephone_event(struct ast_sdp_options *options,
|
||||
unsigned int telephone_event);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options telephone_event
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns telephone_event
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_telephone_event(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options rtp_ipv6
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param rtp_ipv6
|
||||
*/
|
||||
void ast_sdp_options_set_rtp_ipv6(struct ast_sdp_options *options,
|
||||
unsigned int rtp_ipv6);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options rtp_ipv6
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns rtp_ipv6
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_rtp_ipv6(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options g726_non_standard
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param g726_non_standard
|
||||
*/
|
||||
void ast_sdp_options_set_g726_non_standard(struct ast_sdp_options *options,
|
||||
unsigned int g726_non_standard);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options g726_non_standard
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns g726_non_standard
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_g726_non_standard(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \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
|
||||
* \param tos_audio
|
||||
*/
|
||||
void ast_sdp_options_set_tos_audio(struct ast_sdp_options *options,
|
||||
unsigned int tos_audio);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options tos_audio
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns tos_audio
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_tos_audio(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options cos_audio
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param cos_audio
|
||||
*/
|
||||
void ast_sdp_options_set_cos_audio(struct ast_sdp_options *options,
|
||||
unsigned int cos_audio);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options cos_audio
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns cos_audio
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_cos_audio(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options tos_video
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param tos_video
|
||||
*/
|
||||
void ast_sdp_options_set_tos_video(struct ast_sdp_options *options,
|
||||
unsigned int tos_video);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options tos_video
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns tos_video
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_tos_video(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options cos_video
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param cos_video
|
||||
*/
|
||||
void ast_sdp_options_set_cos_video(struct ast_sdp_options *options,
|
||||
unsigned int cos_video);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options cos_video
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns cos_video
|
||||
*/
|
||||
unsigned int ast_sdp_options_get_cos_video(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options ice
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param ice
|
||||
*/
|
||||
void ast_sdp_options_set_ice(struct ast_sdp_options *options,
|
||||
enum ast_sdp_options_ice ice);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options ice
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns ice
|
||||
*/
|
||||
enum ast_sdp_options_ice ast_sdp_options_get_ice(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options impl
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param impl
|
||||
*/
|
||||
void ast_sdp_options_set_impl(struct ast_sdp_options *options,
|
||||
enum ast_sdp_options_impl impl);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get SDP Options impl
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns impl
|
||||
*/
|
||||
enum ast_sdp_options_impl ast_sdp_options_get_impl(struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Set SDP Options encryption
|
||||
*
|
||||
* \param options SDP Options
|
||||
* \param encryption
|
||||
*/
|
||||
void ast_sdp_options_set_encryption(struct ast_sdp_options *options,
|
||||
enum ast_sdp_options_encryption encryption);
|
||||
|
||||
/*!
|
||||
* \since 15.0.0
|
||||
* \brief Get the SDP encryption
|
||||
* \brief Get SDP Options encryption
|
||||
*
|
||||
* \param options SDP Options
|
||||
*
|
||||
* \returns encryption
|
||||
*/
|
||||
enum ast_sdp_options_encryption ast_sdp_options_get_encryption(const struct ast_sdp_options *options);
|
||||
enum ast_sdp_options_encryption ast_sdp_options_get_encryption(struct ast_sdp_options *options);
|
||||
|
||||
#endif /* _ASTERISK_SDP_OPTIONS_H */
|
||||
|
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Asterisk -- An open source telephony toolkit.
|
||||
*
|
||||
* Copyright (C) 2017, Digium, Inc.
|
||||
*
|
||||
* Mark Michelson <mmichelson@digium.com>
|
||||
*
|
||||
* See http://www.asterisk.org for more information about
|
||||
* the Asterisk project. Please do not directly contact
|
||||
* any of the maintainers of this project for assistance;
|
||||
* the project provides a web site, mailing lists and IRC
|
||||
* channels for your use.
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License Version 2. See the LICENSE file
|
||||
* at the top of the source tree.
|
||||
*/
|
||||
|
||||
/* NOTE: It is unlikely that you need to include this file. You probably will only need
|
||||
* this if you are an SDP translator, or if you are an inner part of the SDP API
|
||||
*/
|
||||
|
||||
#ifndef _SDP_PRIV_H
|
||||
#define _SDP_PRIV_H
|
||||
|
||||
#include "asterisk/vector.h"
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP attribute
|
||||
*/
|
||||
struct ast_sdp_a_line {
|
||||
/*! Attribute name */
|
||||
char *name;
|
||||
/*! Attribute value. For attributes that have no value, this will be an empty string */
|
||||
char *value;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Structure representing an SDP connection
|
||||
*/
|
||||
struct ast_sdp_c_line {
|
||||
/* IP family string (e.g. IP4 or IP6) */
|
||||
char *family;
|
||||
/* Connection address. Can be an IP address or FQDN */
|
||||
char *addr;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief A collection of SDP attributes
|
||||
*/
|
||||
AST_VECTOR(ast_sdp_a_line_vector, struct ast_sdp_a_line);
|
||||
|
||||
/*!
|
||||
* \brief An SDP media stream
|
||||
*
|
||||
* This contains both the m line, as well as its
|
||||
* constituent a lines.
|
||||
*/
|
||||
struct ast_sdp_m_line {
|
||||
/*! Media type (e.g. "audio" or "video") */
|
||||
char *type;
|
||||
/*! Port number in m line */
|
||||
uint16_t port;
|
||||
/*! Number of ports specified in m line */
|
||||
uint16_t port_count;
|
||||
/*! RTP profile string (e.g. "RTP/AVP") */
|
||||
char *profile;
|
||||
/*! RTP payloads */
|
||||
AST_VECTOR(, char *) payloads;
|
||||
/*! Connection information for this media stream */
|
||||
struct ast_sdp_c_line c_line;
|
||||
/*! The attributes for this media stream */
|
||||
struct ast_sdp_a_line_vector a_lines;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief SDP time information
|
||||
*/
|
||||
struct ast_sdp_t_line {
|
||||
/*! Session start time */
|
||||
uint32_t start;
|
||||
/*! Session end time */
|
||||
uint32_t end;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief An SDP
|
||||
*/
|
||||
struct ast_sdp {
|
||||
/*! SDP Origin line */
|
||||
struct {
|
||||
/*! Origin user name */
|
||||
char *user;
|
||||
/*! Origin id */
|
||||
uint32_t id;
|
||||
/*! Origin version */
|
||||
uint32_t version;
|
||||
/*! Origin IP address family (e.g. "IP4" or "IP6") */
|
||||
char *family;
|
||||
/*! Origin address. Can be an IP address or FQDN */
|
||||
char *addr;
|
||||
} o_line;
|
||||
/*! SDP Session name */
|
||||
char *s_line;
|
||||
/*! SDP top-level connection information */
|
||||
struct ast_sdp_c_line c_line;
|
||||
/*! SDP timing information */
|
||||
struct ast_sdp_t_line t_line;
|
||||
/*! SDP top-level attributes */
|
||||
struct ast_sdp_a_line_vector a_lines;
|
||||
/*! SDP media streams */
|
||||
AST_VECTOR(, struct ast_sdp_m_line) m_lines;
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Allocate a new SDP.
|
||||
*
|
||||
* \note This does not perform any initialization.
|
||||
*
|
||||
* \retval NULL FAIL
|
||||
* \retval non-NULL New SDP
|
||||
*/
|
||||
struct ast_sdp *ast_sdp_alloc(void);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP and all its constituent parts
|
||||
*/
|
||||
void ast_sdp_free(struct ast_sdp *dead);
|
||||
|
||||
#endif /* _SDP_PRIV_H */
|
@@ -19,9 +19,10 @@
|
||||
#ifndef _ASTERISK_SDP_STATE_H
|
||||
#define _ASTERISK_SDP_STATE_H
|
||||
|
||||
#include "asterisk/stream.h"
|
||||
#include "asterisk/sdp_options.h"
|
||||
|
||||
struct ast_sdp_state;
|
||||
struct ast_sdp_options;
|
||||
struct ast_stream_topology;
|
||||
|
||||
/*!
|
||||
* \brief Allocate a new SDP state
|
||||
@@ -31,7 +32,8 @@ struct ast_stream_topology;
|
||||
* Ownership of the SDP options is taken on by the SDP state.
|
||||
* A good strategy is to call this during session creation.
|
||||
*/
|
||||
struct ast_sdp_state *ast_sdp_state_alloc(struct ast_stream_topology *streams, struct ast_sdp_options *options);
|
||||
struct ast_sdp_state *ast_sdp_state_alloc(struct ast_stream_topology *streams,
|
||||
struct ast_sdp_options *options);
|
||||
|
||||
/*!
|
||||
* \brief Free the SDP state.
|
||||
@@ -45,7 +47,8 @@ void ast_sdp_state_free(struct ast_sdp_state *sdp_state);
|
||||
*
|
||||
* Stream numbers correspond to the streams in the topology of the associated channel
|
||||
*/
|
||||
struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(struct ast_sdp_state *sdp_state, int stream_index);
|
||||
struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(const struct ast_sdp_state *sdp_state,
|
||||
int stream_index);
|
||||
|
||||
/*!
|
||||
* \brief Get the joint negotiated streams based on local and remote capabilities.
|
||||
@@ -53,44 +56,96 @@ struct ast_rtp_instance *ast_sdp_state_get_rtp_instance(struct ast_sdp_state *sd
|
||||
* If this is called prior to receiving a remote SDP, then this will just mirror
|
||||
* the local configured endpoint capabilities.
|
||||
*/
|
||||
struct ast_stream_topology *ast_sdp_state_get_joint_topology(struct ast_sdp_state *sdp_state);
|
||||
const struct ast_stream_topology *ast_sdp_state_get_joint_topology(
|
||||
const struct ast_sdp_state *sdp_state);
|
||||
|
||||
/*!
|
||||
* \brief Get the local topology
|
||||
*
|
||||
*/
|
||||
const struct ast_stream_topology *ast_sdp_state_get_local_topology(
|
||||
const struct ast_sdp_state *sdp_state);
|
||||
|
||||
/*!
|
||||
* \brief Get the sdp_state options
|
||||
*
|
||||
*/
|
||||
const struct ast_sdp_options *ast_sdp_state_get_options(
|
||||
const struct ast_sdp_state *sdp_state);
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Get the local SDP.
|
||||
*
|
||||
* If we have not received a remote SDP yet, this will be an SDP offer based
|
||||
* on known streams and options If we have received a remote SDP, this will
|
||||
* be the negotiated SDP based on the joint capabilities. The return type is
|
||||
* a void pointer because the representation of the SDP is going to be determined based
|
||||
* on the SDP options when allocating the SDP state.
|
||||
* \param sdp_state
|
||||
*
|
||||
* This function will allocate RTP instances if RTP instances have not already
|
||||
* been allocated for the streams.
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \note
|
||||
* This function will allocate a new SDP with RTP instances if it has not already
|
||||
* been allocated.
|
||||
*
|
||||
* The return here is const. The use case for this is so that a channel can add the SDP to an outgoing
|
||||
* message. The API user should not attempt to modify the SDP. SDP modification should only be done through
|
||||
* the API.
|
||||
*/
|
||||
const void *ast_sdp_state_get_local(struct ast_sdp_state *sdp_state);
|
||||
const struct ast_sdp *ast_sdp_state_get_local_sdp(struct ast_sdp_state *sdp_state);
|
||||
|
||||
/*!
|
||||
* \brief Set the remote SDP.
|
||||
* \brief Get the local SDP Implementation.
|
||||
*
|
||||
* This can be used for either a remote offer or answer.
|
||||
* This can also be used whenever an UPDATE, re-INVITE, etc. arrives.
|
||||
* The type of the "remote" parameter is dictated by whatever SDP representation
|
||||
* was set in the ast_sdp_options used during ast_sdp_state allocation
|
||||
* \param sdp_state
|
||||
*
|
||||
* This function will NOT allocate RTP instances.
|
||||
* \retval non-NULL Success
|
||||
* \retval NULL Failure
|
||||
*
|
||||
* \note
|
||||
* This function calls ast_sdp_state_get_local_sdp then translates it into
|
||||
* the defined implementation.
|
||||
*
|
||||
* The return here is const. The use case for this is so that a channel can add
|
||||
* the SDP to an outgoing message. The API user should not attempt to modify the SDP.
|
||||
* SDP modification should only be done through the API.
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_state_set_remote(struct ast_sdp_state *sdp_state, void *remote);
|
||||
const void *ast_sdp_state_get_local_sdp_impl(struct ast_sdp_state *sdp_state);
|
||||
|
||||
/*!
|
||||
* \brief Set the remote SDP
|
||||
*
|
||||
* \param sdp_state
|
||||
* \param sdp
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void ast_sdp_state_set_remote_sdp(struct ast_sdp_state *sdp_state, struct ast_sdp *sdp);
|
||||
|
||||
/*!
|
||||
* \brief Set the remote SDP from an Implementation
|
||||
*
|
||||
* \param sdp_state
|
||||
* \param remote The implementation's representation of an SDP.
|
||||
*
|
||||
* \retval 0 Success
|
||||
* \retval non-0 Failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_state_set_remote_sdp_from_impl(struct ast_sdp_state *sdp_state, void *remote);
|
||||
|
||||
/*!
|
||||
* \brief Reset the SDP state and stream capabilities as if the SDP state had just been allocated.
|
||||
*
|
||||
* \param sdp_state
|
||||
* \param remote The implementation's representation of an SDP.
|
||||
*
|
||||
* \retval 0 Success
|
||||
*
|
||||
* \note
|
||||
* This is most useful for when a channel driver is sending a session refresh message
|
||||
* and needs to re-advertise its initial capabilities instead of the previously-negotiated
|
||||
* joint capabilities.
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
int ast_sdp_state_reset(struct ast_sdp_state *sdp_state);
|
||||
|
||||
|
@@ -28,7 +28,7 @@ struct sdp;
|
||||
*/
|
||||
struct ast_sdp_translator_ops {
|
||||
/*! The SDP representation on which this translator operates */
|
||||
enum ast_sdp_options_repr repr;
|
||||
enum ast_sdp_options_impl repr;
|
||||
/*! Allocate new translator private data for a translator */
|
||||
void *(*translator_new)(void);
|
||||
/*! Free translator private data */
|
||||
@@ -36,7 +36,7 @@ struct ast_sdp_translator_ops {
|
||||
/*! Convert the channel-native SDP into an internal Asterisk SDP */
|
||||
struct ast_sdp *(*to_sdp)(void *repr_sdp, void *translator_priv);
|
||||
/*! Convert an internal Asterisk SDP into a channel-native SDP */
|
||||
void *(*from_sdp)(struct ast_sdp *sdp, void *translator_priv);
|
||||
void *(*from_sdp)(const struct ast_sdp *sdp, void *translator_priv);
|
||||
};
|
||||
|
||||
/*!
|
||||
@@ -72,7 +72,7 @@ void ast_sdp_unregister_translator(struct ast_sdp_translator_ops *ops);
|
||||
* \retval NULL FAIL
|
||||
* \retval non-NULL New SDP translator
|
||||
*/
|
||||
struct ast_sdp_translator *ast_sdp_translator_new(enum ast_sdp_options_repr repr);
|
||||
struct ast_sdp_translator *ast_sdp_translator_new(enum ast_sdp_options_impl repr);
|
||||
|
||||
/*!
|
||||
* \brief Free an SDP translator
|
||||
@@ -97,6 +97,7 @@ struct ast_sdp *ast_sdp_translator_to_sdp(struct ast_sdp_translator *translator,
|
||||
* \retval NULL FAIL
|
||||
* \retval non-NULL The translated SDP
|
||||
*/
|
||||
void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator, struct ast_sdp *ast_sdp);
|
||||
void *ast_sdp_translator_from_sdp(struct ast_sdp_translator *translator,
|
||||
const struct ast_sdp *ast_sdp);
|
||||
|
||||
#endif /* _ASTERISK_SDP_TRANSLATOR_H */
|
||||
|
@@ -43,6 +43,8 @@ struct ast_format_cap;
|
||||
*/
|
||||
struct ast_stream_topology;
|
||||
|
||||
typedef void (*ast_stream_data_free_fn)(void *);
|
||||
|
||||
/*!
|
||||
* \brief States that a stream may be in
|
||||
*/
|
||||
@@ -69,6 +71,20 @@ enum ast_stream_state {
|
||||
AST_STREAM_STATE_INACTIVE,
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Stream data slots
|
||||
*/
|
||||
enum ast_stream_data_slot {
|
||||
/*!
|
||||
* \brief Data slot for RTP instance
|
||||
*/
|
||||
AST_STREAM_DATA_RTP_INSTANCE = 0,
|
||||
/*!
|
||||
* \brief Controls the size of the data pointer array
|
||||
*/
|
||||
AST_STREAM_DATA_SLOT_MAX
|
||||
};
|
||||
|
||||
/*!
|
||||
* \brief Create a new media stream representation
|
||||
*
|
||||
@@ -103,6 +119,9 @@ void ast_stream_free(struct ast_stream *stream);
|
||||
* \retval non-NULL success
|
||||
* \retval NULL failure
|
||||
*
|
||||
* \note Opaque data pointers set with ast_stream_set_data() are not part
|
||||
* of the deep clone. The pointers are simply copied.
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
struct ast_stream *ast_stream_clone(const struct ast_stream *stream);
|
||||
@@ -201,6 +220,34 @@ void ast_stream_set_state(struct ast_stream *stream, enum ast_stream_state state
|
||||
*/
|
||||
const char *ast_stream_state2str(enum ast_stream_state state);
|
||||
|
||||
/*!
|
||||
* \brief Get the opaque stream data
|
||||
*
|
||||
* \param stream The media stream
|
||||
* \param slot The data slot to retrieve
|
||||
*
|
||||
* \retval non-NULL success
|
||||
* \retval NULL failure
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void *ast_stream_get_data(struct ast_stream *stream, enum ast_stream_data_slot slot);
|
||||
|
||||
/*!
|
||||
* \brief Set the opaque stream data
|
||||
*
|
||||
* \param stream The media stream
|
||||
* \param slot The data slot to set
|
||||
* \param data Opaque data
|
||||
* \param data_free_fn Callback to free data when stream is freed. May be NULL for no action.
|
||||
*
|
||||
* \return data
|
||||
*
|
||||
* \since 15
|
||||
*/
|
||||
void *ast_stream_set_data(struct ast_stream *stream, enum ast_stream_data_slot slot,
|
||||
void *data, ast_stream_data_free_fn data_free_fn);
|
||||
|
||||
/*!
|
||||
* \brief Get the position of the stream in the topology
|
||||
*
|
||||
|
Reference in New Issue
Block a user