Minor realtime improvements

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4311 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-11-22 05:03:03 +00:00
parent fdfd69cca0
commit 536d9d370e
3 changed files with 28 additions and 11 deletions

View File

@@ -50,13 +50,13 @@ static char *tdesc = "Realtime Switch";
*/
#define REALTIME_COMMON \
#define REALTIME_COMMON(mode) \
char *buf; \
char *opts; \
const char *cxt; \
char *table; \
int res=-1; \
struct ast_variable *var; \
struct ast_variable *var=NULL; \
buf = ast_strdupa(data); \
if (buf) { \
opts = strchr(buf, '/'); \
@@ -75,9 +75,9 @@ static char *tdesc = "Realtime Switch";
cxt = context;\
if (!table || ast_strlen_zero(table)) \
table = "extensions"; \
var = realtime_switch_common(table, cxt, exten, priority); \
var = realtime_switch_common(table, cxt, exten, priority, mode); \
} else \
return -1;
res = -1;
static struct ast_variable *realtime_switch_common(const char *table, const char *context, const char *exten, int priority)
{
@@ -104,7 +104,7 @@ static int realtime_canmatch(struct ast_channel *chan, const char *context, cons
if (var) ast_destroy_realtime(var);
if (var)
res = 1;
return res;
return res > 0 ? res : 0;
}
static int realtime_exec(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, int newstack, const char *data)
@@ -123,6 +123,7 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
appdata = ast_strdupa(v->value);
v = v->next;
}
ast_destroy_realtime(var);
if (!ast_strlen_zero(app)) {
a = pbx_findapp(app);
if (a) {
@@ -130,7 +131,6 @@ static int realtime_exec(struct ast_channel *chan, const char *context, const ch
} else
ast_log(LOG_NOTICE, "No such application '%s' for extension '%s' in context '%s'\n", app, exten, context);
}
ast_destroy_realtime(var);
}
return res;
}
@@ -139,7 +139,7 @@ static int realtime_matchmore(struct ast_channel *chan, const char *context, con
{
REALTIME_COMMON;
if (var) ast_destroy_realtime(var);
return res;
return res > 0 ? res : 0;
}
static struct ast_switch realtime_switch =