[asterisk-commits] alecdavis: trunk r287756 - in /trunk: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 20 18:43:03 CDT 2010


Author: alecdavis
Date: Mon Sep 20 18:42:56 2010
New Revision: 287756

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=287756
Log:
Merged revisions 287685 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
  r287685 | alecdavis | 2010-09-21 11:16:45 +1200 (Tue, 21 Sep 2010) | 18 lines
  
  ast_channel_masquerade: Avoid recursive masquerades.
  
  Check all 4 combinations of (original/clonechan) * (masq/masqr).
  
  Initially original->masq and clonechan->masqr were only checked.
  
  It's possible with multiple masq's planned - and not yet executed, that
   the 'original' chan could already have another masq'd into it - thus original->masqr
  would be set, that masqr would lost.
  Likewise for the clonechan->masq.
  
  (closes issue #16057;#17363)
  Reported by: amorsen;davidw,alecdavis
  Patches: 
        based on bug16057.diff4.txt uploaded by alecdavis (license 585)
  Tested by: ramonpeek, davidw, alecdavis
........

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
            ('branch-1.8-blocked' removed)

Propchange: trunk/
            ('branch-1.8-merged' removed)

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=287756&r1=287755&r2=287756
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Sep 20 18:42:56 2010
@@ -5617,19 +5617,27 @@
 
 	ast_debug(1, "Planning to masquerade channel %s into the structure of %s\n",
 		clonechan->name, original->name);
-	if (original->masq) {
-		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
-			original->masq->name, original->name);
-	} else if (clonechan->masqr) {
-		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
-			clonechan->name, clonechan->masqr->name);
-	} else {
+
+	if (!original->masqr && !original->masq && !clonechan->masq && !clonechan->masqr) {
 		original->masq = clonechan;
 		clonechan->masqr = original;
 		ast_queue_frame(original, &ast_null_frame);
 		ast_queue_frame(clonechan, &ast_null_frame);
 		ast_debug(1, "Done planning to masquerade channel %s into the structure of %s\n", clonechan->name, original->name);
 		res = 0;
+	} else if (original->masq) {
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			original->masq->name, original->name);
+	} else if (original->masqr) {
+		/* not yet as a previously planned masq hasn't yet happened */
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			original->name, original->masqr->name);
+	} else if (clonechan->masq) {
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+			clonechan->masq->name, clonechan->name);
+	} else { /* (clonechan->masqr) */
+		ast_log(LOG_WARNING, "%s is already going to masquerade as %s\n",
+		clonechan->name, clonechan->masqr->name);
 	}
 
 	ast_channel_unlock(clonechan);




More information about the asterisk-commits mailing list