mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-16 06:48:25 +00:00
minor code restructuring in preparation for more work.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@25683 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
31
pbx.c
31
pbx.c
@@ -716,7 +716,12 @@ static int matchcid(const char *cidpattern, const char *callerid)
|
|||||||
return ast_extension_match(cidpattern, callerid);
|
return ast_extension_match(cidpattern, callerid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ast_exten *pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, const char *context, const char *exten, int priority, const char *label, const char *callerid, int action, char *incstack[], int *stacklen, int *status, struct ast_switch **swo, char **data, const char **foundcontext)
|
static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
|
||||||
|
struct ast_context *bypass,
|
||||||
|
const char *context, const char *exten, int priority,
|
||||||
|
const char *label, const char *callerid, int action,
|
||||||
|
char *incstack[], int *stacklen, int *status, struct ast_switch **swo,
|
||||||
|
char **data, const char **foundcontext)
|
||||||
{
|
{
|
||||||
int x, res;
|
int x, res;
|
||||||
struct ast_context *tmp;
|
struct ast_context *tmp;
|
||||||
@@ -725,6 +730,8 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan, struct ast
|
|||||||
struct ast_sw *sw;
|
struct ast_sw *sw;
|
||||||
struct ast_switch *asw;
|
struct ast_switch *asw;
|
||||||
|
|
||||||
|
struct ast_exten *earlymatch = NULL;
|
||||||
|
|
||||||
/* Initialize status if appropriate */
|
/* Initialize status if appropriate */
|
||||||
if (!*stacklen) {
|
if (!*stacklen) {
|
||||||
*status = STATUS_NO_CONTEXT;
|
*status = STATUS_NO_CONTEXT;
|
||||||
@@ -741,14 +748,17 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan, struct ast
|
|||||||
if (!strcasecmp(incstack[x], context))
|
if (!strcasecmp(incstack[x], context))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (bypass)
|
if (bypass) /* bypass means we only look there */
|
||||||
tmp = bypass;
|
tmp = bypass;
|
||||||
else
|
else { /* look in contexts */
|
||||||
tmp = contexts;
|
for (tmp = contexts; tmp; tmp = tmp->next) {
|
||||||
for (; tmp; tmp = tmp->next) {
|
if (!strcmp(tmp->name, context))
|
||||||
/* Match context */
|
break;
|
||||||
if (bypass || !strcmp(tmp->name, context)) {
|
}
|
||||||
struct ast_exten *earlymatch = NULL;
|
if (!tmp)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
/* XXX fix indentation */
|
||||||
|
|
||||||
if (*status < STATUS_NO_EXTENSION)
|
if (*status < STATUS_NO_EXTENSION)
|
||||||
*status = STATUS_NO_EXTENSION;
|
*status = STATUS_NO_EXTENSION;
|
||||||
@@ -828,9 +838,7 @@ static struct ast_exten *pbx_find_extension(struct ast_channel *chan, struct ast
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -878,6 +886,7 @@ static char *substring(const char *value, int offset, int length, char *workspac
|
|||||||
|
|
||||||
ast_copy_string(workspace, value, workspace_len); /* always make a copy */
|
ast_copy_string(workspace, value, workspace_len); /* always make a copy */
|
||||||
|
|
||||||
|
/* Quick check if no need to do anything */
|
||||||
if (offset == 0 && length < 0) /* take the whole string */
|
if (offset == 0 && length < 0) /* take the whole string */
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user