[svn-commits] mjordan: trunk r428506 - in /trunk: ./ main/bridge_basic.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Nov 20 20:17:18 CST 2014


Author: mjordan
Date: Thu Nov 20 20:17:15 2014
New Revision: 428506

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=428506
Log:
main/bridge_basic: Fix features regressions introduced by r428165

In r428165, two bugs were introduced:

* Prior to entering the features retry loop, the buffer that holds the
  collected digits is wiped. However, this inadvertently wipes out the
  first collected digit on the first pass through, which is obtained
  in ast_stream_and_wait. This caused all of the features tests to fail.
* If ast_app_dtget returns a hangup (-1), the loop would retry incorrectly.
  If we detect a hangup, we have to stop trying the feature.

This patch fixes both issues.

Review: https://reviewboard.asterisk.org/r/4196/
........

Merged revisions 428505 from http://svn.asterisk.org/svn/asterisk/branches/13

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

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/main/bridge_basic.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridge_basic.c?view=diff&rev=428506&r1=428505&r2=428506
==============================================================================
--- trunk/main/bridge_basic.c (original)
+++ trunk/main/bridge_basic.c Thu Nov 20 20:17:15 2014
@@ -3012,12 +3012,18 @@
 	/* Drop to dialtone so they can enter the extension they want to transfer to */
 	do {
 		++attempts;
-		memset(exten, 0, exten_len);
+
 		ast_test_suite_event_notify("TRANSFER_BEGIN_DIAL",
 				"Channel: %s\r\n"
 				"Attempt: %d",
 				ast_channel_name(chan), attempts);
 		res = ast_app_dtget(chan, context, exten, exten_len, exten_len - 1, digit_timeout);
+		ast_test_suite_event_notify("TRANSFER_DIALLED",
+				"Channel: %s\r\n"
+				"Attempt: %d\r\n"
+				"Dialled: %s\r\n"
+				"Result: %s",
+				ast_channel_name(chan), attempts, exten, res > 0 ? "Success" : "Failure");
 		if (res < 0) {
 			/* Hangup or error */
 			res = -1;
@@ -3034,25 +3040,20 @@
 			} else {
 				ast_stream_and_wait(chan, invalid_sound, AST_DIGIT_NONE);
 			}
-			res = -1;
+			memset(exten, 0, exten_len);
+			res = 1;
 		} else {
 			/* Dialed extension is valid. */
 			res = 0;
 		}
-		ast_test_suite_event_notify("TRANSFER_DIALLED",
-				"Channel: %s\r\n"
-				"Attempt: %d\r\n"
-				"Dialled: %s\r\n"
-				"Result: %s",
-				ast_channel_name(chan), attempts, exten, res == 0 ? "Success" : "Failure");
-	} while (res < 0 && attempts < max_attempts);
+	} while (res > 0 && attempts < max_attempts);
 
 	ast_test_suite_event_notify("TRANSFER_DIAL_FINAL",
 			"Channel: %s\r\n"
 			"Result: %s",
 			ast_channel_name(chan), res == 0 ? "Success" : "Failure");
 
-	return res;
+	return res ? -1 : 0;
 }
 
 static void copy_caller_data(struct ast_channel *dest, struct ast_channel *caller)




More information about the svn-commits mailing list