Move after bridge callbacks into their own file

One more major refactoring to go.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395367 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Matthew Jordan
2013-07-25 02:20:23 +00:00
parent 71609d58aa
commit 9d8a5ceb02
20 changed files with 1588 additions and 1482 deletions

View File

@@ -447,7 +447,7 @@ void ast_bridge_notify_masquerade(struct ast_channel *chan);
* If channel specific features are enabled a pointer to the features structure
* can be specified in the features parameter.
*/
enum ast_bridge_channel_state ast_bridge_join(struct ast_bridge *bridge,
enum bridge_channel_state ast_bridge_join(struct ast_bridge *bridge,
struct ast_channel *chan,
struct ast_channel *swap,
struct ast_bridge_features *features,
@@ -884,202 +884,6 @@ enum ast_transfer_result ast_bridge_transfer_blind(int is_external,
*/
enum ast_transfer_result ast_bridge_transfer_attended(struct ast_channel *to_transferee,
struct ast_channel *to_transfer_target);
/*!
* \brief Set channel to goto specific location after the bridge.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
* \param context Context to goto after bridge.
* \param exten Exten to goto after bridge.
* \param priority Priority to goto after bridge.
*
* \note chan is locked by this function.
*
* \details Add a channel datastore to setup the goto location
* when the channel leaves the bridge and run a PBX from there.
*
* \return Nothing
*/
void ast_after_bridge_set_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
/*!
* \brief Set channel to run the h exten after the bridge.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
* \param context Context to goto after bridge.
*
* \note chan is locked by this function.
*
* \details Add a channel datastore to setup the goto location
* when the channel leaves the bridge and run a PBX from there.
*
* \return Nothing
*/
void ast_after_bridge_set_h(struct ast_channel *chan, const char *context);
/*!
* \brief Set channel to go on in the dialplan after the bridge.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
* \param context Current context of the caller channel.
* \param exten Current exten of the caller channel.
* \param priority Current priority of the caller channel
* \param parseable_goto User specified goto string from dialplan.
*
* \note chan is locked by this function.
*
* \details Add a channel datastore to setup the goto location
* when the channel leaves the bridge and run a PBX from there.
*
* If parseable_goto then use the given context/exten/priority
* as the relative position for the parseable_goto.
* Else goto the given context/exten/priority+1.
*
* \return Nothing
*/
void ast_after_bridge_set_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto);
/*!
* \brief Setup any after bridge goto location to begin execution.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
*
* \note chan is locked by this function.
*
* \details Pull off any after bridge goto location datastore and
* setup for dialplan execution there.
*
* \retval 0 on success. The goto location is set for a PBX to run it.
* \retval non-zero on error or no goto location.
*
* \note If the after bridge goto is set to run an h exten it is
* run here immediately.
*/
int ast_after_bridge_goto_setup(struct ast_channel *chan);
/*!
* \brief Run a PBX on any after bridge goto location.
* \since 12.0.0
*
* \param chan Channel to execute after bridge goto location.
*
* \note chan is locked by this function.
*
* \details Pull off any after bridge goto location datastore
* and run a PBX at that location.
*
* \note On return, the chan pointer is no longer valid because
* the channel has hung up.
*
* \return Nothing
*/
void ast_after_bridge_goto_run(struct ast_channel *chan);
/*!
* \brief Discard channel after bridge goto location.
* \since 12.0.0
*
* \param chan Channel to discard after bridge goto location.
*
* \note chan is locked by this function.
*
* \return Nothing
*/
void ast_after_bridge_goto_discard(struct ast_channel *chan);
/*!
* \brief Read after bridge goto if it exists
* \since 12.0.0
*
* \param chan Channel to read the after bridge goto parseable goto string from
* \param buffer Buffer to write the after bridge goto data to
* \param buf_size size of the buffer being written to
*/
void ast_after_bridge_goto_read(struct ast_channel *chan, char *buffer, size_t buf_size);
/*! Reason the the after bridge callback will not be called. */
enum ast_after_bridge_cb_reason {
/*! The datastore is being destroyed. Likely due to hangup. (Enum value must be zero.) */
AST_AFTER_BRIDGE_CB_REASON_DESTROY,
/*! Something else replaced the callback with another. */
AST_AFTER_BRIDGE_CB_REASON_REPLACED,
/*! The callback was removed because of a masquerade. (fixup) */
AST_AFTER_BRIDGE_CB_REASON_MASQUERADE,
/*! The channel was departed from the bridge. */
AST_AFTER_BRIDGE_CB_REASON_DEPART,
/*! Was explicitly removed by external code. */
AST_AFTER_BRIDGE_CB_REASON_REMOVED,
};
/*!
* \brief After bridge callback failed.
* \since 12.0.0
*
* \param reason Reason callback is failing.
* \param data Extra data what setup the callback wanted to pass.
*
* \note Called when the channel leaves the bridging system or
* is destroyed.
*
* \return Nothing
*/
typedef void (*ast_after_bridge_cb_failed)(enum ast_after_bridge_cb_reason reason, void *data);
/*!
* \brief After bridge callback function.
* \since 12.0.0
*
* \param chan Channel just leaving bridging system.
* \param data Extra data what setup the callback wanted to pass.
*
* \return Nothing
*/
typedef void (*ast_after_bridge_cb)(struct ast_channel *chan, void *data);
/*!
* \brief Discard channel after bridge callback.
* \since 12.0.0
*
* \param chan Channel to discard after bridge callback.
* \param reason Why are we doing this.
*
* \note chan is locked by this function.
*
* \return Nothing
*/
void ast_after_bridge_callback_discard(struct ast_channel *chan, enum ast_after_bridge_cb_reason reason);
/*!
* \brief Setup an after bridge callback for when the channel leaves the bridging system.
* \since 12.0.0
*
* \param chan Channel to setup an after bridge callback on.
* \param callback Function to call when the channel leaves the bridging system.
* \param failed Function to call when it will not be calling the callback.
* \param data Extra data to pass with the callback.
*
* \note chan is locked by this function.
*
* \note failed is called when the channel leaves the bridging
* system or is destroyed.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int ast_after_bridge_callback_set(struct ast_channel *chan, ast_after_bridge_cb callback, ast_after_bridge_cb_failed failed, void *data);
/*!
* \brief Get a string representation of an after bridge callback reason
* \since 12.0.0
*
* \param reason The reason to interpret to a string
* \retval NULL Unrecognized reason
* \retval non-NULL String representation of reason
*/
const char *ast_after_bridge_cb_reason_string(enum ast_after_bridge_cb_reason reason);
/*!
* \brief Get a container of all channels in the bridge

View File

@@ -0,0 +1,244 @@
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2013 Digium, Inc.
*
* Richard Mudgett <rmudgett@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.
*/
/*!
* \file
* \brief After Bridge Execution API
*
* \author Richard Mudgett <rmudgett@digium.com>
*
* See Also:
* \arg \ref AstCREDITS
*/
#ifndef _ASTERISK_BRIDGING_AFTER_H
#define _ASTERISK_BRIDGING_AFTER_H
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
/*! Reason the the after bridge callback will not be called. */
enum ast_bridge_after_cb_reason {
/*! The datastore is being destroyed. Likely due to hangup. (Enum value must be zero.) */
AST_BRIDGE_AFTER_CB_REASON_DESTROY,
/*! Something else replaced the callback with another. */
AST_BRIDGE_AFTER_CB_REASON_REPLACED,
/*! The callback was removed because of a masquerade. (fixup) */
AST_BRIDGE_AFTER_CB_REASON_MASQUERADE,
/*! The channel was departed from the bridge. */
AST_BRIDGE_AFTER_CB_REASON_DEPART,
/*! Was explicitly removed by external code. */
AST_BRIDGE_AFTER_CB_REASON_REMOVED,
};
/*!
* \brief Set channel to goto specific location after the bridge.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
* \param context Context to goto after bridge.
* \param exten Exten to goto after bridge.
* \param priority Priority to goto after bridge.
*
* \note chan is locked by this function.
*
* \details Add a channel datastore to setup the goto location
* when the channel leaves the bridge and run a PBX from there.
*
* \return Nothing
*/
void ast_bridge_set_after_goto(struct ast_channel *chan, const char *context, const char *exten, int priority);
/*!
* \brief Set channel to run the h exten after the bridge.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
* \param context Context to goto after bridge.
*
* \note chan is locked by this function.
*
* \details Add a channel datastore to setup the goto location
* when the channel leaves the bridge and run a PBX from there.
*
* \return Nothing
*/
void ast_bridge_set_after_h(struct ast_channel *chan, const char *context);
/*!
* \brief Set channel to go on in the dialplan after the bridge.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
* \param context Current context of the caller channel.
* \param exten Current exten of the caller channel.
* \param priority Current priority of the caller channel
* \param parseable_goto User specified goto string from dialplan.
*
* \note chan is locked by this function.
*
* \details Add a channel datastore to setup the goto location
* when the channel leaves the bridge and run a PBX from there.
*
* If parseable_goto then use the given context/exten/priority
* as the relative position for the parseable_goto.
* Else goto the given context/exten/priority+1.
*
* \return Nothing
*/
void ast_bridge_set_after_go_on(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *parseable_goto);
/*!
* \brief Setup any after bridge goto location to begin execution.
* \since 12.0.0
*
* \param chan Channel to setup after bridge goto location.
*
* \note chan is locked by this function.
*
* \details Pull off any after bridge goto location datastore and
* setup for dialplan execution there.
*
* \retval 0 on success. The goto location is set for a PBX to run it.
* \retval non-zero on error or no goto location.
*
* \note If the after bridge goto is set to run an h exten it is
* run here immediately.
*/
int ast_bridge_setup_after_goto(struct ast_channel *chan);
/*!
* \brief Run any after bridge callback.
* \since 12.0.0
*
* \param chan Channel to run after bridge callback.
*
* \return Nothing
*/
void ast_bridge_run_after_callback(struct ast_channel *chan);
/*!
* \brief Run discarding any after bridge callbacks.
* \since 12.0.0
*
* \param chan Channel to run after bridge callback.
*
* \return Nothing
*/
void ast_bridge_discard_after_callback(struct ast_channel *chan, enum ast_bridge_after_cb_reason reason);
/*!
* \brief Run a PBX on any after bridge goto location.
* \since 12.0.0
*
* \param chan Channel to execute after bridge goto location.
*
* \note chan is locked by this function.
*
* \details Pull off any after bridge goto location datastore
* and run a PBX at that location.
*
* \note On return, the chan pointer is no longer valid because
* the channel has hung up.
*
* \return Nothing
*/
void ast_bridge_run_after_goto(struct ast_channel *chan);
/*!
* \brief Discard channel after bridge goto location.
* \since 12.0.0
*
* \param chan Channel to discard after bridge goto location.
*
* \note chan is locked by this function.
*
* \return Nothing
*/
void ast_bridge_discard_after_goto(struct ast_channel *chan);
/*!
* \brief Read after bridge goto if it exists
* \since 12.0.0
*
* \param chan Channel to read the after bridge goto parseable goto string from
* \param buffer Buffer to write the after bridge goto data to
* \param buf_size size of the buffer being written to
*/
void ast_bridge_read_after_goto(struct ast_channel *chan, char *buffer, size_t buf_size);
/*!
* \brief After bridge callback failed.
* \since 12.0.0
*
* \param reason Reason callback is failing.
* \param data Extra data what setup the callback wanted to pass.
*
* \note Called when the channel leaves the bridging system or
* is destroyed.
*
* \return Nothing
*/
typedef void (*ast_bridge_after_cb_failed)(enum ast_bridge_after_cb_reason reason, void *data);
/*!
* \brief After bridge callback function.
* \since 12.0.0
*
* \param chan Channel just leaving bridging system.
* \param data Extra data what setup the callback wanted to pass.
*
* \return Nothing
*/
typedef void (*ast_bridge_after_cb)(struct ast_channel *chan, void *data);
/*!
* \brief Setup an after bridge callback for when the channel leaves the bridging system.
* \since 12.0.0
*
* \param chan Channel to setup an after bridge callback on.
* \param callback Function to call when the channel leaves the bridging system.
* \param failed Function to call when it will not be calling the callback.
* \param data Extra data to pass with the callback.
*
* \note chan is locked by this function.
*
* \note failed is called when the channel leaves the bridging
* system or is destroyed.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int ast_bridge_set_after_callback(struct ast_channel *chan, ast_bridge_after_cb callback, ast_bridge_after_cb_failed failed, void *data);
/*!
* \brief Get a string representation of an after bridge callback reason
* \since 12.0.0
*
* \param reason The reason to interpret to a string
* \retval NULL Unrecognized reason
* \retval non-NULL String representation of reason
*/
const char *ast_bridge_after_cb_reason_string(enum ast_bridge_after_cb_reason reason);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif /* _ASTERISK_BRIDGING_H */

View File

@@ -20,29 +20,29 @@
/*!
* \file
* \brief Bridging Channel API
* \page AstBridgeChannel Bridging Channel API
*
* An API that act on a channel in a bridge. Note that while the
* \ref ast_bridge_channel is owned by a channel, it should only be used
* by members of the bridging system. The only places where this API should
* be used is:
* - The \ref AstBridging API itself
* - Bridge mixing technologies
* - Bridge sub-classes
* \arg \ref AstBridging API itself
* \arg Bridge mixing technologies
* \arg Bridge sub-classes
*
* In general, anywhere else it is unsafe to use this API. Care should be
* taken when using this API to ensure that the locking order remains
* correct. The locking order must be:
* - The \ref ast_bridge
* - The \ref ast_bridge_channel
* - The \ref ast_channel
* \arg The \ref \c ast_bridge
* \arg The \ref \c ast_bridge_channel
* \arg The \ref \c ast_channel
*
* \author Joshua Colp <jcolp@digium.com>
* \author Richard Mudgett <rmudgett@digium.com>
* \author Matt Jordan <mjordan@digium.com>
*
* See Also:
* \ref bridging.h
* \arg \ref AstBridging
* \arg \ref AstCREDITS
*/
@@ -56,22 +56,22 @@ extern "C" {
#include "asterisk/bridging_technology.h"
/*! \brief State information about a bridged channel */
enum ast_bridge_channel_state {
enum bridge_channel_state {
/*! Waiting for a signal (Channel in the bridge) */
AST_BRIDGE_CHANNEL_STATE_WAIT = 0,
BRIDGE_CHANNEL_STATE_WAIT = 0,
/*! Bridged channel was forced out and should be hung up (Bridge may dissolve.) */
AST_BRIDGE_CHANNEL_STATE_END,
BRIDGE_CHANNEL_STATE_END,
/*! Bridged channel was forced out. Don't dissolve the bridge regardless */
AST_BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE,
BRIDGE_CHANNEL_STATE_END_NO_DISSOLVE,
};
enum ast_bridge_channel_thread_state {
enum bridge_channel_thread_state {
/*! Bridge channel thread is idle/waiting. */
AST_BRIDGE_CHANNEL_THREAD_IDLE,
BRIDGE_CHANNEL_THREAD_IDLE,
/*! Bridge channel thread is writing a normal/simple frame. */
AST_BRIDGE_CHANNEL_THREAD_SIMPLE,
BRIDGE_CHANNEL_THREAD_SIMPLE,
/*! Bridge channel thread is processing a frame. */
AST_BRIDGE_CHANNEL_THREAD_FRAME,
BRIDGE_CHANNEL_THREAD_FRAME,
};
struct ast_bridge;
@@ -85,7 +85,7 @@ struct ast_bridge_channel {
/*! Condition, used if we want to wake up a thread waiting on the bridged channel */
ast_cond_t cond;
/*! Current bridged channel state */
enum ast_bridge_channel_state state;
enum bridge_channel_state state;
/*! Asterisk channel participating in the bridge */
struct ast_channel *chan;
/*! Asterisk channel we are swapping with (if swapping) */
@@ -154,7 +154,7 @@ struct ast_bridge_channel {
*
* \note Needs to be atomically settable.
*/
enum ast_bridge_channel_thread_state activity;
enum bridge_channel_thread_state activity;
};
/*!
@@ -217,22 +217,22 @@ static inline void _ast_bridge_channel_unlock(struct ast_bridge_channel *bridge_
void ast_bridge_channel_lock_bridge(struct ast_bridge_channel *bridge_channel);
/*!
* \brief Set bridge channel state to leave bridge (if not leaving already).
* \brief Lets the bridging indicate when a bridge channel has stopped or started talking.
*
* \param bridge_channel Channel to change the state on
* \param new_state The new state to place the channel into
* \note All DSP functionality on the bridge has been pushed down to the lowest possible
* layer, which in this case is the specific bridging technology being used. Since it
* is necessary for the knowledge of which channels are talking to make its way up to the
* application, this function has been created to allow the bridging technology to communicate
* that information with the bridging core.
*
* Example usage:
* \param bridge_channel The bridge channel that has either started or stopped talking.
* \param started_talking set to 1 when this indicates the channel has started talking set to 0
* when this indicates the channel has stopped talking.
*
* \code
* ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
* \endcode
*
* This places the channel pointed to by bridge_channel into the
* state AST_BRIDGE_CHANNEL_STATE_END if it was
* AST_BRIDGE_CHANNEL_STATE_WAIT before.
* \retval 0 on success.
* \retval -1 on error.
*/
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);
int ast_bridge_channel_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking);
/*!
* \brief Set bridge channel state to leave bridge (if not leaving already).
@@ -243,14 +243,100 @@ void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel,
* Example usage:
*
* \code
* ast_bridge_channel_leave_bridge(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
* ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
* \endcode
*
* This places the channel pointed to by bridge_channel into the
* state AST_BRIDGE_CHANNEL_STATE_END if it was
* AST_BRIDGE_CHANNEL_STATE_WAIT before.
* state BRIDGE_CHANNEL_STATE_END if it was
* BRIDGE_CHANNEL_STATE_WAIT before.
*/
void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum ast_bridge_channel_state new_state);
void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state);
/*!
* \brief Set bridge channel state to leave bridge (if not leaving already).
*
* \param bridge_channel Channel to change the state on
* \param new_state The new state to place the channel into
*
* Example usage:
*
* \code
* ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
* \endcode
*
* This places the channel pointed to by bridge_channel into the
* state BRIDGE_CHANNEL_STATE_END if it was
* BRIDGE_CHANNEL_STATE_WAIT before.
*/
void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state);
/*!
* \brief Get the peer bridge channel of a two party bridge.
* \since 12.0.0
*
* \param bridge_channel What to get the peer of.
*
* \note On entry, bridge_channel->bridge is already locked.
*
* \note This is an internal bridge function.
*
* \retval peer on success.
* \retval NULL no peer channel.
*/
struct ast_bridge_channel *ast_bridge_channel_peer(struct ast_bridge_channel *bridge_channel);
/*!
* \brief Restore the formats of a bridge channel's channel to how they were before bridge_channel_internal_join
* \since 12.0.0
*
* \param bridge_channel Channel to restore
*/
void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channel);
/*!
* \brief Adjust the bridge_channel's bridge merge inhibit request count.
* \since 12.0.0
*
* \param bridge_channel What to operate on.
* \param request Inhibit request increment.
* (Positive to add requests. Negative to remove requests.)
*
* \note This API call is meant for internal bridging operations.
*
* \retval bridge adjusted merge inhibit with reference count.
*/
struct ast_bridge *ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request);
/*!
* \internal
* \brief Update the linkedids for all channels in a bridge
* \since 12.0.0
*
* \param bridge_channel The channel joining the bridge
* \param swap The channel being swapped out of the bridge. May be NULL.
*
* \note The bridge must be locked prior to calling this function. This should be called
* during a \ref bridge_channel_internal_push operation, typically by a sub-class of a bridge
*/
void ast_bridge_channel_update_linkedids(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
/*!
* \internal
* \brief Update the accountcodes for a channel entering a bridge
* \since 12.0.0
*
* This function updates the accountcode and peeraccount on channels in two-party
* bridges. In multi-party bridges, peeraccount is not set - it doesn't make much sense -
* however accountcode propagation will still occur if the channel joining has an
* accountcode.
*
* \param bridge_channel The channel joining the bridge
* \param swap The channel being swapped out of the bridge. May be NULL.
*
* \note The bridge must be locked prior to calling this function. This should be called
* during a \ref bridge_channel_internal_push operation, typically by a sub-class of a bridge
*/
void ast_bridge_channel_update_accountcodes(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
/*!
* \brief Write a frame to the specified bridge_channel.
@@ -497,79 +583,6 @@ int ast_bridge_channel_queue_callback(struct ast_bridge_channel *bridge_channel,
int ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, const char *parkee_uuid,
const char *parker_uuid, const char *app_data);
/*!
* \brief Restore the formats of a bridge channel's channel to how they were before bridge_channel_join
* \since 12.0.0
*
* \param bridge_channel Channel to restore
*/
void ast_bridge_channel_restore_formats(struct ast_bridge_channel *bridge_channel);
/*!
* \brief Get the peer bridge channel of a two party bridge.
* \since 12.0.0
*
* \param bridge_channel What to get the peer of.
*
* \note On entry, bridge_channel->bridge is already locked.
*
* \note This is an internal bridge function.
*
* \retval peer on success.
* \retval NULL no peer channel.
*/
struct ast_bridge_channel *ast_bridge_channel_peer(struct ast_bridge_channel *bridge_channel);
struct blind_transfer_data {
char exten[AST_MAX_EXTENSION];
char context[AST_MAX_CONTEXT];
};
/*!
* \brief Adjust the bridge_channel's bridge merge inhibit request count.
* \since 12.0.0
*
* \param bridge_channel What to operate on.
* \param request Inhibit request increment.
* (Positive to add requests. Negative to remove requests.)
*
* \note This API call is meant for internal bridging operations.
*
* \retval bridge adjusted merge inhibit with reference count.
*/
struct ast_bridge *ast_bridge_channel_merge_inhibit(struct ast_bridge_channel *bridge_channel, int request);
/*!
* \internal
* \brief Update the linkedids for all channels in a bridge
* \since 12.0.0
*
* \param bridge_channel The channel joining the bridge
* \param swap The channel being swapped out of the bridge. May be NULL.
*
* \note The bridge must be locked prior to calling this function. This should be called
* during a \ref bridge_channel_push operation, typically by a sub-class of a bridge
*/
void ast_bridge_channel_update_linkedids(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
/*!
* \internal
* \brief Update the accountcodes for a channel entering a bridge
* \since 12.0.0
*
* This function updates the accountcode and peeraccount on channels in two-party
* bridges. In multi-party bridges, peeraccount is not set - it doesn't make much sense -
* however accountcode propagation will still occur if the channel joining has an
* accountcode.
*
* \param bridge_channel The channel joining the bridge
* \param swap The channel being swapped out of the bridge. May be NULL.
*
* \note The bridge must be locked prior to calling this function. This should be called
* during a \ref bridge_channel_push operation, typically by a sub-class of a bridge
*/
void ast_bridge_channel_update_accountcodes(struct ast_bridge_channel *bridge_channel, struct ast_bridge_channel *swap);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif

View File

@@ -16,6 +16,9 @@
* at the top of the source tree.
*/
#ifndef _ASTERISK_PRIVATE_BRIDGING_CHANNEL_H
#define _ASTERISK_PRIVATE_BRIDGING_CHANNEL_H
/*!
* \file
* \brief Private Bridging Channel API
@@ -23,16 +26,14 @@
* \author Matt Jordan <mjordan@digium.com>
*
* A private API to manipulate channels in a bridge. These can be called on a channel in
* a bridge by the bridging API, but should not be called by external consumers of the
* Bridging API.
* a bridge by \ref bridging.c. These functions should not be called elsewhere, including
* by other members of the Bridging API.
*
* See Also:
* \arg \ref AstCREDITS
* \arg \ref Ast
*/
#ifndef _ASTERISK_PRIVATE_BRIDGING_CHANNEL_H
#define _ASTERISK_PRIVATE_BRIDGING_CHANNEL_H
/*!
* \internal
* \brief Actions that can be taken on a channel in a bridge
@@ -71,6 +72,18 @@ enum bridge_channel_action_type {
BRIDGE_CHANNEL_ACTION_DEFERRED_DISSOLVING,
};
/*!
* \internal
* \brief Allocate a new ao2 ref counted bridge_channel
* \since 12.0.0
*
* \param bridge The bridge to make the bridge_channel for
*
* \retval NULL on error
* \retval ao2 ref counted object on success
*/
struct ast_bridge_channel *bridge_channel_internal_alloc(struct ast_bridge *bridge);
/*!
* \internal
* \brief Push the bridge channel into its specified bridge.
@@ -83,7 +96,7 @@ enum bridge_channel_action_type {
* \retval 0 on success.
* \retval -1 on failure. The channel did not get pushed.
*/
int bridge_channel_push(struct ast_bridge_channel *bridge_channel);
int bridge_channel_internal_push(struct ast_bridge_channel *bridge_channel);
/*!
* \internal
@@ -96,7 +109,7 @@ int bridge_channel_push(struct ast_bridge_channel *bridge_channel);
*
* \return Nothing
*/
void bridge_channel_pull(struct ast_bridge_channel *bridge_channel);
void bridge_channel_internal_pull(struct ast_bridge_channel *bridge_channel);
/*!
* \internal
@@ -108,7 +121,7 @@ void bridge_channel_pull(struct ast_bridge_channel *bridge_channel);
* it is in the bridge. It will return when the channel has been instructed to
* leave the bridge.
*/
void bridge_channel_join(struct ast_bridge_channel *bridge_channel);
void bridge_channel_internal_join(struct ast_bridge_channel *bridge_channel);
/*!
* \internal
@@ -118,7 +131,7 @@ void bridge_channel_join(struct ast_bridge_channel *bridge_channel);
* \param bridge_channel The channel in the bridge
* \note This function assumes that \ref bridge_channel is already locked
*/
void bridge_channel_suspend_nolock(struct ast_bridge_channel *bridge_channel);
void bridge_channel_internal_suspend_nolock(struct ast_bridge_channel *bridge_channel);
/*!
* \internal
@@ -127,7 +140,7 @@ void bridge_channel_suspend_nolock(struct ast_bridge_channel *bridge_channel);
* \param bridge_channel The channel in the bridge
* \note This function assumes that \ref bridge_channel is already locked
*/
void bridge_channel_unsuspend_nolock(struct ast_bridge_channel *bridge_channel);
void bridge_channel_internal_unsuspend_nolock(struct ast_bridge_channel *bridge_channel);
/*!
* \internal
@@ -146,11 +159,35 @@ void bridge_channel_unsuspend_nolock(struct ast_bridge_channel *bridge_channel);
* \retval 0 on success.
* \retval -1 on error.
*/
int bridge_channel_queue_blind_transfer(struct ast_channel *transferee,
int bridge_channel_internal_queue_blind_transfer(struct ast_channel *transferee,
const char *exten, const char *context,
transfer_channel_cb new_channel_cb, void *user_data);
int bridge_channel_queue_attended_transfer(struct ast_channel *transferee,
/*!
* \internal
* \brief Queue an attended transfer action on a transferee bridge channel
*
* This is only relevant for when an attended transfer is performed on a two-party
* bridge. The transferee's bridge channel will have an attended transfer bridge
* action queued onto it.
*
* \param transferee The channel to have the action queued on
* \param unbridged_chan The unbridged channel who is the target of the attended
* transfer
*
* \retval 0 on success.
* \retval -1 on error.
*/
int bridge_channel_internal_queue_attended_transfer(struct ast_channel *transferee,
struct ast_channel *unbridged_chan);
/*!
* \internal
* \brief Return whether or not the bridge_channel would allow optimization
*
* \retval 0 if optimization is not allowed
* \retval non-zero if optimization is allowed
*/
int bridge_channel_internal_allows_optimization(struct ast_bridge_channel *bridge_channel);
#endif /* _ASTERISK_PRIVATE_BRIDGING_H */

View File

@@ -16,7 +16,8 @@
* at the top of the source tree.
*/
/*! \file
/*!
* \file
* \brief Channel Bridging API
* \author Joshua Colp <jcolp@digium.com>
*/
@@ -75,7 +76,7 @@ enum ast_bridge_builtin_feature {
* how it was imparted.
*
* \note Joined channels exit the bridge with
* AST_BRIDGE_CHANNEL_STATE_END_WITH_DISSOLVE.
* BRIDGE_CHANNEL_STATE_END_WITH_DISSOLVE.
*/
AST_BRIDGE_BUILTIN_HANGUP,
/*!

View File

@@ -180,8 +180,8 @@ void bridge_merge_inhibit_nolock(struct ast_bridge *bridge, int request);
* \param colp_update Whether to perform COLP updates.
*
* \details
* After a series of bridge_channel_push and
* bridge_channel_pull calls, you need to call this function
* After a series of bridge_channel_internal_push and
* bridge_channel_internal_pull calls, you need to call this function
* to cause the bridge to complete restructuring for the change
* in the channel makeup of the bridge.
*

View File

@@ -202,24 +202,6 @@ int __ast_bridge_technology_register(struct ast_bridge_technology *technology, s
*/
int ast_bridge_technology_unregister(struct ast_bridge_technology *technology);
/*!
* \brief Lets the bridging indicate when a bridge channel has stopped or started talking.
*
* \note All DSP functionality on the bridge has been pushed down to the lowest possible
* layer, which in this case is the specific bridging technology being used. Since it
* is necessary for the knowledge of which channels are talking to make its way up to the
* application, this function has been created to allow the bridging technology to communicate
* that information with the bridging core.
*
* \param bridge_channel The bridge channel that has either started or stopped talking.
* \param started_talking set to 1 when this indicates the channel has started talking set to 0
* when this indicates the channel has stopped talking.
*
* \retval 0 on success.
* \retval -1 on error.
*/
int ast_bridge_notify_talking(struct ast_bridge_channel *bridge_channel, int started_talking);
/*!
* \brief Suspend a bridge technology from consideration
*