ACN: Changes specific to the core

Allow passing a topology from the called channel back to the
calling channel.

 * Added a new function ast_queue_answer() that accepts a stream
   topology and queues an ANSWER CONTROL frame with it as the
   data.  This allows the called channel to indicate its resolved
   topology.

 * Added a new virtual function to the channel tech structure
   answer_with_stream_topology() that allows the calling channel
   to receive the called channel's topology.  Added
   ast_raw_answer_with_stream_topology() that invokes that virtual
   function.

 * Modified app_dial.c and features.c to grab the topology from the
   ANSWER frame queued by the answering channel and send it to
   the calling channel with ast_raw_answer_with_stream_topology().

 * Modified frame.c to automatically cleanup the reference
   to the topology on ANSWER frames.

Added a few debugging messages to stream.c.

Change-Id: I0115d2ed68d6bae0f87e85abcf16c771bdaf992c
This commit is contained in:
George Joseph
2020-07-20 13:39:14 -06:00
committed by Joshua Colp
parent 543f936147
commit 6faf76308d
7 changed files with 155 additions and 10 deletions

View File

@@ -707,6 +707,19 @@ struct ast_channel_tech {
/*! \brief Answer the channel */
int (* const answer)(struct ast_channel *chan);
/*!
* \brief Answer the channel with topology
* \since 18.0.0
*
* \param chan The channel to answer
* \param topology The topology to use, probably the peer's.
*
* \note The topology may be NULL when the peer doesn't support streams
* or, in the case where transcoding is in effect, when this channel should use
* its existing topology.
*/
int (* const answer_with_stream_topology)(struct ast_channel *chan, struct ast_stream_topology *topology);
/*!
* \brief Read a frame (or chain of frames from the same stream), in standard format (see frame.h)
*
@@ -1081,6 +1094,10 @@ struct ast_bridge_config {
* exist when the end_bridge_callback is called, then it needs to be fixed up properly
*/
void (*end_bridge_callback_data_fixup)(struct ast_bridge_config *bconfig, struct ast_channel *originator, struct ast_channel *terminator);
/*! If the bridge answers the channel this topology should be passed to the channel
* and used if the channel supports the answer_with_stream_topology callback.
*/
struct ast_stream_topology *answer_topology;
};
struct chanmon;
@@ -1378,6 +1395,17 @@ int ast_queue_control(struct ast_channel *chan, enum ast_control_frame_type cont
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control,
const void *data, size_t datalen);
/*!
* \brief Queue an ANSWER control frame with topology
*
* \param chan channel to queue frame onto
* \param topology topology to be passed through the core to the peer channel
*
* \retval 0 success
* \retval non-zero failure
*/
int ast_queue_answer(struct ast_channel *chan, const struct ast_stream_topology *topology);
/*!
* \brief Change channel name
*
@@ -1801,6 +1829,31 @@ int ast_auto_answer(struct ast_channel *chan);
*/
int ast_raw_answer(struct ast_channel *chan);
/*!
* \brief Answer a channel passing in a stream topology
* \since 18.0.0
*
* \param chan channel to answer
* \param topology the peer's stream topology
*
* This function answers a channel and handles all necessary call
* setup functions.
*
* \note The channel passed does not need to be locked, but is locked
* by the function when needed.
*
* \note Unlike ast_answer(), this function will not wait for media
* flow to begin. The caller should be careful before sending media
* to the channel before incoming media arrives, as the outgoing
* media may be lost.
*
* \note The topology is usually that of the peer channel and may be NULL.
*
* \retval 0 on success
* \retval non-zero on failure
*/
int ast_raw_answer_with_stream_topology(struct ast_channel *chan, struct ast_stream_topology *topology);
/*!
* \brief Answer a channel, with a selectable delay before returning
*
@@ -5054,4 +5107,18 @@ int ast_channel_stream_topology_changed_externally(struct ast_channel *chan);
*/
void *ast_channel_get_stream_topology_change_source(struct ast_channel *chan);
/*!
* \brief Checks if a channel's technology implements a particular callback function
* \since 18.0.0
*
* \param chan The channel
* \param function The function to look for
*
* \retval 1 if the channel has a technology set and it implements the function
* \retval 0 if the channel doesn't have a technology set or it doesn't implement the function
*/
#define ast_channel_has_tech_function(chan, function) \
(ast_channel_tech(chan) ? ast_channel_tech(chan)->function != NULL : 0)
#endif /* _ASTERISK_CHANNEL_H */

View File

@@ -147,8 +147,12 @@ enum {
struct ast_frame_subclass {
/*! A frame specific code */
int integer;
/*! The asterisk media format */
struct ast_format *format;
union {
/*! The asterisk media format */
struct ast_format *format;
/*! The asterisk stream topology */
struct ast_stream_topology *topology;
};
/*! For video formats, an indication that a frame ended */
unsigned int frame_ending;
};