[asterisk-commits] rmudgett: branch 1.8 r401378 - /branches/1.8/channels/sig_analog.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 21 19:13:54 CDT 2013


Author: rmudgett
Date: Mon Oct 21 19:13:53 2013
New Revision: 401378

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401378
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.

Modified:
    branches/1.8/channels/sig_analog.c

Modified: branches/1.8/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/sig_analog.c?view=diff&rev=401378&r1=401377&r2=401378
==============================================================================
--- branches/1.8/channels/sig_analog.c (original)
+++ branches/1.8/channels/sig_analog.c Mon Oct 21 19:13:53 2013
@@ -679,13 +679,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)
 {
@@ -693,6 +691,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;
@@ -720,15 +719,8 @@
 			bridge_3way, &owner_3way->connected, !inthreeway)) {
 			ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
 				bridge_3way->name, owner_real->name);
-			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", owner_real->name, owner_3way->name);
@@ -746,18 +738,19 @@
 			!inthreeway, bridge_real, &owner_real->connected, 0)) {
 			ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
 				bridge_real->name, owner_3way->name);
-			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",
 			owner_real->name, owner_3way->name);
-		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)
@@ -2881,16 +2874,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