[asterisk-commits] mmichelson: branch mmichelson/atxfer_features r393482 - /team/mmichelson/atxf...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 2 15:01:09 CDT 2013
Author: mmichelson
Date: Tue Jul 2 15:01:08 2013
New Revision: 393482
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393482
Log:
Add some more doxygen and remove an unnecessary call to detach a framehook.
The framehook is always detached by either the callback running successfully
or the channel being hung up. There is never a reason to detach the framehook
manually during transfer shutdown.
Modified:
team/mmichelson/atxfer_features/main/bridging_basic.c
Modified: team/mmichelson/atxfer_features/main/bridging_basic.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/atxfer_features/main/bridging_basic.c?view=diff&rev=393482&r1=393481&r2=393482
==============================================================================
--- team/mmichelson/atxfer_features/main/bridging_basic.c (original)
+++ team/mmichelson/atxfer_features/main/bridging_basic.c Tue Jul 2 15:01:08 2013
@@ -1077,14 +1077,6 @@
if (props->transferee_bridge) {
ast_bridge_merge_inhibit(props->transferee_bridge, -1);
bridge_basic_change_personality_normal(props->transferee_bridge);
- }
-
- if (props->transfer_target) {
- SCOPED_CHANNELLOCK(lock, props->transfer_target);
-
- if (props->target_framehook_id != -1) {
- ast_framehook_detach(props->transfer_target, props->target_framehook_id);
- }
}
if (props->target_bridge) {
@@ -1818,7 +1810,11 @@
* normal personality
*/
ast_bridge_features_ds_set(props->recall_target, &props->transferer_features);
- ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL, 1);
+ ast_channel_ref(props->recall_target);
+ if (ast_bridge_impart(props->transferee_bridge, props->recall_target, NULL, NULL, 1)) {
+ ast_hangup(props->recall_target);
+ return TRANSFER_FAIL;
+ }
return TRANSFER_RESUME;
case STIMULUS_NONE:
case STIMULUS_DTMF_ATXFER_ABORT:
@@ -2011,6 +2007,11 @@
ast_mutex_unlock(&props->lock);
}
+/*!
+ * \brief DTMF hook when transferer presses abort sequence.
+ *
+ * Sends a stimulus to the attended transfer monitor thread that the abort sequence has been pressed
+ */
static int atxfer_abort(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct attended_transfer_properties *props = hook_pvt;
@@ -2019,6 +2020,11 @@
return 0;
}
+/*!
+ * \brief DTMF hook when transferer presses complete sequence.
+ *
+ * Sends a stimulus to the attended transfer monitor thread that the complete sequence has been pressed
+ */
static int atxfer_complete(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct attended_transfer_properties *props = hook_pvt;
@@ -2027,6 +2033,11 @@
return 0;
}
+/*!
+ * \brief DTMF hook when transferer presses threeway sequence.
+ *
+ * Sends a stimulus to the attended transfer monitor thread that the threeway sequence has been pressed
+ */
static int atxfer_threeway(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct attended_transfer_properties *props = hook_pvt;
@@ -2035,6 +2046,11 @@
return 0;
}
+/*!
+ * \brief DTMF hook when transferer presses swap sequence.
+ *
+ * Sends a stimulus to the attended transfer monitor thread that the swap sequence has been pressed
+ */
static int atxfer_swap(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct attended_transfer_properties *props = hook_pvt;
@@ -2043,6 +2059,11 @@
return 0;
}
+/*!
+ * \brief Hangup hook for transferer channel.
+ *
+ * Sends a stimulus to the attended transfer monitor thread that the transferer has hung up.
+ */
static int atxfer_transferer_hangup(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, void *hook_pvt)
{
struct attended_transfer_properties *props = hook_pvt;
@@ -2051,6 +2072,20 @@
return 0;
}
+/*!
+ * \brief Frame hook for transfer target channel
+ *
+ * This is used to determine if the transfer target or recall target has answered
+ * the outgoing call.
+ *
+ * When an answer is detected, a stimulus is sent to the attended transfer monitor
+ * thread to indicate that the transfer target or recall target has answered.
+ *
+ * \param chan The channel the framehook is attached to.
+ * \param frame The frame being read or written.
+ * \param event What is being done with the frame.
+ * \param data The attended transfer properties.
+ */
static struct ast_frame *transfer_target_framehook_cb(struct ast_channel *chan,
struct ast_frame *frame, enum ast_framehook_event event, void *data)
{
@@ -2077,6 +2112,13 @@
ao2_cleanup(props);
}
+/*!
+ * \brief Dial callback when attempting to recall the original transferer channel
+ *
+ * This is how we can monitor if the recall target has answered or has hung up.
+ * If one of the two is detected, then an appropriate stimulus is sent to the
+ * attended transfer monitor thread.
+ */
static void recall_callback(struct ast_dial *dial)
{
struct attended_transfer_properties *props = ast_dial_get_user_data(dial);
@@ -2100,10 +2142,6 @@
case AST_DIAL_RESULT_ANSWERED:
/* We struck gold! */
props->recall_target = ast_dial_answered_steal(dial);
- /* We need this reference because when we impart the channel into a bridge later, the impart will
- * steal a reference
- */
- ast_channel_ref(props->recall_target);
stimulate_attended_transfer(props, STIMULUS_RECALL_TARGET_ANSWER);
break;
}
More information about the asterisk-commits
mailing list