summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
065367d)
plus a few minor fixes.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@21393
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
*/
int ast_context_remove_include(const char *context, const char *include, const char *registrar)
{
*/
int ast_context_remove_include(const char *context, const char *include, const char *registrar)
{
- struct ast_context *c = NULL;
-
- if (ast_lock_contexts())
- return -1;
-
- /* walk contexts and search for the right one ...*/
- while ( (c = ast_walk_contexts(c)) ) {
- /* we found one ... */
- if (!strcmp(ast_get_context_name(c), context)) {
- int ret;
- /* remove include from this context ... */
- ret = ast_context_remove_include2(c, include, registrar);
-
- ast_unlock_contexts();
+ int ret = -1;
+ struct ast_context *c = find_context_locked(context);
- /* ... return results */
- return ret;
- }
+ if (c) {
+ /* found, remove include from this context ... */
+ ret = ast_context_remove_include2(c, include, registrar);
+ ast_unlock_contexts();
-
- /* we can't find the right one context */
- ast_unlock_contexts();
- return -1;
static int pbx_builtin_setamaflags(struct ast_channel *chan, void *data)
{
/* Copy the AMA Flags as specified */
static int pbx_builtin_setamaflags(struct ast_channel *chan, void *data)
{
/* Copy the AMA Flags as specified */
- if (data)
- ast_cdr_setamaflags(chan, data);
- else
- ast_cdr_setamaflags(chan, "");
+ ast_cdr_setamaflags(chan, data ? data : "");
*/
static int pbx_builtin_goto(struct ast_channel *chan, void *data)
{
*/
static int pbx_builtin_goto(struct ast_channel *chan, void *data)
{
- int res = ast_parseable_goto(chan, (const char *) data);
+ int res = ast_parseable_goto(chan, data);
if (!res && (option_verbose > 2))
ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
return res;
if (!res && (option_verbose > 2))
ast_verbose( VERBOSE_PREFIX_3 "Goto (%s,%s,%d)\n", chan->context,chan->exten, chan->priority+1);
return res;
return 0;
else if (*condition >= '0' && *condition <= '9') /* Numbers are evaluated for truth */
return atoi(condition);
return 0;
else if (*condition >= '0' && *condition <= '9') /* Numbers are evaluated for truth */
return atoi(condition);
- else /* Strings are true */
+ else /* Strings are true -- XXX maybe use ast_true() ? */
{
char *condition, *branch1, *branch2, *branch;
int rc;
{
char *condition, *branch1, *branch2, *branch;
int rc;
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Ignoring, since there is no variable to check\n");
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "Ignoring, since there is no variable to check\n");
+ if (context == NULL)
+ context = chan->context;
+ if (exten == NULL)
+ exten = chan->exten;
+
goto_func = (async) ? ast_async_goto : ast_explicit_goto;
goto_func = (async) ? ast_async_goto : ast_explicit_goto;
- if (ast_exists_extension(chan, context ? context : chan->context,
- exten ? exten : chan->exten, priority,
- chan->cid.cid_num))
- return goto_func(chan, context ? context : chan->context,
- exten ? exten : chan->exten, priority);
+ if (ast_exists_extension(chan, context, exten, priority, chan->cid.cid_num))
+ return goto_func(chan, context, exten, priority);