summaryrefslogtreecommitdiff
path: root/pbx
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2006-09-21 21:59:12 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2006-09-21 21:59:12 +0000
commit6ae874151842eef4da11c870c418dc4b2b6c9d4b (patch)
treef166bba69d92b06b74ab2323297f68cfcd7789fb /pbx
parentf1d824aabacb3dfbda8c406e0d4e22c279cf2638 (diff)
Lots more removal of deprecated things
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43452 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_config.c851
1 files changed, 8 insertions, 843 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index f49b14467..d76aa68db 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -114,25 +114,6 @@ static char reload_extensions_help[] =
/*!
* REMOVE INCLUDE command stuff
*/
-static int handle_context_dont_include_deprecated(int fd, int argc, char *argv[])
-{
- if (argc != 5)
- return RESULT_SHOWUSAGE;
-
- if (strcmp(argv[3], "into"))
- return RESULT_SHOWUSAGE;
-
- if (!ast_context_remove_include(argv[4], argv[2], registrar)) {
- ast_cli(fd, "We are not including '%s' into '%s' now\n",
- argv[2], argv[4]);
- return RESULT_SUCCESS;
- }
-
- ast_cli(fd, "Failed to remove '%s' include from '%s' context\n",
- argv[2], argv[4]);
- return RESULT_FAILURE;
-}
-
static int handle_context_remove_include(int fd, int argc, char *argv[])
{
if (argc != 6)
@@ -227,127 +208,6 @@ static int split_ec(const char *src, char **ext, char ** const ctx)
}
/* _X_ is the string we need to complete */
-static char *complete_context_dont_include_deprecated(const char *line, const char *word,
- int pos, int state)
-{
- int which = 0;
- char *res = NULL;
- int len = strlen(word); /* how many bytes to match */
- struct ast_context *c = NULL;
-
- if (pos == 2) { /* "dont include _X_" */
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- return NULL;
- }
- /* walk contexts and their includes, return the n-th match */
- while (!res && (c = ast_walk_contexts(c))) {
- struct ast_include *i = NULL;
-
- if (ast_lock_context(c)) /* error ? skip this one */
- continue;
-
- while ( !res && (i = ast_walk_context_includes(c, i)) ) {
- const char *i_name = ast_get_include_name(i);
- struct ast_context *nc = NULL;
- int already_served = 0;
-
- if (!partial_match(i_name, word, len))
- continue; /* not matched */
-
- /* check if this include is already served or not */
-
- /* go through all contexts again till we reach actual
- * context or already_served = 1
- */
- while ( (nc = ast_walk_contexts(nc)) && nc != c && !already_served)
- already_served = lookup_ci(nc, i_name);
-
- if (!already_served && ++which > state)
- res = strdup(i_name);
- }
- ast_unlock_context(c);
- }
-
- ast_unlock_contexts();
- return res;
- } else if (pos == 3) { /* "dont include CTX _X_" */
- /*
- * complete as 'in', but only if previous context is really
- * included somewhere
- */
- char *context, *dupline;
- const char *s = skip_words(line, 2); /* skip 'dont' 'include' */
-
- if (state > 0)
- return NULL;
- context = dupline = strdup(s);
- if (!dupline) {
- ast_log(LOG_ERROR, "Out of free memory\n");
- return NULL;
- }
- strsep(&dupline, " ");
-
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock contexts list\n");
- free(context);
- return NULL;
- }
-
- /* go through all contexts and check if is included ... */
- while (!res && (c = ast_walk_contexts(c)))
- if (lookup_ci(c, context)) /* context is really included, complete "in" command */
- res = strdup("in");
- ast_unlock_contexts();
- if (!res)
- ast_log(LOG_WARNING, "%s not included anywhere\n", context);
- free(context);
- return res;
- } else if (pos == 4) { /* "dont include CTX in _X_" */
- /*
- * Context from which we removing include ...
- */
- char *context, *dupline, *in;
- const char *s = skip_words(line, 2); /* skip 'dont' 'include' */
- context = dupline = strdup(s);
- if (!dupline) {
- ast_log(LOG_ERROR, "Out of free memory\n");
- return NULL;
- }
-
- strsep(&dupline, " "); /* skip context */
-
- /* third word must be 'in' */
- in = strsep(&dupline, " ");
- if (!in || strcmp(in, "in")) {
- free(context);
- return NULL;
- }
-
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- free(context);
- return NULL;
- }
-
- /* walk through all contexts ... */
- c = NULL;
- while ( !res && (c = ast_walk_contexts(c))) {
- const char *c_name = ast_get_context_name(c);
- if (!partial_match(c_name, word, len)) /* not a good target */
- continue;
- /* walk through all includes and check if it is our context */
- if (lookup_ci(c, context) && ++which > state)
- res = strdup(c_name);
- }
- ast_unlock_contexts();
- free(context);
- return res;
- }
-
- return NULL;
-}
-
static char *complete_context_remove_include(const char *line, const char *word,
int pos, int state)
{
@@ -472,73 +332,6 @@ static char *complete_context_remove_include(const char *line, const char *word,
/*!
* REMOVE EXTENSION command stuff
*/
-static int handle_context_remove_extension_deprecated(int fd, int argc, char *argv[])
-{
- int removing_priority = 0;
- char *exten, *context;
- int ret = RESULT_FAILURE;
-
- if (argc != 4 && argc != 3) return RESULT_SHOWUSAGE;
-
- /*
- * Priority input checking ...
- */
- if (argc == 4) {
- char *c = argv[3];
-
- /* check for digits in whole parameter for right priority ...
- * why? because atoi (strtol) returns 0 if any characters in
- * string and whole extension will be removed, it's not good
- */
- if (!strcmp("hint", c))
- removing_priority = PRIORITY_HINT;
- else {
- while (*c && isdigit(*c))
- c++;
- if (*c) { /* non-digit in string */
- ast_cli(fd, "Invalid priority '%s'\n", argv[3]);
- return RESULT_FAILURE;
- }
- removing_priority = atoi(argv[3]);
- }
-
- if (removing_priority == 0) {
- ast_cli(fd, "If you want to remove whole extension, please " \
- "omit priority argument\n");
- return RESULT_FAILURE;
- }
- }
-
- /* XXX original overwrote argv[2] */
- /*
- * Format exten@context checking ...
- */
- if (split_ec(argv[2], &exten, &context))
- return RESULT_FAILURE; /* XXX malloc failure */
- if ((!strlen(exten)) || (!(strlen(context)))) {
- ast_cli(fd, "Missing extension or context name in second argument '%s'\n",
- argv[2]);
- free(exten);
- return RESULT_FAILURE;
- }
-
- if (!ast_context_remove_extension(context, exten, removing_priority, registrar)) {
- if (!removing_priority)
- ast_cli(fd, "Whole extension %s@%s removed\n",
- exten, context);
- else
- ast_cli(fd, "Extension %s@%s with priority %d removed\n",
- exten, context, removing_priority);
-
- ret = RESULT_SUCCESS;
- } else {
- ast_cli(fd, "Failed to remove extension %s@%s\n", exten, context);
- ret = RESULT_FAILURE;
- }
- free(exten);
- return ret;
-}
-
static int handle_context_remove_extension(int fd, int argc, char *argv[])
{
int removing_priority = 0;
@@ -653,128 +446,6 @@ static int fix_complete_args(const char *line, char **word, int *pos)
}
#endif /* BROKEN_READLINE */
-static char *complete_context_remove_extension_deprecated(const char *line, const char *word, int pos,
- int state)
-{
- char *ret = NULL;
- int which = 0;
-
-#ifdef BROKEN_READLINE
- char *word2;
- /*
- * Fix arguments, *word is a new allocated structure, REMEMBER to
- * free *word when you want to return from this function ...
- */
- if (fix_complete_args(line, &word2, &pos)) {
- ast_log(LOG_ERROR, "Out of free memory\n");
- return NULL;
- }
- word = word2;
-#endif
-
- if (pos == 2) { /* 'remove extension _X_' (exten@context ... */
- struct ast_context *c = NULL;
- char *context = NULL, *exten = NULL;
- int le = 0; /* length of extension */
- int lc = 0; /* length of context */
-
- lc = split_ec(word, &exten, &context);
-#ifdef BROKEN_READLINE
- free(word2);
-#endif
- if (lc) /* error */
- return NULL;
- le = strlen(exten);
- lc = strlen(context);
-
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- goto error2;
- }
-
- /* find our context ... */
- while ( (c = ast_walk_contexts(c)) ) { /* match our context if any */
- struct ast_exten *e = NULL;
- /* XXX locking ? */
- if (!partial_match(ast_get_context_name(c), context, lc))
- continue; /* context not matched */
- while ( (e = ast_walk_context_extensions(c, e)) ) { /* try to complete extensions ... */
- if ( partial_match(ast_get_extension_name(e), exten, le) && ++which > state) { /* n-th match */
- /* If there is an extension then return exten@context. XXX otherwise ? */
- if (exten)
- asprintf(&ret, "%s@%s", ast_get_extension_name(e), ast_get_context_name(c));
- break;
- }
- }
- if (e) /* got a match */
- break;
- }
-
- ast_unlock_contexts();
- error2:
- if (exten)
- free(exten);
- } else if (pos == 3) { /* 'remove extension EXT _X_' (priority) */
- char *exten = NULL, *context, *p;
- struct ast_context *c;
- int le, lc, len;
- const char *s = skip_words(line, 2); /* skip 'remove' 'extension' */
- int i = split_ec(s, &exten, &context); /* parse ext@context */
-
- if (i) /* error */
- goto error3;
- if ( (p = strchr(exten, ' ')) ) /* remove space after extension */
- *p = '\0';
- if ( (p = strchr(context, ' ')) ) /* remove space after context */
- *p = '\0';
- le = strlen(exten);
- lc = strlen(context);
- len = strlen(word);
- if (le == 0 || lc == 0)
- goto error3;
-
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- goto error3;
- }
-
- /* walk contexts */
- c = NULL;
- while ( (c = ast_walk_contexts(c)) ) {
- /* XXX locking on c ? */
- struct ast_exten *e;
- if (strcmp(ast_get_context_name(c), context) != 0)
- continue;
- /* got it, we must match here */
- e = NULL;
- while ( (e = ast_walk_context_extensions(c, e)) ) {
- struct ast_exten *priority;
- char buffer[10];
-
- if (strcmp(ast_get_extension_name(e), exten) != 0)
- continue;
- /* XXX lock e ? */
- priority = NULL;
- while ( !ret && (priority = ast_walk_extension_priorities(e, priority)) ) {
- snprintf(buffer, sizeof(buffer), "%u", ast_get_extension_priority(priority));
- if (partial_match(buffer, word, len) && ++which > state) /* n-th match */
- ret = strdup(buffer);
- }
- break;
- }
- break;
- }
- ast_unlock_contexts();
- error3:
- if (exten)
- free(exten);
-#ifdef BROKEN_READLINE
- free(word2);
-#endif
- }
- return ret;
-}
-
static char *complete_context_remove_extension(const char *line, const char *word, int pos,
int state)
{
@@ -900,51 +571,6 @@ static char *complete_context_remove_extension(const char *line, const char *wor
/*!
* Include context ...
*/
-static int handle_context_add_include_deprecated(int fd, int argc, char *argv[])
-{
- if (argc != 5) /* include context CTX in CTX */
- return RESULT_SHOWUSAGE;
-
- /* third arg must be 'in' ... */
- if (strcmp(argv[3], "in") && strcmp(argv[3], "into")) /* XXX why both ? */
- return RESULT_SHOWUSAGE;
-
- if (ast_context_add_include(argv[4], argv[2], registrar)) {
- switch (errno) {
- case ENOMEM:
- ast_cli(fd, "Out of memory for context addition\n");
- break;
-
- case EBUSY:
- ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
- break;
-
- case EEXIST:
- ast_cli(fd, "Context '%s' already included in '%s' context\n",
- argv[2], argv[4]);
- break;
-
- case ENOENT:
- case EINVAL:
- ast_cli(fd, "There is no existence of context '%s'\n",
- errno == ENOENT ? argv[4] : argv[2]);
- break;
-
- default:
- ast_cli(fd, "Failed to include '%s' in '%s' context\n",
- argv[2], argv[4]);
- break;
- }
- return RESULT_FAILURE;
- }
-
- /* show some info ... */
- ast_cli(fd, "Context '%s' included in '%s' context\n",
- argv[2], argv[4]);
-
- return RESULT_SUCCESS;
-}
-
static int handle_context_add_include(int fd, int argc, char *argv[])
{
if (argc != 6) /* dialplan add include CTX in CTX */
@@ -990,101 +616,6 @@ static int handle_context_add_include(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char *complete_context_add_include_deprecated(const char *line, const char *word, int pos,
- int state)
-{
- struct ast_context *c;
- int which = 0;
- char *ret = NULL;
- int len = strlen(word);
-
- if (pos == 2) { /* 'include context _X_' (context) ... */
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- return NULL;
- }
- for (c = NULL; !ret && (c = ast_walk_contexts(c)); )
- if (partial_match(ast_get_context_name(c), word, len) && ++which > state)
- ret = strdup(ast_get_context_name(c));
- ast_unlock_contexts();
- return ret;
- } else if (pos == 3) { /* include context CTX _X_ */
- /* complete as 'in' if context exists or we are unable to check */
- char *context, *dupline;
- struct ast_context *c;
- const char *s = skip_words(line, 2); /* should not fail */
-
- if (state != 0) /* only once */
- return NULL;
-
- /* parse context from line ... */
- context = dupline = strdup(s);
- if (!context) {
- ast_log(LOG_ERROR, "Out of free memory\n");
- return strdup("in");
- }
- strsep(&dupline, " ");
-
- /* check for context existence ... */
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- /* our fault, we can't check, so complete 'in' ... */
- ret = strdup("in");
- } else {
- for (c = NULL; !ret && (c = ast_walk_contexts(c)); )
- if (!strcmp(context, ast_get_context_name(c)))
- ret = strdup("in"); /* found */
- ast_unlock_contexts();
- }
- free(context);
- return ret;
- } else if (pos == 4) { /* 'include context CTX in _X_' (dst context) */
- char *context, *dupline, *in;
- const char *s = skip_words(line, 2); /* should not fail */
- context = dupline = strdup(s);
- if (!dupline) {
- ast_log(LOG_ERROR, "Out of free memory\n");
- return NULL;
- }
- strsep(&dupline, " "); /* skip context */
- in = strsep(&dupline, " ");
- /* error if missing context or third word is not 'in' */
- if (!strlen(context) || strcmp(in, "in")) {
- ast_log(LOG_ERROR, "bad context %s or missing in %s\n",
- context, in);
- goto error3;
- }
-
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock context list\n");
- goto error3;
- }
-
- for (c = NULL; (c = ast_walk_contexts(c)); )
- if (!strcmp(context, ast_get_context_name(c)))
- break;
- if (c) { /* first context exists, go on... */
- /* go through all contexts ... */
- for (c = NULL; !ret && (c = ast_walk_contexts(c)); ) {
- if (!strcmp(context, ast_get_context_name(c)))
- continue; /* skip ourselves */
- if (partial_match(ast_get_context_name(c), word, len) &&
- !lookup_ci(c, context) /* not included yet */ &&
- ++which > state)
- ret = strdup(ast_get_context_name(c));
- }
- } else {
- ast_log(LOG_ERROR, "context %s not found\n", context);
- }
- ast_unlock_contexts();
- error3:
- free(context);
- return ret;
- }
-
- return NULL;
-}
-
static char *complete_context_add_include(const char *line, const char *word, int pos,
int state)
{
@@ -1404,99 +935,6 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
/*!
* \brief ADD EXTENSION command stuff
*/
-static int handle_context_add_extension_deprecated(int fd, int argc, char *argv[])
-{
- char *whole_exten;
- char *exten, *prior;
- int iprior = -2;
- char *cidmatch, *app, *app_data;
- char *start, *end;
-
- /* check for arguments at first */
- if (argc != 5 && argc != 6)
- return RESULT_SHOWUSAGE;
- if (strcmp(argv[3], "into"))
- return RESULT_SHOWUSAGE;
- if (argc == 6) if (strcmp(argv[5], "replace")) return RESULT_SHOWUSAGE;
-
- /* XXX overwrite argv[2] */
- whole_exten = argv[2];
- exten = strsep(&whole_exten,",");
- if (strchr(exten, '/')) {
- cidmatch = exten;
- strsep(&cidmatch,"/");
- } else {
- cidmatch = NULL;
- }
- prior = strsep(&whole_exten,",");
- if (prior) {
- if (!strcmp(prior, "hint")) {
- iprior = PRIORITY_HINT;
- } else {
- if (sscanf(prior, "%d", &iprior) != 1) {
- ast_cli(fd, "'%s' is not a valid priority\n", prior);
- prior = NULL;
- }
- }
- }
- app = whole_exten;
- if (app && (start = strchr(app, '(')) && (end = strrchr(app, ')'))) {
- *start = *end = '\0';
- app_data = start + 1;
- ast_process_quotes_and_slashes(app_data, ',', '|');
- } else {
- if (app) {
- app_data = strchr(app, ',');
- if (app_data) {
- *app_data = '\0';
- app_data++;
- }
- } else
- app_data = NULL;
- }
-
- if (!exten || !prior || !app || (!app_data && iprior != PRIORITY_HINT))
- return RESULT_SHOWUSAGE;
-
- if (!app_data)
- app_data="";
- if (ast_add_extension(argv[4], argc == 6 ? 1 : 0, exten, iprior, NULL, cidmatch, app,
- (void *)strdup(app_data), free, registrar)) {
- switch (errno) {
- case ENOMEM:
- ast_cli(fd, "Out of free memory\n");
- break;
-
- case EBUSY:
- ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
- break;
-
- case ENOENT:
- ast_cli(fd, "No existence of '%s' context\n", argv[4]);
- break;
-
- case EEXIST:
- ast_cli(fd, "Extension %s@%s with priority %s already exists\n",
- exten, argv[4], prior);
- break;
-
- default:
- ast_cli(fd, "Failed to add '%s,%s,%s,%s' extension into '%s' context\n",
- exten, prior, app, app_data, argv[4]);
- break;
- }
- return RESULT_FAILURE;
- }
-
- if (argc == 6)
- ast_cli(fd, "Extension %s@%s (%s) replace by '%s,%s,%s,%s'\n",
- exten, argv[4], prior, exten, prior, app, app_data);
- else
- ast_cli(fd, "Extension '%s,%s,%s,%s' added into '%s' context\n",
- exten, prior, app, app_data, argv[4]);
-
- return RESULT_SUCCESS;
-}
static int handle_context_add_extension(int fd, int argc, char *argv[])
{
char *whole_exten;
@@ -1592,35 +1030,6 @@ static int handle_context_add_extension(int fd, int argc, char *argv[])
}
/*! dialplan add extension 6123,1,Dial,IAX/212.71.138.13/6123 into local */
-static char *complete_context_add_extension_deprecated(const char *line, const char *word, int pos, int state)
-{
- int which = 0;
-
- if (pos == 3) { /* complete 'into' word ... */
- return (state == 0) ? strdup("into") : NULL;
- } else if (pos == 4) { /* complete context */
- struct ast_context *c = NULL;
- int len = strlen(word);
- char *res = NULL;
-
- /* try to lock contexts list ... */
- if (ast_lock_contexts()) {
- ast_log(LOG_WARNING, "Failed to lock contexts list\n");
- return NULL;
- }
-
- /* walk through all contexts */
- while ( !res && (c = ast_walk_contexts(c)) )
- if (partial_match(ast_get_context_name(c), word, len) && ++which > state)
- res = strdup(ast_get_context_name(c));
- ast_unlock_contexts();
- return res;
- } else if (pos == 5) {
- return state == 0 ? strdup("replace") : NULL;
- }
- return NULL;
-}
-
static char *complete_context_add_extension(const char *line, const char *word, int pos, int state)
{
int which = 0;
@@ -1653,45 +1062,6 @@ static char *complete_context_add_extension(const char *line, const char *word,
/*!
* IGNOREPAT CLI stuff
*/
-static int handle_context_add_ignorepat_deprecated(int fd, int argc, char *argv[])
-{
- if (argc != 5)
- return RESULT_SHOWUSAGE;
- if (strcmp(argv[3], "into"))
- return RESULT_SHOWUSAGE;
-
- if (ast_context_add_ignorepat(argv[4], argv[2], registrar)) {
- switch (errno) {
- case ENOMEM:
- ast_cli(fd, "Out of free memory\n");
- break;
-
- case ENOENT:
- ast_cli(fd, "There is no existence of '%s' context\n", argv[4]);
- break;
-
- case EEXIST:
- ast_cli(fd, "Ignore pattern '%s' already included in '%s' context\n",
- argv[2], argv[4]);
- break;
-
- case EBUSY:
- ast_cli(fd, "Failed to lock context(s) list, please, try again later\n");
- break;
-
- default:
- ast_cli(fd, "Failed to add ingore pattern '%s' into '%s' context\n",
- argv[2], argv[4]);
- break;
- }
- return RESULT_FAILURE;
- }
-
- ast_cli(fd, "Ignore pattern '%s' added into '%s' context\n",
- argv[2], argv[4]);
- return RESULT_SUCCESS;
-}
-
static int handle_context_add_ignorepat(int fd, int argc, char *argv[])
{
if (argc != 6)
@@ -1731,55 +1101,6 @@ static int handle_context_add_ignorepat(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char *complete_context_add_ignorepat_deprecated(const char *line, const char *word,
- int pos, int state)
-{
- if (pos == 3)
- return state == 0 ? strdup("into") : NULL;
- else if (pos == 4) {
- struct ast_context *c;
- int which = 0;
- char *dupline, *ignorepat = NULL;
- const char *s;
- char *ret = NULL;
- int len = strlen(word);
-
- /* XXX skip first two words 'add' 'ignorepat' */
- s = skip_words(line, 2);
- if (s == NULL)
- return NULL;
- dupline = strdup(s);
- if (!dupline) {
- ast_log(LOG_ERROR, "Malloc failure\n");
- return NULL;
- }
- ignorepat = strsep(&dupline, " ");
-
- if (ast_lock_contexts()) {
- ast_log(LOG_ERROR, "Failed to lock contexts list\n");
- return NULL;
- }
-
- for (c = NULL; !ret && (c = ast_walk_contexts(c));) {
- int found = 0;
-
- if (!partial_match(ast_get_context_name(c), word, len))
- continue; /* not mine */
- if (ignorepat) /* there must be one, right ? */
- found = lookup_c_ip(c, ignorepat);
- if (!found && ++which > state)
- ret = strdup(ast_get_context_name(c));
- }
-
- if (ignorepat)
- free(ignorepat);
- ast_unlock_contexts();
- return ret;
- }
-
- return NULL;
-}
-
static char *complete_context_add_ignorepat(const char *line, const char *word,
int pos, int state)
{
@@ -1829,40 +1150,6 @@ static char *complete_context_add_ignorepat(const char *line, const char *word,
return NULL;
}
-static int handle_context_remove_ignorepat_deprecated(int fd, int argc, char *argv[])
-{
- if (argc != 5)
- return RESULT_SHOWUSAGE;
- if (strcmp(argv[3], "from"))
- return RESULT_SHOWUSAGE;
-
- if (ast_context_remove_ignorepat(argv[4], argv[2], registrar)) {
- switch (errno) {
- case EBUSY:
- ast_cli(fd, "Failed to lock context(s) list, please try again later\n");
- break;
-
- case ENOENT:
- ast_cli(fd, "There is no existence of '%s' context\n", argv[4]);
- break;
-
- case EINVAL:
- ast_cli(fd, "There is no existence of '%s' ignore pattern in '%s' context\n",
- argv[2], argv[4]);
- break;
-
- default:
- ast_cli(fd, "Failed to remove ignore pattern '%s' from '%s' context\n", argv[2], argv[4]);
- break;
- }
- return RESULT_FAILURE;
- }
-
- ast_cli(fd, "Ignore pattern '%s' removed from '%s' context\n",
- argv[2], argv[4]);
- return RESULT_SUCCESS;
-}
-
static int handle_context_remove_ignorepat(int fd, int argc, char *argv[])
{
if (argc != 6)
@@ -1897,88 +1184,6 @@ static int handle_context_remove_ignorepat(int fd, int argc, char *argv[])
return RESULT_SUCCESS;
}
-static char *complete_context_remove_ignorepat_deprecated(const char *line, const char *word,
- int pos, int state)
-{
- struct ast_context *c;
- int which = 0;
- char *ret = NULL;
-
- if (pos == 2) {
- int len = strlen(word);
- if (ast_lock_contexts()) {
- ast_log(LOG_WARNING, "Failed to lock contexts list\n");
- return NULL;
- }
-
- for (c = NULL; !ret && (c = ast_walk_contexts(c));) {
- struct ast_ignorepat *ip;
-
- if (ast_lock_context(c)) /* error, skip it */
- continue;
-
- for (ip = NULL; !ret && (ip = ast_walk_context_ignorepats(c, ip));) {
- if (partial_match(ast_get_ignorepat_name(ip), word, len) && ++which > state) {
- /* n-th match */
- struct ast_context *cw = NULL;
- int found = 0;
- while ( (cw = ast_walk_contexts(cw)) && cw != c && !found) {
- /* XXX do i stop on c, or skip it ? */
- found = lookup_c_ip(cw, ast_get_ignorepat_name(ip));
- }
- if (!found)
- ret = strdup(ast_get_ignorepat_name(ip));
- }
- }
- ast_unlock_context(c);
- }
- ast_unlock_contexts();
- return ret;
- } else if (pos == 3) {
- return state == 0 ? strdup("from") : NULL;
- } else if (pos == 4) { /* XXX check this */
- char *dupline, *duplinet, *ignorepat;
- int len = strlen(word);
-
- dupline = strdup(line);
- if (!dupline) {
- ast_log(LOG_WARNING, "Out of free memory\n");
- return NULL;
- }
-
- duplinet = dupline;
- strsep(&duplinet, " ");
- strsep(&duplinet, " ");
- ignorepat = strsep(&duplinet, " ");
-
- if (!ignorepat) {
- free(dupline);
- return NULL;
- }
-
- if (ast_lock_contexts()) {
- ast_log(LOG_WARNING, "Failed to lock contexts list\n");
- free(dupline);
- return NULL;
- }
-
- for (c = NULL; !ret && (c = ast_walk_contexts(c)); ) {
- if (ast_lock_context(c)) /* fail, skip it */
- continue;
- if (!partial_match(ast_get_context_name(c), word, len))
- continue;
- if (lookup_c_ip(c, ignorepat) && ++which > state)
- ret = strdup(ast_get_context_name(c));
- ast_unlock_context(c);
- }
- ast_unlock_contexts();
- free(dupline);
- return NULL;
- }
-
- return NULL;
-}
-
static char *complete_context_remove_ignorepat(const char *line, const char *word,
int pos, int state)
{
@@ -2074,81 +1279,41 @@ static int handle_reload_extensions(int fd, int argc, char *argv[])
/*!
* CLI entries for commands provided by this module
*/
-static struct ast_cli_entry cli_dont_include_deprecated = {
- { "dont", "include", NULL },
- handle_context_dont_include_deprecated, NULL,
- NULL, complete_context_dont_include_deprecated };
-
-static struct ast_cli_entry cli_remove_extension_deprecated = {
- { "remove", "extension", NULL },
- handle_context_remove_extension_deprecated, NULL,
- NULL, complete_context_remove_extension_deprecated };
-
-static struct ast_cli_entry cli_include_context_deprecated = {
- { "include", "context", NULL },
- handle_context_add_include_deprecated, NULL,
- NULL, complete_context_add_include_deprecated };
-
-static struct ast_cli_entry cli_add_extension_deprecated = {
- { "add", "extension", NULL },
- handle_context_add_extension_deprecated, NULL,
- NULL, complete_context_add_extension_deprecated };
-
-static struct ast_cli_entry cli_add_ignorepat_deprecated = {
- { "add", "ignorepat", NULL },
- handle_context_add_ignorepat_deprecated, NULL,
- NULL, complete_context_add_ignorepat_deprecated };
-
-static struct ast_cli_entry cli_remove_ignorepat_deprecated = {
- { "remove", "ignorepat", NULL },
- handle_context_remove_ignorepat_deprecated, NULL,
- NULL, complete_context_remove_ignorepat_deprecated };
-
-static struct ast_cli_entry cli_extensions_reload_deprecated = {
- { "extensions", "reload", NULL },
- handle_reload_extensions, NULL,
- NULL };
-
-static struct ast_cli_entry cli_save_dialplan_deprecated = {
- { "save", "dialplan", NULL },
- handle_save_dialplan, NULL,
- NULL };
-
static struct ast_cli_entry cli_pbx_config[] = {
{ { "dialplan", "add", "extension", NULL },
handle_context_add_extension, "Add new extension into context",
- context_add_extension_help, complete_context_add_extension, &cli_add_extension_deprecated },
+ context_add_extension_help, complete_context_add_extension },
{ { "dialplan", "remove", "extension", NULL },
handle_context_remove_extension, "Remove a specified extension",
- context_remove_extension_help, complete_context_remove_extension, &cli_remove_extension_deprecated },
+ context_remove_extension_help, complete_context_remove_extension },
{ { "dialplan", "add", "ignorepat", NULL },
handle_context_add_ignorepat, "Add new ignore pattern",
- context_add_ignorepat_help, complete_context_add_ignorepat, &cli_add_ignorepat_deprecated },
+ context_add_ignorepat_help, complete_context_add_ignorepat },
{ { "dialplan", "remove", "ignorepat", NULL },
handle_context_remove_ignorepat, "Remove ignore pattern from context",
- context_remove_ignorepat_help, complete_context_remove_ignorepat, &cli_remove_ignorepat_deprecated },
+ context_remove_ignorepat_help, complete_context_remove_ignorepat },
{ { "dialplan", "add", "include", NULL },
handle_context_add_include, "Include context in other context",
- context_add_include_help, complete_context_add_include, &cli_include_context_deprecated },
+ context_add_include_help, complete_context_add_include },
{ { "dialplan", "remove", "include", NULL },
handle_context_remove_include, "Remove a specified include from context",
- context_remove_include_help, complete_context_remove_include, &cli_dont_include_deprecated },
+ context_remove_include_help, complete_context_remove_include },
{ { "dialplan", "reload", NULL },
handle_reload_extensions, "Reload extensions and *only* extensions",
- reload_extensions_help, NULL, &cli_extensions_reload_deprecated },
+ reload_extensions_help },
};
static struct ast_cli_entry cli_dialplan_save = {
{ "dialplan", "save", NULL },
handle_save_dialplan, "Save dialplan",
- save_dialplan_help, NULL, &cli_save_dialplan_deprecated };
+ save_dialplan_help };
/*!
* Standard module functions ...