summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2013-08-22 21:09:52 +0000
committerRichard Mudgett <rmudgett@digium.com>2013-08-22 21:09:52 +0000
commit477dea46616c0a6b79706f10349aaf9a87832e0e (patch)
tree50244a0102181406d83928d23e0ce45ff64169cf /include
parent24683444ac07743e202c6f6cae0364ee4057df4c (diff)
Bridge API: Set a cause code on a channel when it is ejected from a bridge.
The cause code needs to be passed from the disconnecting channel to the bridge peers if the disconnecting channel dissolves the bridge. * Made the call to an app_agent_pool agent disconnect with the busy cause code if the agent does not ack the call in time or hangs up before acking the call. (closes issue ASTERISK-22042) Reported by: Matt Jordan Review: https://reviewboard.asterisk.org/r/2772/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397472 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/bridge.h7
-rw-r--r--include/asterisk/bridge_channel.h16
-rw-r--r--include/asterisk/bridge_internal.h3
3 files changed, 18 insertions, 8 deletions
diff --git a/include/asterisk/bridge.h b/include/asterisk/bridge.h
index 9522962bc..d351b0fea 100644
--- a/include/asterisk/bridge.h
+++ b/include/asterisk/bridge.h
@@ -304,6 +304,8 @@ struct ast_bridge {
* \note Temporary as in try again in a moment.
*/
unsigned int inhibit_merge;
+ /*! Cause code of the dissolved bridge. */
+ int cause;
/*! TRUE if the bridge was reconfigured. */
unsigned int reconfigured:1;
/*! TRUE if the bridge has been dissolved. Any channel that now tries to join is immediately ejected. */
@@ -395,6 +397,7 @@ static inline void _ast_bridge_unlock(struct ast_bridge *bridge, const char *fil
* \brief Destroy a bridge
*
* \param bridge Bridge to destroy
+ * \param cause Cause of bridge being destroyed. (If cause <= 0 then use AST_CAUSE_NORMAL_CLEARING)
*
* \retval 0 on success
* \retval -1 on failure
@@ -402,12 +405,12 @@ static inline void _ast_bridge_unlock(struct ast_bridge *bridge, const char *fil
* Example usage:
*
* \code
- * ast_bridge_destroy(bridge);
+ * ast_bridge_destroy(bridge, AST_CAUSE_NORMAL_CLEARING);
* \endcode
*
* This destroys a bridge that was previously created.
*/
-int ast_bridge_destroy(struct ast_bridge *bridge);
+int ast_bridge_destroy(struct ast_bridge *bridge, int cause);
/*!
* \brief Notify bridging that this channel was just masqueraded.
diff --git a/include/asterisk/bridge_channel.h b/include/asterisk/bridge_channel.h
index 2d1dfd4f0..ae5131cef 100644
--- a/include/asterisk/bridge_channel.h
+++ b/include/asterisk/bridge_channel.h
@@ -239,36 +239,40 @@ int ast_bridge_channel_notify_talking(struct ast_bridge_channel *bridge_channel,
*
* \param bridge_channel Channel to change the state on
* \param new_state The new state to place the channel into
+ * \param cause Cause of channel leaving bridge.
+ * If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING.
*
* Example usage:
*
* \code
- * ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
+ * ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END, AST_CAUSE_NORMAL_CLEARING);
* \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(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state);
+void ast_bridge_channel_leave_bridge(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause);
/*!
* \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
+ * \param cause Cause of channel leaving bridge.
+ * If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING.
*
* Example usage:
*
* \code
- * ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END);
+ * ast_bridge_channel_leave_bridge(bridge_channel, BRIDGE_CHANNEL_STATE_END, AST_CAUSE_NORMAL_CLEARING);
* \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);
+void ast_bridge_channel_leave_bridge_nolock(struct ast_bridge_channel *bridge_channel, enum bridge_channel_state new_state, int cause);
/*!
* \brief Get the peer bridge channel of a two party bridge.
@@ -599,13 +603,15 @@ int ast_bridge_channel_write_park(struct ast_bridge_channel *bridge_channel, con
* \since 12.0.0
*
* \param bridge_channel Which channel is being kicked or hungup.
+ * \param cause Cause of channel being kicked.
+ * If cause <= 0 then use cause on channel if cause still <= 0 use AST_CAUSE_NORMAL_CLEARING.
*
* \note This is intended to be called by bridge hooks and the
* bridge channel thread.
*
* \return Nothing
*/
-void ast_bridge_channel_kick(struct ast_bridge_channel *bridge_channel);
+void ast_bridge_channel_kick(struct ast_bridge_channel *bridge_channel, int cause);
#if defined(__cplusplus) || defined(c_plusplus)
}
diff --git a/include/asterisk/bridge_internal.h b/include/asterisk/bridge_internal.h
index 4ff2fd2aa..871abb8c5 100644
--- a/include/asterisk/bridge_internal.h
+++ b/include/asterisk/bridge_internal.h
@@ -198,6 +198,7 @@ void bridge_reconfigured(struct ast_bridge *bridge, unsigned int colp_update);
* \since 12.0.0
*
* \param bridge Bridge to eject all channels
+ * \param cause Cause of bridge being dissolved. (If cause <= 0 then use AST_CAUSE_NORMAL_CLEARING)
*
* \details
* Force out all channels that are not already going out of the
@@ -207,6 +208,6 @@ void bridge_reconfigured(struct ast_bridge *bridge, unsigned int colp_update);
*
* \return Nothing
*/
-void bridge_dissolve(struct ast_bridge *bridge);
+void bridge_dissolve(struct ast_bridge *bridge, int cause);
#endif /* _ASTERISK_PRIVATE_BRIDGING_H */