[asterisk-commits] rmudgett: branch rmudgett/hangup_handlers r368978 - in /team/rmudgett/hangup_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 14 17:46:43 CDT 2012


Author: rmudgett
Date: Thu Jun 14 17:46:40 2012
New Revision: 368978

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368978
Log:
Final tweaks before committing review 1984.

* Fix Return application being able to restore a dialplan location
exactly.  Channels without a PBX may not have context or exten set.

* Add verbose messages when the internal and AGI gosub routines are
started and are complete.

* Tweak builtin Hangup application.

Modified:
    team/rmudgett/hangup_handlers/apps/app_stack.c
    team/rmudgett/hangup_handlers/main/pbx.c

Modified: team/rmudgett/hangup_handlers/apps/app_stack.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hangup_handlers/apps/app_stack.c?view=diff&rev=368978&r1=368977&r2=368978
==============================================================================
--- team/rmudgett/hangup_handlers/apps/app_stack.c (original)
+++ team/rmudgett/hangup_handlers/apps/app_stack.c Thu Jun 14 17:46:40 2012
@@ -370,7 +370,18 @@
 		res = -1;
 	}
 
-	ast_explicit_goto(chan, oldframe->context, oldframe->extension, oldframe->priority);
+	/*
+	 * We cannot use ast_explicit_goto() because we MUST restore
+	 * what was there before.  Channels that do not have a PBX may
+	 * not have the context or exten set.
+	 */
+	ast_channel_context_set(chan, oldframe->context);
+	ast_channel_exten_set(chan, oldframe->extension);
+	if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP)) {
+		--oldframe->priority;
+	}
+	ast_channel_priority_set(chan, oldframe->priority);
+
 	gosub_release_frame(chan, oldframe);
 
 	/* Set a return value, if any */
@@ -902,6 +913,9 @@
 	int res;
 
 	ast_channel_lock(chan);
+
+	ast_verb(3, "%s Internal %s(%s) start\n",
+		ast_channel_name(chan), app_gosub, sub_args);
 
 	/* Save non-hangup softhangup flags. */
 	saved_hangup_flags = ast_channel_softhangup_internal_flag(chan)
@@ -997,8 +1011,8 @@
 		if (ast_channel_priority(chan) == saved_priority
 			&& !strcmp(ast_channel_context(chan), saved_context)
 			&& !strcmp(ast_channel_exten(chan), saved_exten)) {
-			ast_verb(3, "%s Internal Gosub call complete GOSUB_RETVAL=%s\n",
-				ast_channel_name(chan),
+			ast_verb(3, "%s Internal %s(%s) complete GOSUB_RETVAL=%s\n",
+				ast_channel_name(chan), app_gosub, sub_args,
 				S_OR(pbx_builtin_getvar_helper(chan, "GOSUB_RETVAL"), ""));
 		} else {
 			ast_log(LOG_NOTICE, "%s Abnormal '%s(%s)' exit.  Popping routine return locations.\n",
@@ -1084,7 +1098,7 @@
 
 	ast_channel_lock(chan);
 
-	ast_debug(1, "%s Trying AGI %s(%s)\n", ast_channel_name(chan), app_gosub, gosub_args);
+	ast_verb(3, "%s AGI %s(%s) start\n", ast_channel_name(chan), app_gosub, gosub_args);
 
 	/* Save autoloop flag */
 	old_autoloopflag = ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP);
@@ -1149,8 +1163,8 @@
 		if (ast_channel_priority(chan) == old_priority
 			&& !strcmp(ast_channel_context(chan), old_context)
 			&& !strcmp(ast_channel_exten(chan), old_extension)) {
-			ast_verb(3, "%s Internal Gosub call complete GOSUB_RETVAL=%s\n",
-				ast_channel_name(chan),
+			ast_verb(3, "%s AGI %s(%s) complete GOSUB_RETVAL=%s\n",
+				ast_channel_name(chan), app_gosub, gosub_args,
 				S_OR(pbx_builtin_getvar_helper(chan, "GOSUB_RETVAL"), ""));
 			abnormal_exit = 0;
 		} else {

Modified: team/rmudgett/hangup_handlers/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/hangup_handlers/main/pbx.c?view=diff&rev=368978&r1=368977&r2=368978
==============================================================================
--- team/rmudgett/hangup_handlers/main/pbx.c (original)
+++ team/rmudgett/hangup_handlers/main/pbx.c Thu Jun 14 17:46:40 2012
@@ -10039,9 +10039,9 @@
 	ast_channel_lock(chan);
 	if (cause <= 0) {
 		cause = ast_channel_hangupcause(chan);
-	}
-	if (cause <= 0) {
-		cause = AST_CAUSE_NORMAL_CLEARING;
+		if (cause <= 0) {
+			cause = AST_CAUSE_NORMAL_CLEARING;
+		}
 	}
 	ast_channel_hangupcause_set(chan, cause);
 	ast_softhangup_nolock(chan, AST_SOFTHANGUP_EXPLICIT);




More information about the asterisk-commits mailing list