[asterisk-commits] oej: branch 10 r337219 - in /branches/10: ./ configs/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 21 04:32:56 CDT 2011


Author: oej
Date: Wed Sep 21 04:32:50 2011
New Revision: 337219

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=337219
Log:
Make ast_pbx_run() not default to s at default if extension is not found

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

This is a bug - or architecture mistake - that has been in Asterisk for a 
very long time. It was exposed by the AMI originate action and possibly
some other applications. Most channel drivers checks if an extension
exists BEFORE starting a pbx on an inbound call, so most calls will
not depend on this issue.

Thanks everyone involved in the review and on IRC and the mailing list
for a quick review and all the feedback.

Modified:
    branches/10/CHANGES
    branches/10/configs/extensions.conf.sample
    branches/10/main/pbx.c

Modified: branches/10/CHANGES
URL: http://svnview.digium.com/svn/asterisk/branches/10/CHANGES?view=diff&rev=337219&r1=337218&r2=337219
==============================================================================
--- branches/10/CHANGES (original)
+++ branches/10/CHANGES Wed Sep 21 04:32:50 2011
@@ -220,13 +220,28 @@
 
 IAX2 Changes
 ------------
-* authdebug is now disabled by default. To enable this functionaility again
+ * authdebug is now disabled by default. To enable this functionaility again
    set authdebug = yes in iax.conf.
 
 RTP Changes
 -----------
  * The rtp.conf setting "strictrtp" is now enabled by default. In previous
    releases it was disabled.
+
+PBX Core
+--------
+ * The PBX core previously made a call with a non-existing extension test for
+   extension s at default and jump there if the extension existed.
+   This was a bad default behaviour and violated the principle of least surprise.
+   It has therefore been changed in this release. It may affect some
+   applications and configurations that rely on this behaviour. Most channel
+   drivers have avoided this for many releases by testing whether the extension
+   called exists before starting the PBX and generating a local error.
+   This behaviour still exists and works as before.
+
+   Extension "s" is used when no extension is given in a channel driver,
+   like immediate answer in DAHDI or calling to a domain with no user part
+   in a SIP uri.
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.2 to Asterisk 1.8 ----------------

Modified: branches/10/configs/extensions.conf.sample
URL: http://svnview.digium.com/svn/asterisk/branches/10/configs/extensions.conf.sample?view=diff&rev=337219&r1=337218&r2=337219
==============================================================================
--- branches/10/configs/extensions.conf.sample (original)
+++ branches/10/configs/extensions.conf.sample Wed Sep 21 04:32:50 2011
@@ -284,6 +284,10 @@
 ; Extension "s" is not a wildcard extension that matches "anything".
 ; In macros, it is the start extension. In most other cases,
 ; you have to goto "s" to execute that extension.
+;
+; Note: In old versions of Asterisk the PBX in some cases defaulted to
+; extension "s" when a given extension was wrong (like in AMI originate).
+; This is no longer the case.
 ;
 ; For wildcard matches, see above - all pattern matches start with
 ; an underscore.

Modified: branches/10/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/main/pbx.c?view=diff&rev=337219&r1=337218&r2=337219
==============================================================================
--- branches/10/main/pbx.c (original)
+++ branches/10/main/pbx.c Wed Sep 21 04:32:50 2011
@@ -4977,23 +4977,16 @@
 	autoloopflag = ast_test_flag(c, AST_FLAG_IN_AUTOLOOP);	/* save value to restore at the end */
 	ast_set_flag(c, AST_FLAG_IN_AUTOLOOP);
 
-	/* Start by trying whatever the channel is set to */
-	if (!ast_exists_extension(c, c->context, c->exten, c->priority,
-		S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
-		/* If not successful fall back to 's' */
+	if (ast_strlen_zero(c->exten)) {
+		/* If not successful fall back to 's' - but only if there is no given exten  */
 		ast_verb(2, "Starting %s at %s,%s,%d failed so falling back to exten 's'\n", c->name, c->context, c->exten, c->priority);
 		/* XXX the original code used the existing priority in the call to
 		 * ast_exists_extension(), and reset it to 1 afterwards.
 		 * I believe the correct thing is to set it to 1 immediately.
-		 */
+		*/
 		set_ext_pri(c, "s", 1);
-		if (!ast_exists_extension(c, c->context, c->exten, c->priority,
-			S_COR(c->caller.id.number.valid, c->caller.id.number.str, NULL))) {
-			/* JK02: And finally back to default if everything else failed */
-			ast_verb(2, "Starting %s at %s,%s,%d still failed so falling back to context 'default'\n", c->name, c->context, c->exten, c->priority);
-			ast_copy_string(c->context, "default", sizeof(c->context));
-		}
-	}
+	}
+
 	if (c->cdr) {
 		/* allow CDR variables that have been collected after channel was created to be visible during call */
 		ast_cdr_update(c);




More information about the asterisk-commits mailing list