mirror of
https://github.com/asterisk/asterisk.git
synced 2025-12-12 18:12:33 +00:00
Save CID and switches in "save dialplan" command (bug #2279)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3630 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -503,6 +503,8 @@ char *ast_get_switch_data(struct ast_sw *sw);
|
|||||||
|
|
||||||
/* Other extension stuff */
|
/* Other extension stuff */
|
||||||
int ast_get_extension_priority(struct ast_exten *exten);
|
int ast_get_extension_priority(struct ast_exten *exten);
|
||||||
|
int ast_get_extension_matchcid(struct ast_exten *e);
|
||||||
|
char *ast_get_extension_cidmatch(struct ast_exten *e);
|
||||||
char *ast_get_extension_app(struct ast_exten *e);
|
char *ast_get_extension_app(struct ast_exten *e);
|
||||||
void *ast_get_extension_app_data(struct ast_exten *e);
|
void *ast_get_extension_app_data(struct ast_exten *e);
|
||||||
|
|
||||||
|
|||||||
10
pbx.c
10
pbx.c
@@ -4864,6 +4864,16 @@ char *ast_get_ignorepat_registrar(struct ast_ignorepat *ip)
|
|||||||
return ip ? ip->registrar : NULL;
|
return ip ? ip->registrar : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ast_get_extension_matchcid(struct ast_exten *e)
|
||||||
|
{
|
||||||
|
return e ? e->matchcid : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ast_get_extension_cidmatch(struct ast_exten *e)
|
||||||
|
{
|
||||||
|
return e ? e->cidmatch : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char *ast_get_extension_app(struct ast_exten *e)
|
char *ast_get_extension_app(struct ast_exten *e)
|
||||||
{
|
{
|
||||||
return e ? e->app : NULL;
|
return e ? e->app : NULL;
|
||||||
|
|||||||
@@ -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_exten *e, *last_written_e = NULL;
|
||||||
struct ast_include *i;
|
struct ast_include *i;
|
||||||
struct ast_ignorepat *ip;
|
struct ast_ignorepat *ip;
|
||||||
|
struct ast_sw *sw;
|
||||||
|
|
||||||
/* registered by this module? */
|
/* registered by this module? */
|
||||||
if (!strcmp(ast_get_context_registrar(c), registrar)) {
|
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;
|
tempdata = startdata;
|
||||||
}
|
}
|
||||||
fprintf(output, "exten => %s,%d,%s(%s)\n",
|
if (ast_get_extension_matchcid(p))
|
||||||
ast_get_extension_name(p),
|
fprintf(output, "exten => %s/%s,%d,%s(%s)\n",
|
||||||
ast_get_extension_priority(p),
|
ast_get_extension_name(p),
|
||||||
ast_get_extension_app(p),
|
ast_get_extension_cidmatch(p),
|
||||||
tempdata);
|
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)
|
if (tempdata)
|
||||||
free(tempdata);
|
free(tempdata);
|
||||||
} else
|
} else
|
||||||
@@ -1097,6 +1106,24 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
|
|||||||
if (ast_walk_context_includes(c, NULL))
|
if (ast_walk_context_includes(c, NULL))
|
||||||
fprintf(output, "\n");
|
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 ... */
|
/* fireout ignorepats ... */
|
||||||
ip = ast_walk_context_ignorepats(c, NULL);
|
ip = ast_walk_context_ignorepats(c, NULL);
|
||||||
while (ip) {
|
while (ip) {
|
||||||
|
|||||||
Reference in New Issue
Block a user