[asterisk-commits] rmudgett: branch 11 r401379 - in /branches/11: ./ channels/sig_analog.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 21 19:16:26 CDT 2013
Author: rmudgett
Date: Mon Oct 21 19:16:24 2013
New Revision: 401379
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401379
Log:
chan_dahdi: Fix unable to get index warning when transferring an analog call.
Transferring an analog call using flashhooks generated an unable to get
index WARNING message when the transfer is completed.
* Removed unnecessary analog subchannel shell games when transferring a
call using flashhooks.
Thanks to Tzafrir Cohen for mentioning this in a comment on issue
ASTERISK-22720.
........
Merged revisions 401378 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/11/ (props changed)
branches/11/channels/sig_analog.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/11/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/sig_analog.c?view=diff&rev=401379&r1=401378&r2=401379
==============================================================================
--- branches/11/channels/sig_analog.c (original)
+++ branches/11/channels/sig_analog.c Mon Oct 21 19:16:24 2013
@@ -689,13 +689,11 @@
* \param p Analog private structure.
* \param inthreeway TRUE if the 3-way call is conferenced.
*
- * \note
- * On entry these locks are held: real-call, private, 3-way call.
+ * \note On entry these locks are held: real-call, private, 3-way call.
+ * \note On exit these locks are held: real-call, private.
*
- * \retval 1 Transfer successful. 3-way call is unlocked and subchannel is unalloced.
- * Swapped real and 3-way subchannel.
- * \retval 0 Transfer successful. 3-way call is unlocked and subchannel is unalloced.
- * \retval -1 on error. Caller must unlock 3-way call.
+ * \retval 0 on success.
+ * \retval -1 on error.
*/
static int analog_attempt_transfer(struct analog_pvt *p, int inthreeway)
{
@@ -703,6 +701,7 @@
struct ast_channel *owner_3way;
struct ast_channel *bridge_real;
struct ast_channel *bridge_3way;
+ int ret = 0;
owner_real = p->subs[ANALOG_SUB_REAL].owner;
owner_3way = p->subs[ANALOG_SUB_THREEWAY].owner;
@@ -730,15 +729,8 @@
bridge_3way, ast_channel_connected(owner_3way), !inthreeway)) {
ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
ast_channel_name(bridge_3way), ast_channel_name(owner_real));
- return -1;
- }
-
- /* Three-way is now the REAL */
- analog_swap_subs(p, ANALOG_SUB_THREEWAY, ANALOG_SUB_REAL);
- ast_channel_unlock(owner_3way);
- analog_unalloc_sub(p, ANALOG_SUB_THREEWAY);
- /* Tell the caller not to hangup */
- return 1;
+ ret = -1;
+ }
} else if (bridge_real) {
/* Try transferring the other way. */
ast_verb(3, "TRANSFERRING %s to %s\n", ast_channel_name(owner_real), ast_channel_name(owner_3way));
@@ -756,18 +748,19 @@
!inthreeway, bridge_real, ast_channel_connected(owner_real), 0)) {
ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
ast_channel_name(bridge_real), ast_channel_name(owner_3way));
- return -1;
- }
-
- /* Orphan the channel after releasing the lock */
- ast_channel_unlock(owner_3way);
- analog_unalloc_sub(p, ANALOG_SUB_THREEWAY);
- return 0;
+ ret = -1;
+ }
} else {
ast_debug(1, "Neither %s nor %s are in a bridge, nothing to transfer\n",
ast_channel_name(owner_real), ast_channel_name(owner_3way));
- return -1;
- }
+ ret = -1;
+ }
+
+ if (ret) {
+ ast_softhangup_nolock(owner_3way, AST_SOFTHANGUP_DEV);
+ }
+ ast_channel_unlock(owner_3way);
+ return ret;
}
static int analog_update_conf(struct analog_pvt *p)
@@ -2912,16 +2905,13 @@
analog_set_new_owner(p, NULL);
/* Ring the phone */
analog_ring(p);
- } else {
- res = analog_attempt_transfer(p, inthreeway);
- if (res < 0) {
- /* Transfer attempt failed. */
- ast_softhangup_nolock(p->subs[ANALOG_SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
- ast_channel_unlock(p->subs[ANALOG_SUB_THREEWAY].owner);
- } else if (res) {
- /* Don't actually hang up at this point */
- break;
- }
+ } else if (!analog_attempt_transfer(p, inthreeway)) {
+ /*
+ * Transfer successful. Don't actually hang up at this point.
+ * Let our channel legs of the calls die off as the transfer
+ * percolates through the core.
+ */
+ break;
}
} else {
ast_softhangup_nolock(p->subs[ANALOG_SUB_THREEWAY].owner, AST_SOFTHANGUP_DEV);
More information about the asterisk-commits
mailing list