summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
77ed96a)
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r90967 | russell | 2007-12-04 13:57:39 -0600 (Tue, 04 Dec 2007) | 7 lines
Make some changes to some additions I made recently for doing channel autoservice
when looking up extensions. This code was added to handle the case where a
dialplan switch was in use that could block for a long time. However, the way
that I added it, it did this for all extension lookups. However, lookups in the
in-memory tree of extensions should _not_ take long enough to matter. So, move
the autoservice stuff to be only around executing a switch.
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@91011
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
else /* action == E_MATCH */
aswf = asw->exists;
datap = sw->eval ? sw->tmpdata : sw->data;
else /* action == E_MATCH */
aswf = asw->exists;
datap = sw->eval ? sw->tmpdata : sw->data;
- res = !aswf ? 0 : aswf(chan, context, exten, priority, callerid, datap);
+ if (!aswf)
+ res = 0;
+ else {
+ if (chan)
+ ast_autoservice_start(chan);
+ res = aswf(chan, context, exten, priority, callerid, datap);
+ if (chan)
+ ast_autoservice_stop(chan);
+ }
if (res) { /* Got a match */
q->swo = asw;
q->data = datap;
if (res) { /* Got a match */
q->swo = asw;
q->data = datap;
int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
- if (c)
- ast_autoservice_start(c);
-
ast_rdlock_contexts();
if (found)
*found = 0;
ast_rdlock_contexts();
if (found)
*found = 0;
*found = 1;
if (matching_action) {
ast_unlock_contexts();
*found = 1;
if (matching_action) {
ast_unlock_contexts();
- if (c)
- ast_autoservice_stop(c);
return -1; /* success, we found it */
} else if (action == E_FINDLABEL) { /* map the label to a priority */
res = e->priority;
ast_unlock_contexts();
return -1; /* success, we found it */
} else if (action == E_FINDLABEL) { /* map the label to a priority */
res = e->priority;
ast_unlock_contexts();
- if (c)
- ast_autoservice_stop(c);
return res; /* the priority we were looking for */
} else { /* spawn */
if (!e->cached_app)
return res; /* the priority we were looking for */
} else { /* spawn */
if (!e->cached_app)
ast_unlock_contexts();
if (!app) {
ast_log(LOG_WARNING, "No application '%s' for extension (%s, %s, %d)\n", e->app, context, exten, priority);
ast_unlock_contexts();
if (!app) {
ast_log(LOG_WARNING, "No application '%s' for extension (%s, %s, %d)\n", e->app, context, exten, priority);
- if (c)
- ast_autoservice_stop(c);
return -1;
}
if (c->context != context)
return -1;
}
if (c->context != context)
"AppData: %s\r\n"
"Uniqueid: %s\r\n",
c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid);
"AppData: %s\r\n"
"Uniqueid: %s\r\n",
c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid);
- if (c)
- ast_autoservice_stop(c);
return pbx_exec(c, app, passdata); /* 0 on success, -1 on failure */
}
} else if (q.swo) { /* not found here, but in another switch */
ast_unlock_contexts();
if (matching_action) {
return pbx_exec(c, app, passdata); /* 0 on success, -1 on failure */
}
} else if (q.swo) { /* not found here, but in another switch */
ast_unlock_contexts();
if (matching_action) {
- if (c)
- ast_autoservice_stop(c);
return -1;
} else {
if (!q.swo->exec) {
ast_log(LOG_WARNING, "No execution engine for switch %s\n", q.swo->name);
res = -1;
}
return -1;
} else {
if (!q.swo->exec) {
ast_log(LOG_WARNING, "No execution engine for switch %s\n", q.swo->name);
res = -1;
}
- if (c)
- ast_autoservice_stop(c);
return q.swo->exec(c, q.foundcontext ? q.foundcontext : context, exten, priority, callerid, q.data);
}
} else { /* not found anywhere, see what happened */
return q.swo->exec(c, q.foundcontext ? q.foundcontext : context, exten, priority, callerid, q.data);
}
} else { /* not found anywhere, see what happened */
ast_debug(1, "Shouldn't happen!\n");
}
ast_debug(1, "Shouldn't happen!\n");
}
- if (c)
- ast_autoservice_stop(c);
-
return (matching_action) ? 0 : -1;
}
}
return (matching_action) ? 0 : -1;
}
}