forked from Mirrors/freeswitch
cleanup
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7422 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
1e691217f3
commit
d5081d0b3e
@ -102,7 +102,6 @@ end:
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static switch_status_t _find_user(const char *cmd, switch_core_session_t *session, switch_stream_handle_t *stream, switch_bool_t tf)
|
||||
{
|
||||
switch_xml_t x_domain = NULL, x_user = NULL, xml = NULL;
|
||||
@ -177,7 +176,6 @@ end:
|
||||
|
||||
free(mydata);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(user_exists_function)
|
||||
@ -250,8 +248,6 @@ SWITCH_STANDARD_API(xml_locate_function)
|
||||
}
|
||||
|
||||
end:
|
||||
switch_event_destroy(¶ms);
|
||||
|
||||
if (err) {
|
||||
if (host) {
|
||||
stream->write_function(stream, "<error>%s</error>\n", err);
|
||||
@ -260,8 +256,6 @@ end:
|
||||
}
|
||||
}
|
||||
|
||||
switch_safe_free(params);
|
||||
|
||||
if (xml && obj) {
|
||||
xmlstr = switch_xml_toxml(obj, SWITCH_FALSE);
|
||||
switch_assert(xmlstr);
|
||||
@ -272,9 +266,9 @@ end:
|
||||
|
||||
}
|
||||
|
||||
switch_event_destroy(¶ms);
|
||||
free(mydata);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_API(regex_function)
|
||||
@ -317,16 +311,13 @@ SWITCH_STANDARD_API(regex_function)
|
||||
} else {
|
||||
stream->write_function(stream, "false");
|
||||
}
|
||||
|
||||
goto ok;
|
||||
|
||||
error:
|
||||
error:
|
||||
stream->write_function(stream, "-ERR");
|
||||
ok:
|
||||
|
||||
ok:
|
||||
switch_regex_safe_free(re);
|
||||
switch_safe_free(mydata);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -398,7 +389,6 @@ SWITCH_STANDARD_API(cond_function)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (o) {
|
||||
char *s_a = NULL, *s_b = NULL;
|
||||
int a_is_num, b_is_num;
|
||||
@ -448,15 +438,14 @@ SWITCH_STANDARD_API(cond_function)
|
||||
goto ok;
|
||||
}
|
||||
|
||||
error:
|
||||
error:
|
||||
stream->write_function(stream, "-ERR");
|
||||
ok:
|
||||
ok:
|
||||
|
||||
switch_safe_free(mydata);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_STANDARD_API(lan_addr_function)
|
||||
{
|
||||
stream->write_function(stream, "%s", switch_is_lan_addr(cmd) ? "yes" : "no");
|
||||
@ -589,14 +578,13 @@ SWITCH_STANDARD_API(ctl_function)
|
||||
}
|
||||
|
||||
stream->write_function(stream, "+OK\n");
|
||||
end:
|
||||
end:
|
||||
free(mydata);
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR Memory error\n");
|
||||
}
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
#define LOAD_SYNTAX "<mod_name>"
|
||||
@ -685,7 +673,6 @@ SWITCH_STANDARD_API(kill_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#define PARK_SYNTAX "<uuid>"
|
||||
SWITCH_STANDARD_API(park_function)
|
||||
{
|
||||
@ -788,7 +775,6 @@ SWITCH_STANDARD_API(tone_detect_session_function)
|
||||
time_t to = 0;
|
||||
switch_core_session_t *rsession;
|
||||
|
||||
|
||||
if (!cmd) {
|
||||
stream->write_function(stream, "-USAGE: %s\n", TONE_DETECT_SYNTAX);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -802,13 +788,11 @@ SWITCH_STANDARD_API(tone_detect_session_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
if (!(rsession = switch_core_session_locate(argv[0]))) {
|
||||
stream->write_function(stream, "-ERR Error Cannot locate session!\n");
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
if (argv[4]) {
|
||||
uint32_t mto;
|
||||
if (*argv[4] == '+') {
|
||||
@ -830,7 +814,7 @@ SWITCH_STANDARD_API(tone_detect_session_function)
|
||||
switch_ivr_tone_detect_session(rsession, argv[1], argv[2], argv[3], to, argv[5], argv[6]);
|
||||
stream->write_function(stream, "+OK Enabling tone detection '%s' '%s' '%s'\n", argv[1], argv[2], argv[3]);
|
||||
|
||||
done:
|
||||
done:
|
||||
|
||||
free(mydata);
|
||||
switch_core_session_rwunlock(rsession);
|
||||
@ -838,7 +822,6 @@ SWITCH_STANDARD_API(tone_detect_session_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
SWITCH_STANDARD_API(uuid_function)
|
||||
{
|
||||
switch_uuid_t uuid;
|
||||
@ -886,8 +869,6 @@ SWITCH_STANDARD_API(uuid_chat)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define SCHED_TRANSFER_SYNTAX "[+]<time> <uuid> <extension> [<dialplan>] [<context>]"
|
||||
SWITCH_STANDARD_API(sched_transfer_function)
|
||||
{
|
||||
@ -1209,14 +1190,11 @@ SWITCH_STANDARD_API(session_record_function)
|
||||
|
||||
goto done;
|
||||
|
||||
usage:
|
||||
|
||||
usage:
|
||||
stream->write_function(stream, "-USAGE: %s\n", SESS_REC_SYNTAX);
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
|
||||
done:
|
||||
|
||||
done:
|
||||
if (rsession) {
|
||||
switch_core_session_rwunlock(rsession);
|
||||
}
|
||||
@ -1225,7 +1203,7 @@ SWITCH_STANDARD_API(session_record_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#define DISPLACE_SYNTAX "<uuid> [start|stop] <path> [<limit>] [mux]"
|
||||
SWITCH_STANDARD_API(session_displace_function)
|
||||
{
|
||||
switch_core_session_t *rsession = NULL;
|
||||
@ -1239,11 +1217,7 @@ SWITCH_STANDARD_API(session_displace_function)
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(cmd)) {
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (!(mycmd = strdup(cmd))) {
|
||||
if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
|
||||
goto usage;
|
||||
}
|
||||
|
||||
@ -1276,14 +1250,11 @@ SWITCH_STANDARD_API(session_displace_function)
|
||||
|
||||
goto done;
|
||||
|
||||
usage:
|
||||
|
||||
stream->write_function(stream, "-ERR INVALID SYNTAX\n");
|
||||
usage:
|
||||
stream->write_function(stream, "-USAGE: %s\n", DISPLACE_SYNTAX);
|
||||
switch_safe_free(mycmd);
|
||||
|
||||
|
||||
done:
|
||||
|
||||
done:
|
||||
if (rsession) {
|
||||
switch_core_session_rwunlock(rsession);
|
||||
}
|
||||
@ -1316,7 +1287,6 @@ SWITCH_STANDARD_API(break_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
#define PAUSE_SYNTAX "<uuid> <on|off>"
|
||||
SWITCH_STANDARD_API(pause_function)
|
||||
{
|
||||
@ -1385,7 +1355,6 @@ SWITCH_STANDARD_API(originate_function)
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
||||
for (x = 0; x < argc && argv[x]; x++) {
|
||||
if (!strcasecmp(argv[x], "undef")) {
|
||||
argv[x] = NULL;
|
||||
@ -1462,7 +1431,7 @@ SWITCH_STANDARD_API(originate_function)
|
||||
switch_core_session_rwunlock(caller_session);
|
||||
}
|
||||
|
||||
done:
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return status;
|
||||
}
|
||||
@ -1598,14 +1567,11 @@ SWITCH_STANDARD_API(sched_api_function)
|
||||
|
||||
stream->write_function(stream, "-ERR Invalid syntax\n");
|
||||
|
||||
good:
|
||||
|
||||
good:
|
||||
switch_safe_free(tm);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
struct bg_job {
|
||||
char *cmd;
|
||||
char *arg;
|
||||
@ -1615,7 +1581,6 @@ struct bg_job {
|
||||
|
||||
static void *SWITCH_THREAD_FUNC bgapi_exec(switch_thread_t *thread, void *obj)
|
||||
{
|
||||
|
||||
struct bg_job *job = (struct bg_job *) obj;
|
||||
switch_stream_handle_t stream = { 0 };
|
||||
switch_status_t status;
|
||||
@ -1693,7 +1658,6 @@ SWITCH_STANDARD_API(bgapi_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
struct holder {
|
||||
switch_stream_handle_t *stream;
|
||||
char *http;
|
||||
@ -1750,7 +1714,6 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||
struct holder *holder = (struct holder *) pArg;
|
||||
int x;
|
||||
|
||||
|
||||
if (holder->print_title && holder->count == 0) {
|
||||
if (holder->http) {
|
||||
holder->stream->write_function(holder->stream, "\n<tr>");
|
||||
@ -1758,8 +1721,6 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||
|
||||
for (x = 0; x < argc; x++) {
|
||||
char *name = columnNames[x];
|
||||
|
||||
|
||||
if (!name) {
|
||||
name = "undefined";
|
||||
}
|
||||
@ -1832,8 +1793,8 @@ SWITCH_STANDARD_API(show_function)
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
// If you changes the field qty or order of any of these select
|
||||
// statmements, you must also change show_callback and friends to match!
|
||||
/* If you changes the field qty or order of any of these select /*
|
||||
/* statmements, you must also change show_callback and friends to match! */
|
||||
if (!command) {
|
||||
stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
@ -2045,13 +2006,11 @@ SWITCH_STANDARD_API(uuid_getvar_function)
|
||||
|
||||
stream->write_function(stream, "-USAGE: %s\n", GETVAR_SYNTAX);
|
||||
|
||||
done:
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define DUMP_SYNTAX "<uuid> [format]"
|
||||
SWITCH_STANDARD_API(uuid_dump_function)
|
||||
{
|
||||
@ -2111,15 +2070,11 @@ SWITCH_STANDARD_API(uuid_dump_function)
|
||||
|
||||
stream->write_function(stream, "-USAGE: %s\n", DUMP_SYNTAX);
|
||||
|
||||
done:
|
||||
done:
|
||||
switch_safe_free(mycmd);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define GLOBAL_SETVAR_SYNTAX "<var> <value>"
|
||||
SWITCH_STANDARD_API(global_setvar_function)
|
||||
{
|
||||
@ -2158,7 +2113,7 @@ SWITCH_STANDARD_API(global_getvar_function)
|
||||
}
|
||||
|
||||
stream->write_function(stream, "-USAGE: %s\n", GLOBAL_GETVAR_SYNTAX);
|
||||
done:
|
||||
done:
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -2187,8 +2142,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_dump", "uuid_dump", uuid_dump_function, DUMP_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "global_setvar", "global_setvar", global_setvar_function, GLOBAL_SETVAR_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "global_getvar", "global_getvar", global_getvar_function, GLOBAL_GETVAR_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace (depricated)",
|
||||
session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
|
||||
SWITCH_ADD_API(commands_api_interface, "session_displace", "session displace (depricated)", session_displace_function, DISPLACE_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
|
||||
SWITCH_ADD_API(commands_api_interface, "session_record", "session record (depricated)", session_record_function, SESS_REC_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
|
||||
@ -2211,8 +2165,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
|
||||
SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
|
||||
SWITCH_ADD_API(commands_api_interface, "is_lan_addr", "see if an ip is a lan addr", lan_addr_function, "<ip>");
|
||||
SWITCH_ADD_API(commands_api_interface, "cond", "Eval a conditional", cond_function, "<expr> ? <true val> : <false val>");
|
||||
// remove me before final release
|
||||
SWITCH_ADD_API(commands_api_interface, "qq", "Eval a conditional", cond_function, "<expr> ? <true val> : <false val>");
|
||||
SWITCH_ADD_API(commands_api_interface, "regex", "Eval a regex", regex_function, "<data>|<pattern>[|<subst string>]");
|
||||
SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
|
||||
SWITCH_ADD_API(commands_api_interface, "find_user_xml", "find a user", find_user_function, "<key> <user> <domain>");
|
||||
|
Loading…
Reference in New Issue
Block a user