Index: pbx/pbx_config.c
===================================================================
--- pbx/pbx_config.c	(revision 131907)
+++ pbx/pbx_config.c	(working copy)
@@ -47,7 +47,6 @@
 static int autofallthrough_config = 1;
 static int clearglobalvars_config = 0;
 static int extenpatternmatchnew_config = 0;
-static char *overrideswitch_config = NULL;
 
 AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
 
@@ -733,7 +732,7 @@
  */
 static char *handle_cli_dialplan_save(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
-	char filename[256], overrideswitch[256] = "";
+	char filename[256];
 	struct ast_context *c;
 	struct ast_config *cfg;
 	struct ast_variable *v;
@@ -813,15 +812,11 @@
 	}
 
 	/* fireout general info */
-	if (overrideswitch_config) {
-		snprintf(overrideswitch, sizeof(overrideswitch), "overrideswitch=%s\n", overrideswitch_config);
-	}
-	fprintf(output, "[general]\nstatic=%s\nwriteprotect=%s\nautofallthrough=%s\nclearglobalvars=%s\n%sextenpatternmatchnew=%s\n\n",
+	fprintf(output, "[general]\nstatic=%s\nwriteprotect=%s\nautofallthrough=%s\nclearglobalvars=%s\nextenpatternmatchnew=%s\n\n",
 		static_config ? "yes" : "no",
 		write_protect_config ? "yes" : "no",
                 autofallthrough_config ? "yes" : "no",
 				clearglobalvars_config ? "yes" : "no",
-				overrideswitch_config ? overrideswitch : "",
 				extenpatternmatchnew_config ? "yes" : "no");
 
 	if ((v = ast_variable_browse(cfg, "globals"))) {
@@ -1389,9 +1384,6 @@
 {
 	if (static_config && !write_protect_config)
 		ast_cli_unregister(&cli_dialplan_save);
-	if (overrideswitch_config) {
-		ast_free(overrideswitch_config);
-	}
 	ast_cli_unregister_multiple(cli_pbx_config, sizeof(cli_pbx_config) / sizeof(struct ast_cli_entry));
 	ast_context_destroy(NULL, registrar);
 	return 0;
@@ -1408,7 +1400,7 @@
 	struct ast_variable *v;
 	const char *cxt;
 	const char *aft;
-	const char *newpm, *ovsw;
+	const char *newpm;
 	struct ast_flags config_flags = { 0 };
 	cfg = ast_config_load(config_file, config_flags);
 	if (!cfg)
@@ -1422,16 +1414,7 @@
 	if ((newpm = ast_variable_retrieve(cfg, "general", "extenpatternmatchnew")))
 		extenpatternmatchnew_config = ast_true(newpm);
 	clearglobalvars_config = ast_true(ast_variable_retrieve(cfg, "general", "clearglobalvars"));
-	if ((ovsw = ast_variable_retrieve(cfg, "general", "overrideswitch"))) {
-		if (overrideswitch_config) {
-			ast_free(overrideswitch_config);
-		}
-		if (!ast_strlen_zero(ovsw)) {
-			overrideswitch_config = ast_strdup(ovsw);
-		} else {
-			overrideswitch_config = NULL;
-		}
-	}
+	
 
 	if ((cxt = ast_variable_retrieve(cfg, "general", "userscontext"))) 
 		ast_copy_string(userscontext, cxt, sizeof(userscontext));
@@ -1710,7 +1693,6 @@
 	for (con = NULL; (con = ast_walk_contexts(con));)
 		ast_context_verify_includes(con);
 
-	pbx_set_overrideswitch(overrideswitch_config);
 	pbx_set_autofallthrough(autofallthrough_config);
 	pbx_set_extenpatternmatchnew(extenpatternmatchnew_config);
 
Index: include/asterisk/pbx.h
===================================================================
--- include/asterisk/pbx.h	(revision 131907)
+++ include/asterisk/pbx.h	(working copy)
@@ -866,11 +866,6 @@
   the old linear-search algorithm.  Returns previous value. */
 int pbx_set_extenpatternmatchnew(int newval);
 
-/*! Set "overrideswitch" field.  If set and of nonzero length, all contexts
- * will be tried directly through the named switch prior to any other
- * matching within that context. */
-void pbx_set_overrideswitch(const char *newval);
-
 /*!
  * \note This function will handle locking the channel as needed.
  */
Index: main/pbx.c
===================================================================
--- main/pbx.c	(revision 131907)
+++ main/pbx.c	(working copy)
@@ -416,7 +416,6 @@
 
 static int autofallthrough = 1;
 static int extenpatternmatchnew = 0;
-static char *overrideswitch = NULL;
 
 /*! \brief Subscription for device state change events */
 static struct ast_event_sub *device_state_sub;
@@ -2101,65 +2100,6 @@
 	log_match_char_tree(tmp->pattern_tree, "::  ");
 #endif
 
-	do {
-		if (!ast_strlen_zero(overrideswitch)) {
-			char *osw = ast_strdupa(overrideswitch), *name;
-			struct ast_switch *asw;
-			ast_switch_f *aswf = NULL;
-			char *datap;
-			int eval = 0;
-
-			name = strsep(&osw, "/");
-			asw = pbx_findswitch(name);
-
-			if (!asw) {
-				ast_log(LOG_WARNING, "No such switch '%s'\n", name);
-				break;
-			}
-
-			if (osw && strchr(osw, '$')) {
-				eval = 1;
-			}
-
-			if (eval && !(tmpdata = ast_str_thread_get(&switch_data, 512))) {
-				ast_log(LOG_WARNING, "Can't evaluate overrideswitch?!");
-				break;
-			} else if (eval) {
-				/* Substitute variables now */
-				pbx_substitute_variables_helper(chan, osw, tmpdata->str, tmpdata->len);
-				datap = tmpdata->str;
-			} else {
-				datap = osw;
-			}
-
-			/* equivalent of extension_match_core() at the switch level */
-			if (action == E_CANMATCH)
-				aswf = asw->canmatch;
-			else if (action == E_MATCHMORE)
-				aswf = asw->matchmore;
-			else /* action == E_MATCH */
-				aswf = asw->exists;
-			if (!aswf) {
-				res = 0;
-			} else {
-				if (chan) {
-					ast_autoservice_start(chan);
-				}
-				res = aswf(chan, context, exten, priority, callerid, datap);
-				if (chan) {
-					ast_autoservice_stop(chan);
-				}
-			}
-			if (res) {	/* Got a match */
-				q->swo = asw;
-				q->data = datap;
-				q->foundcontext = context;
-				/* XXX keep status = STATUS_NO_CONTEXT ? */
-				return NULL;
-			}
-		}
-	} while (0);
-
 	if (extenpatternmatchnew) {
 		new_find_extension(exten, &score, tmp->pattern_tree, 0, 0, callerid, label, action);
 		eroot = score.exten;
@@ -4037,18 +3977,6 @@
 	return oldval;
 }
 
-void pbx_set_overrideswitch(const char *newval)
-{
-	if (overrideswitch) {
-		ast_free(overrideswitch);
-	}
-	if (!ast_strlen_zero(newval)) {
-		overrideswitch = ast_strdup(newval);
-	} else {
-		overrideswitch = NULL;
-	}
-}
-
 /*!
  * \brief lookup for a context with a given name,
  * \retval with conlock held if found.
