aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-10 18:31:38 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2008-10-10 18:31:38 +0000
commit0865c8f92169dc66a5bda99010caa4ea0126d5f9 (patch)
tree4cda3faf6ec3142527af429d06193574669db1bc /pbx
parentec24a1e5575f6a1f7fc87c120c7e5c57a45636ce (diff)
Add keyword "same", which allows you to create multiple steps in a dialplan,
without needing to respecify an extension pattern multiple times. (closes issue #13632) Reported by: blitzrage Patches: 20081006__bug13632.diff.txt uploaded by Corydon76 (license 14) Tested by: blitzrage, Corydon76 git-svn-id: http://svn.digium.com/svn/asterisk/trunk@148325 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_config.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 2d93fd8fe..e2b38c15d 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1410,6 +1410,7 @@ static int pbx_load_config(const char *config_file)
const char *aft;
const char *newpm, *ovsw;
struct ast_flags config_flags = { 0 };
+ char lastextension[256] = "";
cfg = ast_config_load(config_file, config_flags);
if (!cfg)
return 0;
@@ -1451,18 +1452,26 @@ static int pbx_load_config(const char *config_file)
continue;
for (v = ast_variable_browse(cfg, cxt); v; v = v->next) {
- if (!strcasecmp(v->name, "exten")) {
- char *tc = ast_strdup(v->value);
- if (tc) {
+ char *tc = NULL;
+ char realext[256] = "";
+ char *stringp, *ext;
+ if (!strncasecmp(v->name, "same", 4)) {
+ if ((stringp = tc = ast_strdup(v->value))) {
+ ast_copy_string(realext, lastextension, sizeof(realext));
+ goto copy_last_extension;
+ }
+ } else if (!strcasecmp(v->name, "exten")) {
+ if ((tc = ast_strdup(v->value))) {
int ipri = -2;
- char realext[256]="";
char *plus, *firstp;
char *pri, *appl, *data, *cidmatch;
- char *stringp = tc;
- char *ext = strsep(&stringp, ",");
- if (!ext)
- ext="";
+ stringp = tc;
+ if (!(ext = strsep(&stringp, ","))) {
+ ext = "";
+ }
pbx_substitute_variables_helper(NULL, ext, realext, sizeof(realext) - 1);
+ ast_copy_string(lastextension, realext, sizeof(lastextension));
+copy_last_extension:
cidmatch = strchr(realext, '/');
if (cidmatch) {
*cidmatch++ = '\0';