git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8185 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-04-23 22:15:07 +00:00
parent 94e7ad44af
commit a7782dcc65
1 changed files with 19 additions and 2 deletions

View File

@ -168,8 +168,10 @@ char *expand_alias(char *cmd, char *arg)
char *sql;
char *exp = NULL;
switch_core_db_t *db = switch_core_db_handle();
int full = 0;
sql = switch_mprintf("select command from aliases where alias='%q' or alias='%q %q'", cmd, cmd, arg);
sql = switch_mprintf("select command from aliases where alias='%q'", cmd);
switch_core_db_exec(db, sql, alias_callback, &r, &errmsg);
if (errmsg) {
@ -177,8 +179,23 @@ char *expand_alias(char *cmd, char *arg)
free(errmsg);
}
if (!r) {
sql = switch_mprintf("select command from aliases where alias='%q %q'", cmd, arg);
switch_core_db_exec(db, sql, alias_callback, &r, &errmsg);
if (errmsg) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error [%s][%s]\n", sql, errmsg);
free(errmsg);
}
if (r) {
full++;
}
}
if (r) {
if (arg) {
if (arg && !full) {
exp = switch_mprintf("%s %s", r, arg);
free(r);
} else {