aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-21 18:55:39 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2004-08-21 18:55:39 +0000
commit94057171acf1f336b5f2655a3ec1f8746fa7feb4 (patch)
treef1efa8fc2c3644c6093ea329dbd74dd393ab2bdf /pbx
parent2144646c416b6dece22336e254985d8a32dc33cb (diff)
Save CID and switches in "save dialplan" command (bug #2279)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@3630 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rwxr-xr-xpbx/pbx_config.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index e82c49737..39fd33244 100755
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -1016,6 +1016,7 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
struct ast_exten *e, *last_written_e = NULL;
struct ast_include *i;
struct ast_ignorepat *ip;
+ struct ast_sw *sw;
/* registered by this module? */
if (!strcmp(ast_get_context_registrar(c), registrar)) {
@@ -1058,11 +1059,19 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
}
tempdata = startdata;
}
- fprintf(output, "exten => %s,%d,%s(%s)\n",
- ast_get_extension_name(p),
- ast_get_extension_priority(p),
- ast_get_extension_app(p),
- tempdata);
+ if (ast_get_extension_matchcid(p))
+ fprintf(output, "exten => %s/%s,%d,%s(%s)\n",
+ ast_get_extension_name(p),
+ ast_get_extension_cidmatch(p),
+ ast_get_extension_priority(p),
+ ast_get_extension_app(p),
+ tempdata);
+ else
+ fprintf(output, "exten => %s,%d,%s(%s)\n",
+ ast_get_extension_name(p),
+ ast_get_extension_priority(p),
+ ast_get_extension_app(p),
+ tempdata);
if (tempdata)
free(tempdata);
} else
@@ -1097,6 +1106,24 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
if (ast_walk_context_includes(c, NULL))
fprintf(output, "\n");
+ /* walk through switches */
+ sw = ast_walk_context_switches(c, NULL);
+ while (sw) {
+ if (!strcmp(ast_get_switch_registrar(sw), registrar)) {
+ if (!context_header_written) {
+ fprintf(output, "[%s]\n", ast_get_context_name(c));
+ context_header_written = 1;
+ }
+ fprintf(output, "switch => %s/%s\n",
+ ast_get_switch_name(sw),
+ ast_get_switch_data(sw));
+ }
+ sw = ast_walk_context_switches(c, sw);
+ }
+
+ if (ast_walk_context_switches(c, NULL))
+ fprintf(output, "\n");
+
/* fireout ignorepats ... */
ip = ast_walk_context_ignorepats(c, NULL);
while (ip) {