change switch_strlen_zero to zstr

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15211 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2009-10-23 16:03:42 +00:00
1 parent 410b6ebd1f
commit df7637f687
96 files changed
+1033 -1033

No files matched your search

@@ -98,7 +98,7 @@ static switch_status_t config_callback_dsn(switch_xml_config_item_t *data, const
if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
if(switch_strlen_zero(newvalue)) {
if(zstr(newvalue)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No local database defined.\n");
} else {
odbc_dsn = strdup(newvalue);
@@ -325,7 +325,7 @@ static char *do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, co
curl_easy_cleanup(curl_handle);
if ( http_data.stream.data &&
!switch_strlen_zero((char *)http_data.stream.data) &&
!zstr((char *)http_data.stream.data) &&
strcmp(" ", http_data.stream.data) ) {
name = switch_core_strdup(pool, http_data.stream.data);
@@ -564,7 +564,7 @@ SWITCH_STANDARD_API(cidlookup_function)
switch_bool_t skipurl = SWITCH_FALSE;
switch_bool_t skipcitystate = SWITCH_FALSE;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
}
@@ -49,7 +49,7 @@ SWITCH_STANDARD_API(host_lookup_function)
{
char host[256] = "";
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%s", "parameter missing\n");
} else {
if (switch_resolve_host(cmd, host, sizeof(host)) == SWITCH_STATUS_SUCCESS) {
@@ -146,7 +146,7 @@ SWITCH_STANDARD_API(time_test_function)
int diff;
int max = 10;
char *p;
if (switch_strlen_zero(cmd)){
if (zstr(cmd)){
stream->write_function(stream, "parameter missing\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -189,7 +189,7 @@ SWITCH_STANDARD_API(group_call_function)
char *fp = NULL;
const char *call_delim = ",";
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto end;
}
@@ -224,7 +224,7 @@ SWITCH_STANDARD_API(group_call_function)
domain = switch_core_get_variable("domain");
}
if (!switch_strlen_zero(domain)) {
if (!zstr(domain)) {
switch_xml_t xml, x_domain, x_group;
switch_event_t *params;
switch_stream_handle_t dstream = { 0 };
@@ -377,7 +377,7 @@ SWITCH_STANDARD_API(in_group_function)
const char *rval = "false";
char *group;
if (switch_strlen_zero(cmd) || !(mydata = strdup(cmd))) {
if (zstr(cmd) || !(mydata = strdup(cmd))) {
goto end;
}
@@ -427,7 +427,7 @@ SWITCH_STANDARD_API(user_data_function)
const char *container = "params", *elem = "param";
switch_event_t *params = NULL;
if (switch_strlen_zero(cmd) || !(mydata = strdup(cmd))) {
if (zstr(cmd) || !(mydata = strdup(cmd))) {
goto end;
}
@@ -580,7 +580,7 @@ SWITCH_STANDARD_API(md5_function)
{
char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%s", "!err!");
} else {
switch_md5_string(digest, (void *) cmd, strlen(cmd));
@@ -595,7 +595,7 @@ SWITCH_STANDARD_API(url_decode_function)
char *reply = "";
char *data = NULL;
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
data = strdup(cmd);
switch_url_decode(data);
reply = data;
@@ -627,7 +627,7 @@ SWITCH_STANDARD_API(stun_function)
ip = ip_buf;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%s", "-STUN Failed! NO STUN SERVER\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -658,7 +658,7 @@ SWITCH_STANDARD_API(stun_function)
switch_core_new_memory_pool(&pool);
if (switch_strlen_zero(stun_ip)) {
if (zstr(stun_ip)) {
stream->write_function(stream, "%s", "-STUN Failed! NO STUN SERVER\n");
} else {
if ((switch_stun_lookup(&ip, &port, stun_ip, stun_port, &error, pool)) == SWITCH_STATUS_SUCCESS && ip && port) {
@@ -684,7 +684,7 @@ SWITCH_STANDARD_API(expand_function)
switch_core_session_t *xsession;
char uuid[80] = "";
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-ERR, no input\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -699,7 +699,7 @@ SWITCH_STANDARD_API(expand_function)
}
}
if (switch_strlen_zero(mycmd)) {
if (zstr(mycmd)) {
stream->write_function(stream, "-ERR, no input\n");
return SWITCH_STATUS_SUCCESS;
}
@@ -739,7 +739,7 @@ SWITCH_STANDARD_API(eval_function)
char uuid[80] = "";
const char *p, *input = cmd;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%s", "");
return SWITCH_STATUS_SUCCESS;
}
@@ -751,7 +751,7 @@ SWITCH_STANDARD_API(eval_function)
}
}
if (switch_strlen_zero(input)) {
if (zstr(input)) {
stream->write_function(stream, "%s", "");
return SWITCH_STATUS_SUCCESS;
}
@@ -778,7 +778,7 @@ SWITCH_STANDARD_API(eval_function)
SWITCH_STANDARD_API(module_exists_function)
{
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
if (switch_loadable_module_exists(cmd) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "true");
} else {
@@ -793,7 +793,7 @@ SWITCH_STANDARD_API(domain_exists_function)
{
switch_xml_t root = NULL, domain = NULL;
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
if (switch_xml_locate_domain(cmd, NULL, &root, &domain) == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "true");
switch_xml_free(root);
@@ -811,7 +811,7 @@ SWITCH_STANDARD_API(url_encode_function)
char *data = NULL;
int len = 0 ;
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
len = (strlen(cmd) * 3) + 1;
switch_zmalloc(data, len);
switch_url_encode(cmd, data, len);
@@ -1249,7 +1249,7 @@ SWITCH_STANDARD_API(ctl_function)
char *mydata, *argv[5];
int32_t arg = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", CTL_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1374,7 +1374,7 @@ SWITCH_STANDARD_API(load_function)
{
const char *err;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", LOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1395,7 +1395,7 @@ SWITCH_STANDARD_API(unload_function)
switch_bool_t force = SWITCH_FALSE;
const char *p = cmd;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1419,7 +1419,7 @@ SWITCH_STANDARD_API(unload_function)
}
end:
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1439,7 +1439,7 @@ SWITCH_STANDARD_API(reload_function)
switch_bool_t force = SWITCH_FALSE;
const char *p = cmd;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1462,7 +1462,7 @@ SWITCH_STANDARD_API(reload_function)
}
end:
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1504,7 +1504,7 @@ SWITCH_STANDARD_API(kill_function)
char *mycmd = NULL, *kcause = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
if (zstr(cmd) || !(mycmd = strdup(cmd))) {
stream->write_function(stream, "-USAGE: %s\n", KILL_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1513,11 +1513,11 @@ SWITCH_STANDARD_API(kill_function)
*kcause++ = '\0';
}
if (switch_strlen_zero(mycmd) || !(ksession = switch_core_session_locate(mycmd))) {
if (zstr(mycmd) || !(ksession = switch_core_session_locate(mycmd))) {
stream->write_function(stream, "-ERR No Such Channel!\n");
} else {
switch_channel_t *channel = switch_core_session_get_channel(ksession);
if (!switch_strlen_zero(kcause)){
if (!zstr(kcause)){
cause = switch_channel_str2cause(kcause);
}
switch_channel_hangup(channel, cause);
@@ -1536,7 +1536,7 @@ SWITCH_STANDARD_API(preprocess_function)
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto usage;
}
@@ -1590,7 +1590,7 @@ SWITCH_STANDARD_API(transfer_function)
int argc = 0;
char *tuuid, *dest, *dp, *context, *arg = NULL;
if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
if (zstr(cmd) || !(mycmd = strdup(cmd))) {
stream->write_function(stream, "-USAGE: %s\n", TRANSFER_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1606,7 +1606,7 @@ SWITCH_STANDARD_API(transfer_function)
dp = argv[2];
context = argv[3];
if (switch_strlen_zero(tuuid) || !(tsession = switch_core_session_locate(tuuid))) {
if (zstr(tuuid) || !(tsession = switch_core_session_locate(tuuid))) {
stream->write_function(stream, "-ERR No Such Channel!\n");
goto done;
}
@@ -1734,13 +1734,13 @@ SWITCH_STANDARD_API(uuid_chat)
switch_core_session_t *tsession = NULL;
char *uuid = NULL, *text = NULL;
if (!switch_strlen_zero(cmd) && (uuid = strdup(cmd))) {
if (!zstr(cmd) && (uuid = strdup(cmd))) {
if ((text = strchr(uuid, ' '))) {
*text++ = '\0';
}
}
if (switch_strlen_zero(uuid) || switch_strlen_zero(text)) {
if (zstr(uuid) || zstr(text)) {
stream->write_function(stream, "-USAGE: %s\n", UUID_CHAT_SYNTAX);
} else {
if ((tsession = switch_core_session_locate(uuid))) {
@@ -1772,13 +1772,13 @@ SWITCH_STANDARD_API(uuid_deflect)
switch_core_session_t *tsession = NULL;
char *uuid = NULL, *text = NULL;
if (!switch_strlen_zero(cmd) && (uuid = strdup(cmd))) {
if (!zstr(cmd) && (uuid = strdup(cmd))) {
if ((text = strchr(uuid, ' '))) {
*text++ = '\0';
}
}
if (switch_strlen_zero(uuid) || switch_strlen_zero(text)) {
if (zstr(uuid) || zstr(text)) {
stream->write_function(stream, "-USAGE: %s\n", UUID_DEFLECT_SYNTAX);
} else {
if ((tsession = switch_core_session_locate(uuid))) {
@@ -1807,11 +1807,11 @@ SWITCH_STANDARD_API(sched_transfer_function)
char *mycmd = NULL, *argv[6] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 2 || argc > 5 || switch_strlen_zero(argv[0])) {
if (zstr(cmd) || argc < 2 || argc > 5 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SCHED_TRANSFER_SYNTAX);
} else {
char *uuid = argv[1];
@@ -1846,11 +1846,11 @@ SWITCH_STANDARD_API(sched_hangup_function)
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 1 || switch_strlen_zero(argv[0])) {
if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SCHED_HANGUP_SYNTAX);
} else {
char *uuid = argv[1];
@@ -1888,11 +1888,11 @@ SWITCH_STANDARD_API(uuid_media_function)
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 1 || switch_strlen_zero(argv[0])) {
if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", MEDIA_SYNTAX);
} else {
if (!strcasecmp(argv[0], "off")) {
@@ -1919,11 +1919,11 @@ SWITCH_STANDARD_API(uuid_broadcast_function)
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 2) {
if (zstr(cmd) || argc < 2) {
stream->write_function(stream, "-USAGE: %s\n", BROADCAST_SYNTAX);
} else {
switch_media_flag_t flags = SMF_NONE;
@@ -1955,11 +1955,11 @@ SWITCH_STANDARD_API(sched_broadcast_function)
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 3 || switch_strlen_zero(argv[0])) {
if (zstr(cmd) || argc < 3 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", SCHED_BROADCAST_SYNTAX);
} else {
switch_media_flag_t flags = SMF_NONE;
@@ -1998,11 +1998,11 @@ SWITCH_STANDARD_API(uuid_hold_function)
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 1 || switch_strlen_zero(argv[0])) {
if (zstr(cmd) || argc < 1 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", HOLD_SYNTAX);
} else {
if (!strcasecmp(argv[0], "off")) {
@@ -2029,11 +2029,11 @@ SWITCH_STANDARD_API(uuid_display_function)
int argc = 0;
switch_status_t status = SWITCH_STATUS_FALSE;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 2 || switch_strlen_zero(argv[0]) || switch_strlen_zero(argv[1])) {
if (zstr(cmd) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) {
stream->write_function(stream, "-USAGE: %s\n", DISPLAY_SYNTAX);
} else {
switch_core_session_message_t msg = { 0 };
@@ -2065,11 +2065,11 @@ SWITCH_STANDARD_API(uuid_bridge_function)
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 2) {
if (zstr(cmd) || argc < 2) {
stream->write_function(stream, "-USAGE: %s\n", UUID_SYNTAX);
} else {
switch_status_t status;
@@ -2105,7 +2105,7 @@ SWITCH_STANDARD_API(session_record_function)
int argc = 0;
uint32_t limit = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto usage;
}
@@ -2122,7 +2122,7 @@ SWITCH_STANDARD_API(session_record_function)
path = argv[2];
limit = argv[3] ? atoi(argv[3]) : 0;
if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
if (zstr(uuid) || zstr(action) || zstr(path)) {
goto usage;
}
@@ -2171,7 +2171,7 @@ SWITCH_STANDARD_API(session_displace_function)
uint32_t limit = 0;
char *flags = NULL;
if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto usage;
}
@@ -2185,7 +2185,7 @@ SWITCH_STANDARD_API(session_displace_function)
limit = argv[3] ? atoi(argv[3]) : 0;
flags = argv[4];
if (switch_strlen_zero(uuid) || switch_strlen_zero(action) || switch_strlen_zero(path)) {
if (zstr(uuid) || zstr(action) || zstr(path)) {
goto usage;
}
@@ -2232,7 +2232,7 @@ SWITCH_STANDARD_API(break_function)
switch_channel_t *channel = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", BREAK_SYNTAX);
goto done;
}
@@ -2277,11 +2277,11 @@ SWITCH_STANDARD_API(pause_function)
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
if (switch_strlen_zero(cmd) || argc < 2 || switch_strlen_zero(argv[0])) {
if (zstr(cmd) || argc < 2 || zstr(argv[0])) {
stream->write_function(stream, "-USAGE: %s\n", PAUSE_SYNTAX);
} else {
char *uuid = argv[0];
@@ -2320,7 +2320,7 @@ SWITCH_STANDARD_API(originate_function)
uint8_t machine = 1;
switch_status_t status = SWITCH_STATUS_SUCCESS;
if (session || switch_strlen_zero(cmd)) {
if (session || zstr(cmd)) {
stream->write_function(stream, "-USAGE %s\n", ORIGINATE_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -3000,7 +3000,7 @@ SWITCH_STANDARD_API(show_function)
/* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SQL: %s.\n", sql); */
if (!strcasecmp(as, "delim") || !strcasecmp(as, "csv")) {
if (switch_strlen_zero(holder.delim)) {
if (zstr(holder.delim)) {
if (!(holder.delim = argv[3])) {
holder.delim = ",";
}
@@ -3075,7 +3075,7 @@ SWITCH_STANDARD_API(help_function)
{
char showcmd[1024];
int all = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
sprintf(showcmd, "help");
all = 1;
} else {
@@ -3100,7 +3100,7 @@ SWITCH_STANDARD_API(uuid_session_heartbeat_function)
switch_core_session_t *l_session = NULL;
int x = 0, sched = 0;
if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto error;
}
@@ -3158,7 +3158,7 @@ SWITCH_STANDARD_API(uuid_flush_dtmf_function)
{
switch_core_session_t *fsession;
if (!switch_strlen_zero(cmd) && (fsession = switch_core_session_locate(cmd))) {
if (!zstr(cmd) && (fsession = switch_core_session_locate(cmd))) {
switch_channel_flush_dtmf(switch_core_session_get_channel(fsession));
switch_core_session_rwunlock(fsession);
stream->write_function(stream, "+OK\n");
@@ -3176,9 +3176,9 @@ SWITCH_STANDARD_API(uuid_setvar_function)
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
if ((argc == 2 || argc == 3) && !zstr(argv[0])) {
char *uuid = argv[0];
char *var_name = argv[1];
char *var_value = NULL;
@@ -3191,7 +3191,7 @@ SWITCH_STANDARD_API(uuid_setvar_function)
switch_channel_t *channel;
channel = switch_core_session_get_channel(psession);
if (switch_strlen_zero(var_name)) {
if (zstr(var_name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
stream->write_function(stream, "-ERR No variable specified\n");
} else {
@@ -3224,7 +3224,7 @@ SWITCH_STANDARD_API(uuid_setvar_multi_function)
int argc = 0;
char *var_name, *var_value = NULL;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
char *uuid = mycmd;
if (!(vars = strchr(uuid, ' '))) {
goto done;
@@ -3241,7 +3241,7 @@ SWITCH_STANDARD_API(uuid_setvar_multi_function)
if (var_name && (var_value = strchr(var_name, '='))) {
*var_value++ = '\0';
}
if (switch_strlen_zero(var_name)) {
if (zstr(var_name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
stream->write_function(stream, "-ERR No variable specified\n");
} else {
@@ -3289,9 +3289,9 @@ SWITCH_STANDARD_API(uuid_getvar_function)
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc >= 2 && !switch_strlen_zero(argv[0])) {
if (argc >= 2 && !zstr(argv[0])) {
char *uuid = argv[0];
char *var_name = argv[1];
const char *var_value = NULL;
@@ -3300,7 +3300,7 @@ SWITCH_STANDARD_API(uuid_getvar_function)
switch_channel_t *channel;
channel = switch_core_session_get_channel(psession);
if (switch_strlen_zero(var_name)) {
if (zstr(var_name)) {
stream->write_function(stream, "-ERR No variable name specified!\n");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
@@ -3336,7 +3336,7 @@ SWITCH_STANDARD_API(uuid_send_dtmf_function)
char *uuid = NULL, *dtmf_data = NULL;
int argc = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto usage;
}
@@ -3350,7 +3350,7 @@ SWITCH_STANDARD_API(uuid_send_dtmf_function)
uuid = argv[0];
dtmf_data = argv[1];
if (switch_strlen_zero(uuid) || switch_strlen_zero(dtmf_data)) {
if (zstr(uuid) || zstr(dtmf_data)) {
goto usage;
}
@@ -3381,9 +3381,9 @@ SWITCH_STANDARD_API(uuid_dump_function)
char *mycmd = NULL, *argv[4] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc >= 0 && !switch_strlen_zero(argv[0])) {
if (argc >= 0 && !zstr(argv[0])) {
char *uuid = argv[0];
char *format = argv[1];
@@ -3445,13 +3445,13 @@ SWITCH_STANDARD_API(global_setvar_function)
char *mycmd = NULL, *argv[2] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, '=', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc > 0 && !switch_strlen_zero(argv[0])) {
if (argc > 0 && !zstr(argv[0])) {
char *var_name = argv[0];
char *var_value = argv[1];
if (switch_strlen_zero(var_value)) {
if (zstr(var_value)) {
var_value = NULL;
}
switch_core_set_variable(var_name, var_value);
@@ -3470,7 +3470,7 @@ SWITCH_STANDARD_API(global_setvar_function)
#define GLOBAL_GETVAR_SYNTAX "<var>"
SWITCH_STANDARD_API(global_getvar_function)
{
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
switch_core_dump_variables(stream);
} else {
stream->write_function(stream, "%s", switch_str_nil(switch_core_get_variable(cmd)));
@@ -3481,7 +3481,7 @@ SWITCH_STANDARD_API(global_getvar_function)
#define SYSTEM_SYNTAX "<command>"
SWITCH_STANDARD_API(system_function)
{
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -3498,7 +3498,7 @@ SWITCH_STANDARD_API(system_function)
#define SYSTEM_SYNTAX "<command>"
SWITCH_STANDARD_API(bg_system_function)
{
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -3517,7 +3517,7 @@ SWITCH_STANDARD_API(strftime_tz_api_function)
const char *tz_name = NULL;
char date[80] = "";
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
format = strchr(cmd, ' ');
tz_name = cmd;
if (format) {
@@ -3542,7 +3542,7 @@ SWITCH_STANDARD_API(hupall_api_function)
char *val = NULL;
switch_call_cause_t cause = SWITCH_CAUSE_MANAGER_REQUEST;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
switch_assert(argv[0]);
if ((cause = switch_channel_str2cause(argv[0])) == SWITCH_CAUSE_NONE) {
@@ -3556,13 +3556,13 @@ SWITCH_STANDARD_API(hupall_api_function)
var = NULL;
}
if (switch_strlen_zero(var)) {
if (zstr(var)) {
switch_core_session_hupall(cause);
} else {
switch_core_session_hupall_matching_var(var, val, cause);
}
if (switch_strlen_zero(var)) {
if (zstr(var)) {
stream->write_function(stream, "+OK hangup all channels with cause %s\n", switch_channel_cause2str(cause));
} else {
stream->write_function(stream, "+OK hangup all channels matching [%s]=[%s] with cause: %s\n", var, val, switch_channel_cause2str(cause));
@@ -676,7 +676,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
switch_snprintf(saymsg, sizeof(saymsg), "Auto Calling %d parties", call_list->itteration);
conference_member_say(member, saymsg, 0);
} else {
if (switch_strlen_zero(conference->special_announce)) {
if (zstr(conference->special_announce)) {
/* announce the total number of members in the conference */
if (conference->count >= conference->announce_count && conference->announce_count > 1) {
switch_snprintf(msg, sizeof(msg), "There are %d callers", conference->count);
@@ -1882,7 +1882,7 @@ static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, v
if (switch_test_flag(member, MFLAG_MUTE_DETECT) && !switch_test_flag(member, MFLAG_CAN_SPEAK)) {
if (!switch_strlen_zero(member->conference->mute_detect_sound)) {
if (!zstr(member->conference->mute_detect_sound)) {
conference_member_play_file(member, member->conference->mute_detect_sound, 0);
}
@@ -2782,7 +2782,7 @@ static switch_status_t conference_member_play_file(conference_member_t *member,
expanded = NULL;
}
if (!strncasecmp(file, "say:", 4)) {
if (!switch_strlen_zero(file + 4)) {
if (!zstr(file + 4)) {
status = conference_member_say(member, file + 4, leadin);
}
goto done;
@@ -2793,7 +2793,7 @@ static switch_status_t conference_member_play_file(conference_member_t *member,
goto done;
}
file = dfile;
} else if (!switch_strlen_zero(file)) {
} else if (!zstr(file)) {
status = conference_member_say(member, file, leadin);
goto done;
}
@@ -2853,7 +2853,7 @@ static switch_status_t conference_member_say(conference_member_t *member, char *
switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
switch_status_t status = SWITCH_STATUS_FALSE;
if (member == NULL || switch_strlen_zero(text))
if (member == NULL || zstr(text))
return SWITCH_STATUS_FALSE;
switch_assert(conference != NULL);
@@ -2935,7 +2935,7 @@ static switch_status_t conference_say(conference_obj_t *conference, const char *
switch_assert(conference != NULL);
if (switch_strlen_zero(text)) {
if (zstr(text)) {
return SWITCH_STATUS_GENERR;
}
@@ -3123,7 +3123,7 @@ static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_str
return SWITCH_STATUS_GENERR;
switch_clear_flag_locked(member, MFLAG_CAN_SPEAK);
if (!switch_strlen_zero(member->conference->muted_sound)) {
if (!zstr(member->conference->muted_sound)) {
conference_member_play_file(member, member->conference->muted_sound, 0);
} else {
char msg[512];
@@ -3155,7 +3155,7 @@ static switch_status_t conf_api_sub_unmute(conference_member_t *member, switch_s
if (stream != NULL) {
stream->write_function(stream, "OK unmute %u\n", member->id);
}
if (!switch_strlen_zero(member->conference->unmuted_sound)) {
if (!zstr(member->conference->unmuted_sound)) {
conference_member_play_file(member, member->conference->unmuted_sound, 0);
} else {
char msg[512];
@@ -3250,7 +3250,7 @@ static switch_status_t conf_api_sub_dtmf(conference_member_t *member, switch_str
return SWITCH_STATUS_GENERR;
}
if (switch_strlen_zero(dtmf)) {
if (zstr(dtmf)) {
stream->write_function(stream, "Invalid input!\n");
return SWITCH_STATUS_GENERR;
}
@@ -3620,7 +3620,7 @@ static switch_status_t conf_api_sub_say(conference_obj_t *conference, switch_str
{
switch_event_t *event;
if (switch_strlen_zero(text)) {
if (zstr(text)) {
stream->write_function(stream, "(say) Error! No text.\n");
return SWITCH_STATUS_GENERR;
}
@@ -3650,7 +3650,7 @@ static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, swit
conference_member_t *member;
switch_event_t *event;
if (switch_strlen_zero(text)) {
if (zstr(text)) {
stream->write_function(stream, "(saymember) No Text!\n");
goto done;
}
@@ -3667,7 +3667,7 @@ static switch_status_t conf_api_sub_saymember(conference_obj_t *conference, swit
id = atoi(workspace);
if (!id || switch_strlen_zero(text)) {
if (!id || zstr(text)) {
stream->write_function(stream, "(saymember) No Text!\n");
goto done;
}
@@ -3910,7 +3910,7 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc
switch_assert(conference != NULL);
switch_assert(stream != NULL);
if (argc > 3 && !switch_strlen_zero(argv[2])) {
if (argc > 3 && !zstr(argv[2])) {
int x;
conf_name = strdup(argv[2]);
@@ -4274,7 +4274,7 @@ switch_status_t conf_api_dispatch(conference_obj_t *conference, switch_stream_ha
const char *modified_cmdline = cmdline;
const char *cmd = conf_api_sub_commands[i].pname;
if (!switch_strlen_zero(modified_cmdline) && (start_text = strstr(modified_cmdline, cmd))) {
if (!zstr(modified_cmdline) && (start_text = strstr(modified_cmdline, cmd))) {
modified_cmdline = start_text + strlen(cmd);
while (modified_cmdline && (*modified_cmdline == ' ' || *modified_cmdline == '\t')) {
modified_cmdline++;
@@ -4421,11 +4421,11 @@ static switch_status_t conference_outcall(conference_obj_t *conference,
caller_channel = switch_core_session_get_channel(session);
}
if (switch_strlen_zero(cid_name)) {
if (zstr(cid_name)) {
cid_name = conference->caller_id_name;
}
if (switch_strlen_zero(cid_num)) {
if (zstr(cid_num)) {
cid_num = conference->caller_id_number;
}
@@ -4810,7 +4810,7 @@ SWITCH_STANDARD_APP(conference_auto_function)
call_list = switch_channel_get_private(channel, "_conference_autocall_list_");
if (switch_strlen_zero(data)) {
if (zstr(data)) {
call_list = NULL;
} else {
np = switch_core_session_alloc(session, sizeof(*np));
@@ -4964,7 +4964,7 @@ SWITCH_STANDARD_APP(conference_function)
}
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Invalid arguments\n");
return;
}
@@ -5121,11 +5121,11 @@ SWITCH_STANDARD_APP(conference_function)
switch_channel_set_variable(channel, "conference_name", conference->name);
/* Set MOH from variable if not set */
if(switch_strlen_zero(conference->moh_sound)) {
if(zstr(conference->moh_sound)) {
conference->moh_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_moh_sound"));
}
/* Set perpetual-sound from variable if not set */
if(switch_strlen_zero(conference->perpetual_sound)) {
if(zstr(conference->perpetual_sound)) {
conference->perpetual_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_perpetual_sound"));
}
@@ -5155,7 +5155,7 @@ SWITCH_STANDARD_APP(conference_function)
/* if this is not an outbound call, deal with conference pins */
if (enforce_security && !switch_strlen_zero(dpin)) {
if (enforce_security && !zstr(dpin)) {
char pin_buf[80] = "";
int pin_retries = 3; /* XXX - this should be configurable - i'm too lazy to do it right now... */
int pin_valid = 0;
@@ -5259,7 +5259,7 @@ SWITCH_STANDARD_APP(conference_function)
}
/* if we're using "bridge:" make an outbound call and bridge it in */
if (!switch_strlen_zero(bridgeto) && strcasecmp(bridgeto, "none")) {
if (!zstr(bridgeto) && strcasecmp(bridgeto, "none")) {
switch_call_cause_t cause;
if (conference_outcall(conference, NULL, session, bridgeto, 60, NULL, NULL, NULL, &cause) != SWITCH_STATUS_SUCCESS) {
goto done;
@@ -5512,7 +5512,7 @@ static switch_status_t conf_default_controls(conference_obj_t *conference)
switch_assert(conference != NULL);
for (i = 0, status = SWITCH_STATUS_SUCCESS; status == SWITCH_STATUS_SUCCESS && i < CCFNTBL_QTY; i++) {
if (!switch_strlen_zero(ccfntbl[i].digits)) {
if (!zstr(ccfntbl[i].digits)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Installing default caller control action '%s' bound to '%s'.\n", ccfntbl[i].key, ccfntbl[i].digits);
action = (caller_control_action_t *) switch_core_alloc(conference->pool, sizeof(caller_control_action_t));
@@ -5548,7 +5548,7 @@ static switch_status_t conference_new_install_caller_controls_custom(conference_
char *val = (char *) switch_xml_attr(xml_kvp, "digits");
char *data = (char *) switch_xml_attr_soft(xml_kvp, "data");
if (!switch_strlen_zero(key) && !switch_strlen_zero(val)) {
if (!zstr(key) && !zstr(val)) {
uint32_t i;
/* scan through all of the valid actions, and if found, */
@@ -5640,7 +5640,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
char *auto_record = NULL;
/* Validate the conference name */
if (switch_strlen_zero(name)) {
if (zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Record! no name.\n");
return NULL;
}
@@ -5665,14 +5665,14 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
var = buf;
}
if (!strcasecmp(var, "rate") && !switch_strlen_zero(val)) {
if (!strcasecmp(var, "rate") && !zstr(val)) {
uint32_t tmp = atoi(val);
if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
rate = tmp;
}
} else if (!strcasecmp(var, "domain") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "domain") && !zstr(val)) {
domain = val;
} else if (!strcasecmp(var, "interval") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "interval") && !zstr(val)) {
uint32_t tmp = atoi(val);
if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
interval = tmp;
@@ -5680,59 +5680,59 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
}
} else if (!strcasecmp(var, "timer-name") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
timer_name = val;
} else if (!strcasecmp(var, "tts-engine") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "tts-engine") && !zstr(val)) {
tts_engine = val;
} else if (!strcasecmp(var, "tts-voice") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "tts-voice") && !zstr(val)) {
tts_voice = val;
} else if (!strcasecmp(var, "enter-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "enter-sound") && !zstr(val)) {
enter_sound = val;
} else if (!strcasecmp(var, "exit-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "exit-sound") && !zstr(val)) {
exit_sound = val;
} else if (!strcasecmp(var, "alone-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "alone-sound") && !zstr(val)) {
alone_sound = val;
} else if (!strcasecmp(var, "perpetual-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "perpetual-sound") && !zstr(val)) {
perpetual_sound = val;
} else if (!strcasecmp(var, "moh-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "moh-sound") && !zstr(val)) {
moh_sound = val;
} else if (!strcasecmp(var, "ack-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "ack-sound") && !zstr(val)) {
ack_sound = val;
} else if (!strcasecmp(var, "nack-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "nack-sound") && !zstr(val)) {
nack_sound = val;
} else if (!strcasecmp(var, "muted-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "muted-sound") && !zstr(val)) {
muted_sound = val;
} else if (!strcasecmp(var, "mute-detect-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "mute-detect-sound") && !zstr(val)) {
mute_detect_sound = val;
} else if (!strcasecmp(var, "unmuted-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "unmuted-sound") && !zstr(val)) {
unmuted_sound = val;
} else if (!strcasecmp(var, "locked-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "locked-sound") && !zstr(val)) {
locked_sound = val;
} else if (!strcasecmp(var, "is-locked-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "is-locked-sound") && !zstr(val)) {
is_locked_sound = val;
} else if (!strcasecmp(var, "is-unlocked-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "is-unlocked-sound") && !zstr(val)) {
is_unlocked_sound = val;
} else if (!strcasecmp(var, "member-flags") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "member-flags") && !zstr(val)) {
member_flags = val;
} else if (!strcasecmp(var, "conference-flags") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "conference-flags") && !zstr(val)) {
conference_flags = val;
} else if (!strcasecmp(var, "kicked-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "kicked-sound") && !zstr(val)) {
kicked_sound = val;
} else if (!strcasecmp(var, "pin") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "pin") && !zstr(val)) {
pin = val;
} else if (!strcasecmp(var, "pin-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "pin-sound") && !zstr(val)) {
pin_sound = val;
} else if (!strcasecmp(var, "bad-pin-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "bad-pin-sound") && !zstr(val)) {
bad_pin_sound = val;
} else if (!strcasecmp(var, "energy-level") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "energy-level") && !zstr(val)) {
energy_level = val;
} else if (!strcasecmp(var, "caller-id-name") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "caller-id-name") && !zstr(val)) {
caller_id_name = val;
} else if (!strcasecmp(var, "caller-id-number") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "caller-id-number") && !zstr(val)) {
caller_id_number = val;
} else if (!strcasecmp(var, "caller-controls") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "caller-controls") && !zstr(val)) {
caller_controls = val;
} else if (!strcasecmp(var, "comfort-noise") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "comfort-noise") && !zstr(val)) {
int tmp;
tmp = atoi(val);
if (tmp > 1 && tmp < 10000) {
@@ -5740,9 +5740,9 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
} else if (switch_true(val)) {
comfort_noise_level = 1400;
}
} else if (!strcasecmp(var, "sound-prefix") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) {
sound_prefix = val;
} else if (!strcasecmp(var, "max-members") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "max-members") && !zstr(val)) {
errno = 0; /* sanity first */
max_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
if (errno == ERANGE || errno == EINVAL || max_members < 0 || max_members == 1) {
@@ -5752,20 +5752,20 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
max_members = 0; /* set to 0 to disable max counts */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-members %s is invalid, not setting a limit\n", val);
}
} else if (!strcasecmp(var, "max-members-sound") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "max-members-sound") && !zstr(val)) {
maxmember_sound = val;
} else if (!strcasecmp(var, "announce-count") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "announce-count") && !zstr(val)) {
errno = 0; /* safety first */
announce_count = strtol(val, NULL, 0);
if (errno == ERANGE || errno == EINVAL) {
announce_count = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "announce-count is invalid, not anouncing member counts\n");
}
} else if (!strcasecmp(var, "suppress-events") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "suppress-events") && !zstr(val)) {
suppress_events = val;
} else if (!strcasecmp(var, "verbose-events") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "verbose-events") && !zstr(val)) {
verbose_events = val;
} else if (!strcasecmp(var, "auto-record") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "auto-record") && !zstr(val)) {
auto_record = val;
}
}
@@ -5773,17 +5773,17 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
/* Set defaults and various paramaters */
/* Timer module to use */
if (switch_strlen_zero(timer_name)) {
if (zstr(timer_name)) {
timer_name = "soft";
}
/* Caller ID Name */
if (switch_strlen_zero(caller_id_name)) {
if (zstr(caller_id_name)) {
caller_id_name = (char *) global_app_name;
}
/* Caller ID Number */
if (switch_strlen_zero(caller_id_number)) {
if (zstr(caller_id_number)) {
caller_id_number = "0000000000";
}
@@ -5823,13 +5823,13 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
conference->caller_id_number = switch_core_strdup(conference->pool, caller_id_number);
if (!switch_strlen_zero(perpetual_sound)) {
if (!zstr(perpetual_sound)) {
conference->perpetual_sound = switch_core_strdup(conference->pool, perpetual_sound);
}
conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
if (!switch_strlen_zero(moh_sound) && switch_is_moh(moh_sound)) {
if (!zstr(moh_sound) && switch_is_moh(moh_sound)) {
conference->moh_sound = switch_core_strdup(conference->pool, moh_sound);
}
@@ -5845,75 +5845,75 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
conference->sound_prefix = switch_core_strdup(conference->pool, sound_prefix);
}
if (!switch_strlen_zero(enter_sound)) {
if (!zstr(enter_sound)) {
conference->enter_sound = switch_core_strdup(conference->pool, enter_sound);
}
if (!switch_strlen_zero(exit_sound)) {
if (!zstr(exit_sound)) {
conference->exit_sound = switch_core_strdup(conference->pool, exit_sound);
}
if (!switch_strlen_zero(ack_sound)) {
if (!zstr(ack_sound)) {
conference->ack_sound = switch_core_strdup(conference->pool, ack_sound);
}
if (!switch_strlen_zero(nack_sound)) {
if (!zstr(nack_sound)) {
conference->nack_sound = switch_core_strdup(conference->pool, nack_sound);
}
if (!switch_strlen_zero(muted_sound)) {
if (!zstr(muted_sound)) {
conference->muted_sound = switch_core_strdup(conference->pool, muted_sound);
}
if (switch_strlen_zero(mute_detect_sound)) {
if (!switch_strlen_zero(muted_sound)) {
if (zstr(mute_detect_sound)) {
if (!zstr(muted_sound)) {
conference->mute_detect_sound = switch_core_strdup(conference->pool, muted_sound);
}
} else {
conference->mute_detect_sound = switch_core_strdup(conference->pool, mute_detect_sound);
}
if (!switch_strlen_zero(unmuted_sound)) {
if (!zstr(unmuted_sound)) {
conference->unmuted_sound = switch_core_strdup(conference->pool, unmuted_sound);
}
if (!switch_strlen_zero(kicked_sound)) {
if (!zstr(kicked_sound)) {
conference->kicked_sound = switch_core_strdup(conference->pool, kicked_sound);
}
if (!switch_strlen_zero(pin_sound)) {
if (!zstr(pin_sound)) {
conference->pin_sound = switch_core_strdup(conference->pool, pin_sound);
}
if (!switch_strlen_zero(bad_pin_sound)) {
if (!zstr(bad_pin_sound)) {
conference->bad_pin_sound = switch_core_strdup(conference->pool, bad_pin_sound);
}
if (!switch_strlen_zero(pin)) {
if (!zstr(pin)) {
conference->pin = switch_core_strdup(conference->pool, pin);
}
if (!switch_strlen_zero(alone_sound)) {
if (!zstr(alone_sound)) {
conference->alone_sound = switch_core_strdup(conference->pool, alone_sound);
}
if (!switch_strlen_zero(locked_sound)) {
if (!zstr(locked_sound)) {
conference->locked_sound = switch_core_strdup(conference->pool, locked_sound);
}
if (!switch_strlen_zero(is_locked_sound)) {
if (!zstr(is_locked_sound)) {
conference->is_locked_sound = switch_core_strdup(conference->pool, is_locked_sound);
}
if (!switch_strlen_zero(is_unlocked_sound)) {
if (!zstr(is_unlocked_sound)) {
conference->is_unlocked_sound = switch_core_strdup(conference->pool, is_unlocked_sound);
}
if (!switch_strlen_zero(energy_level)) {
if (!zstr(energy_level)) {
conference->energy_level = atoi(energy_level);
}
if (!switch_strlen_zero(maxmember_sound)) {
if (!zstr(maxmember_sound)) {
conference->maxmember_sound = switch_core_strdup(conference->pool, maxmember_sound);
}
/* its going to be 0 by default, set to a value otherwise so this should be safe */
@@ -5931,15 +5931,15 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_m
conference->dtmf_parser = NULL;
conference->eflags = 0xFFFFFFFF;
if (!switch_strlen_zero(suppress_events)) {
if (!zstr(suppress_events)) {
clear_eflags(suppress_events, &conference->eflags);
}
if (!switch_strlen_zero(auto_record)) {
if (!zstr(auto_record)) {
conference->auto_record = switch_core_strdup(conference->pool, auto_record);
}
if (!switch_strlen_zero(verbose_events) && switch_true(verbose_events)) {
if (!zstr(verbose_events) && switch_true(verbose_events)) {
conference->verbose_events = 1;
}
+3 -3
View File
@@ -151,7 +151,7 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c
curl_easy_cleanup(curl_handle);
if ( http_data->stream.data &&
!switch_strlen_zero((char *)http_data->stream.data) &&
!zstr((char *)http_data->stream.data) &&
strcmp(" ", http_data->stream.data) ) {
http_data->http_response = switch_core_strdup(pool, http_data->stream.data);
@@ -185,7 +185,7 @@ static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data) {
*data = '\0';
}
if switch_strlen_zero(header->data) {
if zstr(header->data) {
header = header->next;
continue;
}
@@ -336,7 +336,7 @@ SWITCH_STANDARD_API(curl_function)
switch_memory_pool_t *pool = NULL;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
}
@@ -542,7 +542,7 @@ static switch_status_t populate_database(switch_core_session_t *session, dir_pro
} else {
fullName = caller_name;
}
if (switch_strlen_zero(fullName)) {
if (zstr(fullName)) {
continue;
}
firstName = switch_core_session_strdup(session, fullName);
@@ -649,29 +649,29 @@ static switch_status_t listen_entry(switch_core_session_t *session, dir_profile_
switch_safe_free(stream.data);
}
if (switch_strlen_zero_buf(buf)) {
if (zstr_buf(buf)) {
switch_snprintf(macro, sizeof(macro), "phrase:%s:%d", DIR_RESULT_ITEM, cbt->want+1);
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
}
if (!switch_strlen_zero_buf(recorded_name) && switch_strlen_zero_buf(buf)) {
if (!zstr_buf(recorded_name) && zstr_buf(buf)) {
switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key);
}
if (switch_strlen_zero_buf(recorded_name) && switch_strlen_zero_buf(buf)) {
if (zstr_buf(recorded_name) && zstr_buf(buf)) {
switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_SAY_NAME, cbt->fullname);
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
}
if (cbt->exten_visible && switch_strlen_zero_buf(buf)) {
if (cbt->exten_visible && zstr_buf(buf)) {
switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_AT, cbt->extension);
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
}
if (switch_strlen_zero_buf(buf)) {
if (zstr_buf(buf)) {
switch_snprintf(macro, sizeof(macro), "phrase:%s:%c,%c,%c,%c", DIR_RESULT_MENU, *profile->select_name_key, *profile->next_key, *profile->prev_key, *profile->new_search_key);
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key);
}
if (!switch_strlen_zero_buf(buf)) {
if (!zstr_buf(buf)) {
if (buf[0] == *profile->select_name_key) {
switch_copy_string(cbt->transfer_to, cbt->extension, 255);
}
@@ -781,7 +781,7 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p
listing_cbt.move = ENTRY_MOVE_NEXT;
directory_execute_sql_callback(profile->mutex, sql, listing_callback, &listing_cbt);
status = listen_entry(session, profile, &listing_cbt);
if (!switch_strlen_zero(listing_cbt.transfer_to)) {
if (!zstr(listing_cbt.transfer_to)) {
switch_copy_string(params->transfer_to, listing_cbt.transfer_to, 255);
break;
}
@@ -833,7 +833,7 @@ SWITCH_STANDARD_APP(directory_function)
int attempts = 3;
char macro[255];
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing profile name\n");
return;
}
@@ -871,7 +871,7 @@ SWITCH_STANDARD_APP(directory_function)
s_param.try_again = 0;
gather_name_digit(session, profile, &s_param);
if (switch_strlen_zero(s_param.digits)) {
if (zstr(s_param.digits)) {
s_param.try_again = 1;
continue;
}
@@ -886,7 +886,7 @@ SWITCH_STANDARD_APP(directory_function)
navigate_entrys(session, profile, &s_param);
}
if (!switch_strlen_zero(s_param.transfer_to)) {
if (!zstr(s_param.transfer_to)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Directory transfering call to : %s\n", s_param.transfer_to);
switch_ivr_session_transfer(session, s_param.transfer_to, "XML", domain_name);
}
+57 -57
View File
@@ -55,11 +55,11 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt)
abort();
}
if (switch_strlen_zero(target)) {
if (zstr(target)) {
target = caller_profile->destination_number;
}
if (!switch_strlen_zero(target) && (lbuf = switch_core_session_strdup(session, target))
if (!zstr(target) && (lbuf = switch_core_session_strdup(session, target))
&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
} else {
return NULL;
@@ -91,7 +91,7 @@ SWITCH_STANDARD_APP(detect_speech_function)
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (!strcasecmp(argv[0], "grammar") && argc >= 1) {
switch_ivr_detect_speech_load_grammar(session, argv[1], argv[2]);
@@ -154,7 +154,7 @@ SWITCH_STANDARD_APP(exe_function)
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
switch_core_session_execute_exten(session, argv[0], argv[1], argv[2]);
} else {
@@ -176,7 +176,7 @@ SWITCH_STANDARD_APP(soft_hold_function)
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_ivr_soft_hold(session, argv[0], argv[1], argv[2]);
} else {
@@ -205,7 +205,7 @@ SWITCH_STANDARD_APP(dtmf_bind_function)
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
int kval = atoi(argv[0]);
switch_bind_flag_t bind_flags = 0;
@@ -283,7 +283,7 @@ SWITCH_STANDARD_APP(intercept_function)
char *uuid;
switch_bool_t bleg = SWITCH_FALSE;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
if (!strcasecmp(argv[0], "-bleg")) {
if (argv[1]) {
@@ -327,7 +327,7 @@ static int e_callback(void *pArg, int argc, char **argv, char **columnNames)
#define eavesdrop_SYNTAX "[all | <uuid>]"
SWITCH_STANDARD_APP(eavesdrop_function)
{
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", eavesdrop_SYNTAX);
} else {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -401,7 +401,7 @@ SWITCH_STANDARD_APP(eavesdrop_function)
#define threeway_SYNTAX "<uuid>"
SWITCH_STANDARD_APP(three_way_function)
{
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", threeway_SYNTAX);
} else {
switch_ivr_eavesdrop_session(session, data, NULL, ED_MUX_READ | ED_MUX_WRITE);
@@ -458,7 +458,7 @@ SWITCH_STANDARD_APP(check_acl_function)
char *mydata;
switch_call_cause_t cause = SWITCH_CAUSE_CALL_REJECTED;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
if (!switch_check_network_list_ip(argv[0], argv[1])) {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -486,7 +486,7 @@ SWITCH_STANDARD_APP(transfer_function)
int bleg = 0, both = 0;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
bleg = !strcasecmp(argv[0], "-bleg");
both = !strcasecmp(argv[0], "-both");
@@ -521,7 +521,7 @@ SWITCH_STANDARD_APP(sched_transfer_function)
char *argv[4] = { 0 };
char *mydata;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
time_t when;
@@ -544,7 +544,7 @@ SWITCH_STANDARD_APP(sched_hangup_function)
char *argv[5] = { 0 };
char *mydata;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
time_t when;
switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT;
@@ -577,7 +577,7 @@ SWITCH_STANDARD_APP(sched_broadcast_function)
char *argv[6] = { 0 };
char *mydata;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
time_t when;
switch_media_flag_t flags = SMF_NONE;
@@ -611,7 +611,7 @@ SWITCH_STANDARD_APP(delay_function)
{
uint32_t len = 0;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
len = 1000;
} else {
len = atoi(data);
@@ -630,7 +630,7 @@ SWITCH_STANDARD_APP(hangup_function)
{
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
cause = switch_channel_str2cause(data);
}
@@ -640,7 +640,7 @@ SWITCH_STANDARD_APP(hangup_function)
SWITCH_STANDARD_APP(set_name_function)
{
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
switch_channel_set_name(switch_core_session_get_channel(session), (char *) data);
}
}
@@ -660,7 +660,7 @@ SWITCH_STANDARD_APP(presence_function)
char *mydata = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
return;
}
@@ -729,7 +729,7 @@ SWITCH_STANDARD_APP(set_function)
{
char *var, *val = NULL;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -740,7 +740,7 @@ SWITCH_STANDARD_APP(set_function)
if (val) {
*val++ = '\0';
if (switch_strlen_zero(val)) {
if (zstr(val)) {
val = NULL;
}
}
@@ -762,7 +762,7 @@ SWITCH_STANDARD_APP(set_global_function)
{
char *var, *val = NULL;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
var = strdup(data);
@@ -771,7 +771,7 @@ SWITCH_STANDARD_APP(set_global_function)
if (val) {
*val++ = '\0';
if (switch_strlen_zero(val)) {
if (zstr(val)) {
val = NULL;
}
}
@@ -786,7 +786,7 @@ SWITCH_STANDARD_APP(set_profile_var_function)
{
char *name, *val = NULL;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
name = switch_core_session_strdup(session, data);
@@ -794,7 +794,7 @@ SWITCH_STANDARD_APP(set_profile_var_function)
if (val) {
*val++ = '\0';
if (switch_strlen_zero(val)) {
if (zstr(val)) {
val = NULL;
}
}
@@ -810,7 +810,7 @@ SWITCH_STANDARD_APP(export_function)
char *new_exports = NULL, *new_exports_d = NULL, *var, *val = NULL, *var_name = NULL;
int local = 1;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
@@ -827,7 +827,7 @@ SWITCH_STANDARD_APP(export_function)
if (val) {
*val++ = '\0';
if (switch_strlen_zero(val)) {
if (zstr(val)) {
val = NULL;
}
}
@@ -853,7 +853,7 @@ SWITCH_STANDARD_APP(export_function)
SWITCH_STANDARD_APP(unset_function)
{
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UNSET [%s]\n", (char *) data);
@@ -889,7 +889,7 @@ SWITCH_STANDARD_APP(info_function)
char *buf;
int level = SWITCH_LOG_INFO;
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
level = switch_log_str2level(data);
}
@@ -916,7 +916,7 @@ SWITCH_STANDARD_APP(event_function)
char *lbuf;
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_APPLICATION) == SWITCH_STATUS_SUCCESS) {
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
int x = 0;
@@ -966,7 +966,7 @@ SWITCH_STANDARD_APP(privacy_function)
{
switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No privacy mode specified.\n");
} else {
switch_set_flag(caller_profile, SWITCH_CPF_SCREEN);
@@ -996,7 +996,7 @@ SWITCH_STANDARD_APP(strftime_function)
int argc;
char *lbuf;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) {
switch_size_t retsize;
switch_time_exp_t tm;
@@ -1013,7 +1013,7 @@ SWITCH_STANDARD_API(strepoch_api_function)
{
switch_time_t out;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
out = switch_micro_time_now();
} else {
out = switch_str_time(cmd);
@@ -1031,14 +1031,14 @@ SWITCH_STANDARD_API(strftime_api_function)
char date[80] = "";
switch_time_t thetime;
char *p;
if (!switch_strlen_zero(cmd) && (p = strchr(cmd, '|'))) {
if (!zstr(cmd) && (p = strchr(cmd, '|'))) {
thetime = switch_time_make(atoi(cmd), 0);
cmd = p + 1;
} else {
thetime = switch_micro_time_now();
}
switch_time_exp_lt(&tm, thetime);
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
} else {
switch_strftime(date, &retsize, sizeof(date), cmd, &tm);
@@ -1058,7 +1058,7 @@ SWITCH_STANDARD_API(presence_api_function)
switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
int need = 4;
if (!switch_strlen_zero(cmd) && (lbuf = strdup(cmd))
if (!zstr(cmd) && (lbuf = strdup(cmd))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) > 0) {
if (!strcasecmp(argv[0], "out")) {
@@ -1111,11 +1111,11 @@ SWITCH_STANDARD_API(chat_api_function)
char *lbuf = NULL, *argv[5];
int argc = 0;
if (!switch_strlen_zero(cmd) && (lbuf = strdup(cmd))
if (!zstr(cmd) && (lbuf = strdup(cmd))
&& (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) {
if (switch_core_chat_send(argv[0], "dp", argv[1], argv[2], "", argv[3],
!switch_strlen_zero(argv[4]) ? argv[4] : NULL , "") == SWITCH_STATUS_SUCCESS) {
!zstr(argv[4]) ? argv[4] : NULL , "") == SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "Sent");
} else {
stream->write_function(stream, "Error! Message Not Sent");
@@ -1206,7 +1206,7 @@ SWITCH_STANDARD_APP(dtmf_session_generate_function)
{
switch_bool_t do_read = SWITCH_TRUE;
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
if (!strcasecmp(data, "write")) {
do_read = SWITCH_FALSE;
}
@@ -1240,7 +1240,7 @@ SWITCH_STANDARD_APP(tone_detect_session_function)
time_t to = 0;
int hits = 1;
if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
return;
}
@@ -1362,7 +1362,7 @@ SWITCH_STANDARD_APP(sleep_function)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No timeout specified.\n");
} else {
uint32_t ms = atoi(data);
@@ -1397,7 +1397,7 @@ SWITCH_STANDARD_APP(speak_function)
char *mydata = NULL;
switch_input_args_t args = { 0 };
if (switch_strlen_zero(data) || !(mydata = switch_core_session_strdup(session, data))) {
if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Params!\n");
return;
}
@@ -1610,7 +1610,7 @@ SWITCH_STANDARD_APP(read_function)
const char *var_name = NULL;
const char *valid_terminators = NULL;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No arguments specified.\n");
@@ -1651,7 +1651,7 @@ SWITCH_STANDARD_APP(read_function)
timeout = 1000;
}
if (switch_strlen_zero(valid_terminators)) {
if (zstr(valid_terminators)) {
valid_terminators = "#";
}
@@ -1674,7 +1674,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function)
const char *valid_terminators = NULL;
const char *digits_regex = NULL;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No arguments specified.\n");
@@ -1727,7 +1727,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function)
timeout = 1000;
}
if (switch_strlen_zero(valid_terminators)) {
if (zstr(valid_terminators)) {
valid_terminators = "#";
}
@@ -1744,7 +1744,7 @@ SWITCH_STANDARD_APP(say_function)
switch_input_args_t args = { 0 };
switch_channel_t *channel = switch_core_session_get_channel(session);
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
args.input_callback = on_dtmf;
@@ -1766,7 +1766,7 @@ SWITCH_STANDARD_APP(phrase_function)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
const char *lang;
char *macro = mydata;
char *mdata = NULL;
@@ -1885,7 +1885,7 @@ SWITCH_STANDARD_APP(gentones_function)
int32_t loops = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
if (switch_strlen_zero(data) || !(tone_script = switch_core_session_strdup(session, data))) {
if (zstr(data) || !(tone_script = switch_core_session_strdup(session, data))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Params!\n");
return;
}
@@ -1915,13 +1915,13 @@ SWITCH_STANDARD_APP(displace_session_function)
char *lbuf = NULL;
char *flags = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
path = argv[0];
for (x = 1; x < argc; x++) {
if (strchr(argv[x], '+')) {
limit = atoi(argv[x]);
} else if (!switch_strlen_zero(argv[x])) {
} else if (!zstr(argv[x])) {
flags = argv[x];
}
}
@@ -1948,7 +1948,7 @@ SWITCH_STANDARD_APP(record_function)
const char *tmp;
int rate;
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No file specified.\n");
@@ -2013,7 +2013,7 @@ SWITCH_STANDARD_APP(record_session_function)
char *path_end;
uint32_t limit = 0;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
return;
}
@@ -2095,7 +2095,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
char *camp_data = NULL;
switch_status_t status;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
return;
}
@@ -2214,7 +2214,7 @@ SWITCH_STANDARD_APP(audio_bridge_function)
switch_channel_clear_flag(caller_channel, CF_NOT_READY);
}
if (do_xfer && !switch_strlen_zero(v_campon_fallback_exten)) {
if (do_xfer && !zstr(v_campon_fallback_exten)) {
switch_ivr_session_transfer(session,
v_campon_fallback_exten,
switch_channel_get_variable(caller_channel, "campon_fallback_dialplan"),
@@ -2468,7 +2468,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
char stupid[128] = "";
const char *skip = NULL, *var = NULL;
if (switch_strlen_zero(outbound_profile->destination_number)) {
if (zstr(outbound_profile->destination_number)) {
goto done;
}
@@ -2699,7 +2699,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function)
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 3) {
thresh = atoi(argv[0]);
silence_hits = atoi(argv[1]);
@@ -2776,7 +2776,7 @@ static switch_status_t api_chat_send(const char *proto, const char *from, const
if (proto) {
switch_core_chat_send(proto, "api", to, hint && strchr(hint, '/') ? hint : from,
!switch_strlen_zero(type) ? type : NULL, (char *) stream.data, NULL, NULL);
!zstr(type) ? type : NULL, (char *) stream.data, NULL, NULL);
}
switch_safe_free(stream.data);
@@ -125,13 +125,13 @@ static switch_status_t load_config(void)
}
done:
if (switch_strlen_zero(globals.db_username)) {
if (zstr(globals.db_username)) {
set_global_db_username("root");
}
if (switch_strlen_zero(globals.db_password)) {
if (zstr(globals.db_password)) {
set_global_db_password("password");
}
if (switch_strlen_zero(globals.db_dsn)) {
if (zstr(globals.db_dsn)) {
set_global_db_dsn("easyroute");
}
@@ -208,25 +208,25 @@ static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int
char tmp_profile[129];
char tmp_gateway[129];
if (switch_strlen_zero(pdata.limit)) {
if (zstr(pdata.limit)) {
switch_set_string(results->limit, "9999" );
} else {
switch_set_string(results->limit, pdata.limit );
}
if (switch_strlen_zero(pdata.techprofile)){
if (zstr(pdata.techprofile)){
switch_set_string(tmp_profile, globals.default_techprofile);
} else {
switch_set_string(tmp_profile, pdata.techprofile);
}
if (switch_strlen_zero(pdata.gateway)){
if (zstr(pdata.gateway)){
switch_set_string(tmp_gateway, globals.default_gateway);
} else {
switch_set_string(tmp_gateway, pdata.gateway);
}
if (switch_strlen_zero(pdata.translated)){
if (zstr(pdata.translated)){
switch_set_string(results->translated, dn);
} else {
switch_set_string(results->translated, pdata.translated);
@@ -240,13 +240,13 @@ static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "THE ROUTE [%s]\n", results->dialstring);
if (switch_strlen_zero(pdata.group)){
if (zstr(pdata.group)){
switch_set_string(results->group, "");
} else {
switch_set_string(results->group, pdata.group);
}
if (switch_strlen_zero(pdata.acctcode)){
if (zstr(pdata.acctcode)){
switch_set_string(results->acctcode, "");
} else {
switch_set_string(results->acctcode, pdata.acctcode);
+2 -2
View File
@@ -471,7 +471,7 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results
root = mroot;
}
if (switch_strlen_zero(root)) {
if (zstr(root)) {
root = globals.root;
}
@@ -675,7 +675,7 @@ SWITCH_STANDARD_API(enum_api)
char *last_delim = "|";
int ok = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%s", "none");
return SWITCH_STATUS_SUCCESS;
}
+5 -5
View File
@@ -83,7 +83,7 @@ SWITCH_STANDARD_APP(bcast_function)
switch_core_session_get_read_impl(session, &read_impl);
if (!switch_strlen_zero((char *) data)) {
if (!zstr((char *) data)) {
mydata = switch_core_session_strdup(session, data);
assert(mydata != NULL);
@@ -93,20 +93,20 @@ SWITCH_STANDARD_APP(bcast_function)
mcast_ip = switch_core_session_strdup(session, var);
}
if (!switch_strlen_zero(argv[0])) {
if (!zstr(argv[0])) {
mcast_ip = argv[0];
}
if (!switch_strlen_zero(argv[1])) {
if (!zstr(argv[1])) {
mcast_port_str = argv[1];
mcast_port = (switch_port_t) atoi(mcast_port_str);
}
if (!switch_strlen_zero(argv[2])) {
if (!zstr(argv[2])) {
mcast_control_port = (switch_port_t) atoi(argv[2]);
}
if (!switch_strlen_zero(argv[3])) {
if (!zstr(argv[3])) {
mcast_ttl = atoi(argv[3]);
if (mcast_ttl < 1 || mcast_ttl > 255) {
mcast_ttl = 1;
+1 -1
View File
@@ -54,7 +54,7 @@ SWITCH_STANDARD_API(expr_function)
size_t len;
int ec = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto error;
}
+4 -4
View File
@@ -133,7 +133,7 @@ static void spanfax_log_message(int level, const char *msg)
break;
}
if (!switch_strlen_zero(msg)) {
if (!zstr(msg)) {
switch_log_printf(SWITCH_CHANNEL_LOG, fs_log_level, "%s", msg);
}
}
@@ -511,7 +511,7 @@ void process_fax(switch_core_session_t *session, const char *data, application_m
}
}
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
pvt->filename = switch_core_session_strdup(session, data);
if (pvt->app_mode == FUNCTION_TX) {
if ((switch_file_exists(pvt->filename, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS)) {
@@ -706,11 +706,11 @@ void load_configuration(switch_bool_t reload)
const char *name = switch_xml_attr(x_list, "name");
const char *value = switch_xml_attr(x_list, "value");
if (switch_strlen_zero(name)) {
if (zstr(name)) {
continue;
}
if (switch_strlen_zero(value)) {
if (zstr(value)) {
continue;
}
+15 -15
View File
@@ -146,7 +146,7 @@ static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input,
return SWITCH_STATUS_SUCCESS;
}
#define check_string(s) if (!switch_strlen_zero(s) && !strcasecmp(s, "undef")) { s = NULL; }
#define check_string(s) if (!zstr(s) && !strcasecmp(s, "undef")) { s = NULL; }
static int node_consumer_wait_count(fifo_node_t *node)
{
@@ -297,7 +297,7 @@ static switch_status_t fifo_execute_sql(char *sql, switch_mutex_t *mutex)
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
if (!switch_strlen_zero(err_str)) {
if (!zstr(err_str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
}
switch_safe_free(err_str);
@@ -752,7 +752,7 @@ SWITCH_STANDARD_API(fifo_add_outbound_function)
int argc;
uint32_t priority = 0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto fail;
}
@@ -819,7 +819,7 @@ SWITCH_STANDARD_APP(fifo_function)
return;
}
if (switch_strlen_zero(data)) {
if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Args\n");
return;
}
@@ -1139,7 +1139,7 @@ SWITCH_STANDARD_APP(fifo_function)
fifo_strategy_t strat = STRAT_WAITING_LONGER;
char *url = NULL;
if (!switch_strlen_zero(strat_str)) {
if (!zstr(strat_str)) {
if (!strcasecmp(strat_str, "more_ppl")) {
strat = STRAT_MORE_PPL;
} else if (!strcasecmp(strat_str, "waiting_longer")) {
@@ -1489,7 +1489,7 @@ SWITCH_STANDARD_APP(fifo_function)
fifo_consumer_wrapup_sound = switch_channel_get_variable(channel, "fifo_consumer_wrapup_sound");
fifo_consumer_wrapup_key = switch_channel_get_variable(channel, "fifo_consumer_wrapup_key");
sfifo_consumer_wrapup_time = switch_channel_get_variable(channel, "fifo_consumer_wrapup_time");
if (!switch_strlen_zero(sfifo_consumer_wrapup_time)){
if (!zstr(sfifo_consumer_wrapup_time)){
fifo_consumer_wrapup_time = atoi(sfifo_consumer_wrapup_time);
} else {
fifo_consumer_wrapup_time = 5000;
@@ -1497,7 +1497,7 @@ SWITCH_STANDARD_APP(fifo_function)
memset(buf, 0, sizeof(buf));
if (fifo_consumer_wrapup_time || !switch_strlen_zero(fifo_consumer_wrapup_key)) {
if (fifo_consumer_wrapup_time || !zstr(fifo_consumer_wrapup_key)) {
switch_channel_set_variable(channel, "fifo_status", "WRAPUP");
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(channel, event);
@@ -1507,7 +1507,7 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
if (!switch_strlen_zero(fifo_consumer_wrapup_sound)) {
if (!zstr(fifo_consumer_wrapup_sound)) {
memset(&args, 0, sizeof(args));
args.buf = buf;
args.buflen = sizeof(buf);
@@ -1518,7 +1518,7 @@ SWITCH_STANDARD_APP(fifo_function)
wrapup_time_started = switch_micro_time_now();
}
if (!switch_strlen_zero(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
if (!zstr(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
while(switch_channel_ready(channel)) {
char terminator = 0;
@@ -1537,7 +1537,7 @@ SWITCH_STANDARD_APP(fifo_function)
}
}
} else if (fifo_consumer_wrapup_time && (switch_strlen_zero(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
} else if (fifo_consumer_wrapup_time && (zstr(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
while(switch_channel_ready(channel)) {
wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
@@ -1761,12 +1761,12 @@ SWITCH_STANDARD_API(fifo_api_function)
return SWITCH_STATUS_FALSE;
}
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
data = strdup(cmd);
switch_assert(data);
}
if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
if (zstr(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -1897,7 +1897,7 @@ static switch_status_t load_config(int reload, int del_all)
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available()) {
globals.odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
@@ -1915,7 +1915,7 @@ static switch_status_t load_config(int reload, int del_all)
}
}
if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
globals.dbname = "fifo";
}
@@ -2190,7 +2190,7 @@ SWITCH_STANDARD_API(fifo_member_api_function)
return SWITCH_STATUS_FALSE;
}
if (switch_strlen_zero(cmd)){
if (zstr(cmd)){
stream->write_function(stream, "-USAGE: %s\n", FIFO_MEMBER_API_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
+30 -30
View File
@@ -174,7 +174,7 @@ static const char *do_cid(switch_memory_pool_t *pool, const char *cid, const cha
char *dst_regex = NULL;
switch_channel_t *channel = NULL;
if (!switch_strlen_zero(cid)) {
if (!zstr(cid)) {
len = strlen(cid);
} else {
goto done;
@@ -275,12 +275,12 @@ static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, ch
}
}
codec = "";
if (!switch_strlen_zero(cur_route->codec)) {
if (!zstr(cur_route->codec)) {
codec = switch_core_sprintf(pool, ",absolute_codec_string=%s", cur_route->codec);
}
cid = "";
if (!switch_strlen_zero(cur_route->cid)) {
if (!zstr(cur_route->cid)) {
cid = switch_core_sprintf(pool, ",origination_caller_id_number=%s",
do_cid(pool, cur_route->cid, caller_id, session));
}
@@ -292,7 +292,7 @@ static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, ch
cur_route->carrier_name);
}
if (switch_strlen_zero(cur_route->user_rate_str)) {
if (zstr(cur_route->user_rate_str)) {
user_rate = "";
} else {
user_rate = switch_core_sprintf(pool, ",lcr_user_rate=%s", cur_route->user_rate_str);
@@ -312,7 +312,7 @@ static profile_t *locate_profile(const char *profile_name)
{
profile_t *profile = NULL;
if (switch_strlen_zero(profile_name)) {
if (zstr(profile_name)) {
profile = globals.default_profile;
} else if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
@@ -555,7 +555,7 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa
return SWITCH_STATUS_GENERR;
}
if (switch_strlen_zero(argv[LCR_GW_PREFIX_PLACE]) && switch_strlen_zero(argv[LCR_GW_SUFFIX_PLACE]) ) {
if (zstr(argv[LCR_GW_PREFIX_PLACE]) && zstr(argv[LCR_GW_SUFFIX_PLACE]) ) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
"There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n",
switch_str_nil(argv[LCR_CARRIER_PLACE]),
@@ -737,7 +737,7 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct)
switch_assert(cb_struct->lookup_number != NULL);
digits_copy = string_digitsonly(cb_struct->pool, digits);
if (switch_strlen_zero(digits_copy)) {
if (zstr(digits_copy)) {
return SWITCH_STATUS_GENERR;
}
@@ -862,7 +862,7 @@ static switch_status_t lcr_load_config()
char *val = NULL;
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "odbc_dsn is %s\n", val);
globals.odbc_dsn = switch_core_strdup(globals.pool, val);
if ((odbc_user = strchr(globals.odbc_dsn, ':'))) {
@@ -922,13 +922,13 @@ static switch_status_t lcr_load_config()
var = (char *) switch_xml_attr_soft(param, "name");
val = (char *) switch_xml_attr_soft(param, "value");
if (!strcasecmp(var, "order_by") && !switch_strlen_zero(val)) {
if (!strcasecmp(var, "order_by") && !zstr(val)) {
thisorder = &order_by;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "param val is %s\n", val);
if ((argc = switch_separate_string(val, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
for (x=0; x<argc; x++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "arg #%d/%d is %s\n", x, argc, argv[x]);
if (!switch_strlen_zero(argv[x])) {
if (!zstr(argv[x])) {
if (!strcasecmp(argv[x], "quality")) {
thisorder->write_function(thisorder, "%s quality DESC", comma);
} else if (!strcasecmp(argv[x], "reliability")) {
@@ -951,40 +951,40 @@ static switch_status_t lcr_load_config()
thisorder->write_function(thisorder, "%s %s", comma, val);
}
}
} else if (!strcasecmp(var, "id") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "id") && !zstr(val)) {
id_s = val;
} else if (!strcasecmp(var, "custom_sql") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "custom_sql") && !zstr(val)) {
custom_sql = val;
} else if (!strcasecmp(var, "reorder_by_rate") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "reorder_by_rate") && !zstr(val)) {
reorder_by_rate = val;
} else if (!strcasecmp(var, "info_in_headers") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "info_in_headers") && !zstr(val)) {
info_in_headers = val;
} else if (!strcasecmp(var, "quote_in_list") && !switch_strlen_zero(val)) {
} else if (!strcasecmp(var, "quote_in_list") && !zstr(val)) {
quote_in_list = val;
}
}
if (switch_strlen_zero(name)) {
if (zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No name specified.\n");
} else {
profile = switch_core_alloc(globals.pool, sizeof(*profile));
memset(profile, 0, sizeof(profile_t));
profile->name = switch_core_strdup(globals.pool, name);
if (!switch_strlen_zero((char *)order_by.data)) {
if (!zstr((char *)order_by.data)) {
profile->order_by = switch_core_strdup(globals.pool, (char *)order_by.data);
} else {
/* default to rate */
profile->order_by = ", ${lcr_rate_field}";
}
if (!switch_strlen_zero(id_s)) {
if (!zstr(id_s)) {
profile->id = (uint16_t)atoi(id_s);
}
/* SWITCH_STANDARD_STREAM doesn't use pools. but we only have to free sql_stream.data */
SWITCH_STANDARD_STREAM(sql_stream);
if (switch_strlen_zero(custom_sql)) {
if (zstr(custom_sql)) {
/* use default sql */
sql_stream.write_function(&sql_stream,
"SELECT l.digits, c.carrier_name, l.${lcr_rate_field}, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix "
@@ -1046,15 +1046,15 @@ static switch_status_t lcr_load_config()
}
profile->custom_sql = switch_core_strdup(globals.pool, (char *)custom_sql);
if (!switch_strlen_zero(reorder_by_rate)) {
if (!zstr(reorder_by_rate)) {
profile->reorder_by_rate = switch_true(reorder_by_rate);
}
if (!switch_strlen_zero(info_in_headers)) {
if (!zstr(info_in_headers)) {
profile->info_in_headers = switch_true(info_in_headers);
}
if (!switch_strlen_zero(quote_in_list)) {
if (!zstr(quote_in_list)) {
profile->quote_in_list = switch_true(quote_in_list);
}
@@ -1124,10 +1124,10 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt)
intralata = switch_channel_get_variable(channel, "intralata");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", intrastate);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intralata channel var is [%s]\n", intralata);
if (!switch_strlen_zero(intralata) && !strcasecmp((char *)intralata, "true")) {
if (!zstr(intralata) && !strcasecmp((char *)intralata, "true")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on intralata rates\n");
routes.intralata = SWITCH_FALSE;
} else if (!switch_strlen_zero(intrastate) && !strcasecmp((char *)intrastate, "true")) {
} else if (!zstr(intrastate) && !strcasecmp((char *)intrastate, "true")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
routes.intrastate = SWITCH_TRUE;
} else {
@@ -1214,8 +1214,8 @@ SWITCH_STANDARD_APP(lcr_app_function)
intra = switch_channel_get_variable(channel, "intrastate");
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n",
switch_strlen_zero(intra) ? "undef" : intra);
if (switch_strlen_zero(intra) || strcasecmp((char *)intra, "true")) {
zstr(intra) ? "undef" : intra);
if (zstr(intra) || strcasecmp((char *)intra, "true")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on interstate rates\n");
routes.intrastate = SWITCH_FALSE;
} else {
@@ -1308,7 +1308,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function)
switch_bool_t as_xml = SWITCH_FALSE;
int rowcount=0;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto usage;
}
@@ -1354,7 +1354,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function)
}
}
}
if (switch_strlen_zero(cb_struct.cid)) {
if (zstr(cb_struct.cid)) {
cb_struct.cid = "18005551212";
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING
, "Using default CID [%s]\n", cb_struct.cid
@@ -1480,7 +1480,7 @@ SWITCH_STANDARD_API(dialplan_lcr_admin_function)
void *val;
profile_t *profile;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto usage;
}
@@ -1497,7 +1497,7 @@ SWITCH_STANDARD_API(dialplan_lcr_admin_function)
profile = (profile_t *) val;
stream->write_function(stream, "Name:\t\t%s\n", profile->name);
if (switch_strlen_zero(profile->custom_sql)) {
if (zstr(profile->custom_sql)) {
stream->write_function(stream, " ID:\t\t%d\n", profile->id);
stream->write_function(stream, " order by:\t%s\n", profile->order_by);
} else {
+20 -20
View File
@@ -102,7 +102,7 @@ static switch_status_t limit_execute_sql(char *sql, switch_mutex_t *mutex)
if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
if (!switch_strlen_zero(err_str)) {
if (!zstr(err_str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
}
switch_safe_free(err_str);
@@ -199,7 +199,7 @@ static switch_status_t do_config()
}
if (switch_strlen_zero(globals.odbc_dsn) || switch_strlen_zero(odbc_user) || switch_strlen_zero(odbc_pass)) {
if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
globals.dbname = "call_limit";
}
@@ -447,7 +447,7 @@ SWITCH_STANDARD_API(db_api_function)
switch_mutex_lock(globals.mutex);
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -518,7 +518,7 @@ SWITCH_STANDARD_APP(db_function)
char *mydata = NULL;
char *sql = NULL;
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -567,7 +567,7 @@ SWITCH_STANDARD_APP(hash_function)
switch_mutex_lock(globals.db_hash_mutex);
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = strdup(data);
switch_assert(mydata);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -621,7 +621,7 @@ SWITCH_STANDARD_API(hash_api_function)
switch_mutex_lock(globals.db_hash_mutex);
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -683,7 +683,7 @@ SWITCH_STANDARD_API(group_api_function)
switch_mutex_lock(globals.mutex);
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -766,7 +766,7 @@ SWITCH_STANDARD_APP(group_function)
char *mydata = NULL;
char *sql;
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -865,7 +865,7 @@ SWITCH_STANDARD_APP(limit_function)
int max = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -931,7 +931,7 @@ SWITCH_STANDARD_APP(limit_execute_function)
int max = -1;
/* Parse application data */
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -958,7 +958,7 @@ SWITCH_STANDARD_APP(limit_execute_function)
app = argv[3];
app_arg = argv[4];
if (switch_strlen_zero(app)) {
if (zstr(app)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
return;
}
@@ -982,7 +982,7 @@ SWITCH_STANDARD_API(limit_usage_function)
callback_t cbt = { 0 };
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -1158,7 +1158,7 @@ SWITCH_STANDARD_APP(limit_hash_function)
switch_channel_t *channel = switch_core_session_get_channel(session);
/* Parse application data */
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1223,7 +1223,7 @@ SWITCH_STANDARD_APP(limit_hash_execute_function)
int interval = 0;
/* Parse application data */
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1258,7 +1258,7 @@ SWITCH_STANDARD_APP(limit_hash_execute_function)
app = argv[3];
app_arg = argv[4];
if (switch_strlen_zero(app)) {
if (zstr(app)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
return;
}
@@ -1282,7 +1282,7 @@ SWITCH_STANDARD_API(limit_hash_usage_function)
switch_mutex_lock(globals.limit_hash_mutex);
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -1495,7 +1495,7 @@ SWITCH_STANDARD_APP(limit_memcache_function)
switch_channel_t *channel = switch_core_session_get_channel(session);
/* Parse application data */
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1556,7 +1556,7 @@ SWITCH_STANDARD_APP(limit_memcache_execute_function)
char *szinterval = NULL;
/* Parse application data */
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -1588,7 +1588,7 @@ SWITCH_STANDARD_APP(limit_memcache_execute_function)
app = argv[3];
app_arg = argv[4];
if (switch_strlen_zero(app)) {
if (zstr(app)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
return;
}
@@ -1619,7 +1619,7 @@ SWITCH_STANDARD_API(limit_memcache_usage_function)
goto end;
}
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -160,7 +160,7 @@ SWITCH_STANDARD_API(memcache_function)
memcached_stat_st *stat = NULL;
memcached_server_st *server_list;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
goto usage;
}
@@ -189,22 +189,22 @@ static switch_status_t load_config(void)
/* Set defaults for any variables still not set */
setdefaults:
if (switch_strlen_zero(globals.db_username)) {
if (zstr(globals.db_username)) {
set_global_db_username("bandwidth.com");
}
if (switch_strlen_zero(globals.db_password)) {
if (zstr(globals.db_password)) {
set_global_db_password("dev");
}
if (switch_strlen_zero(globals.db_dsn)) {
if (zstr(globals.db_dsn)) {
set_global_db_dsn("bandwidth.com");
}
if (switch_strlen_zero(globals.percall_action)) {
if (zstr(globals.percall_action)) {
set_global_percall_action("hangup");
}
if (switch_strlen_zero(globals.lowbal_action)) {
if (zstr(globals.lowbal_action)) {
set_global_lowbal_action("play ding");
}
if (switch_strlen_zero(globals.nobal_action)) {
if (zstr(globals.nobal_action)) {
set_global_nobal_action("hangup");
}
@@ -722,7 +722,7 @@ SWITCH_STANDARD_APP(nibblebill_app_function)
char *lbuf = NULL;
char *argv[3] = { 0 };
if (!switch_strlen_zero(data) && (lbuf = strdup(data))
if (!zstr(data) && (lbuf = strdup(data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (!strcasecmp(argv[0], "adjust") && argc == 2) {
nibblebill_adjust(session, (float)atof(argv[1]));
@@ -751,9 +751,9 @@ SWITCH_STANDARD_API(nibblebill_api_function)
char *mycmd = NULL, *argv[3] = { 0 };
int argc = 0;
if (!switch_strlen_zero(cmd) && (mycmd = strdup(cmd))) {
if (!zstr(cmd) && (mycmd = strdup(cmd))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if ((argc == 2 || argc == 3) && !switch_strlen_zero(argv[0])) {
if ((argc == 2 || argc == 3) && !zstr(argv[0])) {
char *uuid = argv[0];
if ((psession = switch_core_session_locate(uuid))) {
switch_channel_t *channel;
+2 -2
View File
@@ -234,7 +234,7 @@ SWITCH_STANDARD_APP(rss_function)
switch_channel_answer(channel);
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
if ((mydata = switch_core_session_strdup(session, data))) {
argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]));
@@ -394,7 +394,7 @@ SWITCH_STANDARD_APP(rss_function)
err = switch_xml_error(xml);
if (!switch_strlen_zero(err)) {
if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Error [%s]\n", err);
goto finished;
}
@@ -255,7 +255,7 @@ SWITCH_STANDARD_APP(soundtouch_start_function)
int x;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_soundtouch_"))) {
if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_soundtouch_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
+1 -1
View File
@@ -188,7 +188,7 @@ SWITCH_STANDARD_APP(userspy_function)
char* argv[2] = {0};
char* params = NULL;
if (!switch_strlen_zero(data) && (params = switch_core_session_strdup(session,data))) {
if (!zstr(data) && (params = switch_core_session_strdup(session,data))) {
if ((argc = switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -206,7 +206,7 @@ SWITCH_STANDARD_APP(stress_start_function)
int x = 0;
if ((bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_stress_"))) {
if (!switch_strlen_zero(data) && !strcasecmp(data, "stop")) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
switch_channel_set_private(channel, "_stress_", NULL);
switch_core_media_bug_remove(session, &bug);
} else {
@@ -115,7 +115,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
char dtmf_buf[128] = "";
int is_auto = 0;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
char *lot_name = argv[0];
char *ext = argv[1];
@@ -311,7 +311,7 @@ SWITCH_STANDARD_API(valet_info_function)
name = (char *) var;
lot = (valet_lot_t *) val;
if (!switch_strlen_zero(cmd) && strcasecmp(cmd, name)) continue;
if (!zstr(cmd) && strcasecmp(cmd, name)) continue;
stream->write_function(stream, " <lot name=\"%s\">\n", name);
+1 -1
View File
@@ -624,7 +624,7 @@ SWITCH_STANDARD_API(vmd_api_main)
int i;
/* No command? Display usage */
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
@@ -669,7 +669,7 @@ static vm_profile_t * load_profile(const char *profile_name)
switch_thread_rwlock_create(&profile->rwlock, pool);
profile->name = switch_core_strdup(pool, profile_name);
if (!switch_strlen_zero(profile->odbc_dsn)) {
if (!zstr(profile->odbc_dsn)) {
if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
*(profile->odbc_user++) = '\0';
if ((profile->odbc_pass = strchr(profile->odbc_user, ':'))) {
@@ -1571,7 +1571,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
char *sql = switch_mprintf("update voicemail_msgs set flags='delete' where uuid='%s'", cbt->uuid);
vm_execute_sql(profile, sql, profile->mutex);
switch_safe_free(sql);
if (!strcmp(input, profile->email_key) && !switch_strlen_zero(cbt->email)) {
if (!strcmp(input, profile->email_key) && !zstr(cbt->email)) {
switch_event_t *event;
char *from;
char *headers, *header_string;
@@ -1631,13 +1631,13 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
switch_channel_set_variable(channel, "voicemail_message_len", duration_str);
switch_channel_set_variable(channel, "voicemail_email", cbt->email);
if (switch_strlen_zero(profile->email_headers)) {
if (zstr(profile->email_headers)) {
from = switch_core_session_sprintf(session, "%s@%s", cbt->user, cbt->domain);
} else {
from = switch_channel_expand_variables(channel, profile->email_from);
}
if (switch_strlen_zero(profile->email_headers)) {
if (zstr(profile->email_headers)) {
headers = switch_core_session_sprintf(session,
"From: FreeSWITCH mod_voicemail <%s@%s>\nSubject: Voicemail from %s %s\nX-Priority: %d",
cbt->user, cbt->domain, cbt->cid_name, cbt->cid_number, priority);
@@ -1818,7 +1818,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
switch_snprintf(msg_count, sizeof(msg_count), "%d:urgent-new", total_new_urgent_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, &folder_args));
informed++;
if (!switch_strlen_zero_buf(global_buf)) {
if (!zstr_buf(global_buf)) {
vm_check_state = VM_CHECK_MENU;
continue;
}
@@ -1827,7 +1827,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
switch_snprintf(msg_count, sizeof(msg_count), "%d:new", total_new_messages);
TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, &folder_args));
informed++;
if (!switch_strlen_zero_buf(global_buf)) {
if (!zstr_buf(global_buf)) {
vm_check_state = VM_CHECK_MENU;
continue;
}
@@ -2047,7 +2047,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
char input[10] = "";
char key_buf[80] = "";
play_msg_type = MSG_NONE;
if (!switch_strlen_zero_buf(global_buf)) {
if (!zstr_buf(global_buf)) {
switch_set_string(input, global_buf);
*global_buf = '\0';
status = SWITCH_STATUS_SUCCESS;
@@ -2157,8 +2157,8 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
} else if (!auth && !thepass && !strcasecmp(var, "password")) {
thepass = switch_core_session_strdup(session, val);
} else if (!auth && !strcasecmp(var, "vm-password")) {
if (!switch_strlen_zero(val) && !strcasecmp(val, "user-choose")) {
if (switch_strlen_zero(cbt.password)) {
if (!zstr(val) && !strcasecmp(val, "user-choose")) {
if (zstr(cbt.password)) {
auth = 1;
} else {
thepass = switch_core_session_strdup(session, val);
@@ -2202,12 +2202,12 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
thehash = vmhash;
}
if (!auth && !thepass && !switch_strlen_zero(cbt.password)) {
if (!auth && !thepass && !zstr(cbt.password)) {
thepass = cbt.password;
}
if (!auth) {
if (!switch_strlen_zero(cbt.password) && !strcmp(cbt.password, mypass)) {
if (!zstr(cbt.password) && !strcmp(cbt.password, mypass)) {
auth++;
} else if (!thepass) {
auth++;
@@ -2234,9 +2234,9 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
if (auth) {
if (!dir_path) {
if (!switch_strlen_zero(vm_storage_dir)) {
if (!zstr(vm_storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, myid);
} else if ( !switch_strlen_zero(profile->storage_dir) ) {
} else if ( !zstr(profile->storage_dir) ) {
dir_path = switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
} else {
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
@@ -2389,9 +2389,9 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deliver VM to %s@%s\n", myid, domain_name);
if (!switch_strlen_zero(vm_storage_dir)) {
if (!zstr(vm_storage_dir)) {
dir_path = switch_mprintf("%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, myid);
} else if (!switch_strlen_zero(profile->storage_dir)) {
} else if (!zstr(profile->storage_dir)) {
dir_path = switch_mprintf("%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
} else {
dir_path = switch_mprintf("%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
@@ -2450,7 +2450,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
update_mwi(profile, myid, domain_name, myfolder);
}
if (send_mail && !switch_strlen_zero(vm_email) && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
if (send_mail && !zstr(vm_email) && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
switch_event_t *event;
char *from;
char *body;
@@ -2472,7 +2472,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages,
&total_new_urgent_messages, &total_saved_urgent_messages);
if (switch_strlen_zero(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) {
if (zstr(vm_timezone) || (switch_strftime_tz(vm_timezone, profile->date_fmt, date, sizeof(date), 0) != SWITCH_STATUS_SUCCESS)) {
switch_time_exp_lt(&tm, switch_micro_time_now());
switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
}
@@ -2510,7 +2510,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_message_len", duration_str);
if (switch_strlen_zero(profile->email_from)) {
if (zstr(profile->email_from)) {
from = switch_core_sprintf(pool, "%s@%s", myid, domain_name);
} else {
from = switch_event_expand_headers(params, profile->email_from);
@@ -2518,7 +2518,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
if (send_main) {
if (switch_strlen_zero(profile->email_headers)) {
if (zstr(profile->email_headers)) {
headers = switch_mprintf(
"From: FreeSWITCH mod_voicemail <%s@%s>\n"
"Subject: Voicemail from %s %s\nX-Priority: %d",
@@ -2570,7 +2570,7 @@ static switch_status_t deliver_vm(vm_profile_t *profile,
if (send_notify) {
if (switch_strlen_zero(profile->notify_email_headers)) {
if (zstr(profile->notify_email_headers)) {
headers = switch_mprintf(
"From: FreeSWITCH mod_voicemail <%s@%s>\n"
"Subject: Voicemail from %s %s\nX-Priority: %d",
@@ -2648,7 +2648,7 @@ static switch_status_t voicemail_inject(const char *data)
char *box, *path, *cid_num, *cid_name;
switch_memory_pool_t *pool = NULL;
if (switch_strlen_zero(data)) {
if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto end;
}
@@ -2906,17 +2906,17 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
}
}
if (send_main && switch_strlen_zero(vm_email) && !switch_strlen_zero(email_addr)) {
if (send_main && zstr(vm_email) && !zstr(email_addr)) {
vm_email = switch_core_session_strdup(session, email_addr);
if (switch_strlen_zero(vm_email)) {
if (zstr(vm_email)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No email address, not going to send email.\n");
send_main = 0;
}
}
if (send_notify && switch_strlen_zero(vm_notify_email)) {
if (send_notify && zstr(vm_notify_email)) {
vm_notify_email = vm_email;
if (switch_strlen_zero(vm_notify_email)) {
if (zstr(vm_notify_email)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No notify email address, not going to notify.\n");
send_notify = 0;
}
@@ -2944,9 +2944,9 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
}
}
if (!switch_strlen_zero(vm_storage_dir)) {
if (!zstr(vm_storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, id);
} else if (!switch_strlen_zero(profile->storage_dir)) {
} else if (!zstr(profile->storage_dir)) {
dir_path = switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, id);
} else {
dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
@@ -2987,11 +2987,11 @@ greet:
switch_ivr_sleep(session, 100, SWITCH_TRUE, NULL);
if (!switch_strlen_zero(greet_path)) {
if (!zstr(greet_path)) {
memset(buf, 0, sizeof(buf));
TRY_CODE(switch_ivr_play_file(session, NULL, greet_path, &args));
} else {
if (!switch_strlen_zero(cbt.name_path)) {
if (!zstr(cbt.name_path)) {
memset(buf, 0, sizeof(buf));
TRY_CODE(switch_ivr_play_file(session, NULL, cbt.name_path, &args));
}
@@ -3010,12 +3010,12 @@ greet:
greet_key_press:
if (switch_stristr(buf, profile->login_keys)) {
voicemail_check_main(session, profile, domain_name, id, 0);
} else if (!strcasecmp(buf, profile->operator_key) && !switch_strlen_zero(profile->operator_key)) {
} else if (!strcasecmp(buf, profile->operator_key) && !zstr(profile->operator_key)) {
int argc;
char *argv[4];
char *mycmd;
if (!switch_strlen_zero(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext))) {
if (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc >= 1 && argc <= 4) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
@@ -3024,12 +3024,12 @@ greet_key_press:
goto end;
}
}
} else if (!strcasecmp(buf, profile->vmain_key) && !switch_strlen_zero(profile->vmain_key)) {
} else if (!strcasecmp(buf, profile->vmain_key) && !zstr(profile->vmain_key)) {
int argc;
char *argv[4];
char *mycmd;
if (!switch_strlen_zero(profile->vmain_ext) && (mycmd = switch_core_session_strdup(session, profile->vmain_ext))) {
if (!zstr(profile->vmain_ext) && (mycmd = switch_core_session_strdup(session, profile->vmain_ext))) {
argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
if (argc >= 1 && argc <= 4) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
@@ -3177,7 +3177,7 @@ SWITCH_STANDARD_APP(voicemail_function)
int x = 0, check = 0, auth = 0;
switch_channel_t *channel = switch_core_session_get_channel(session);
if (!switch_strlen_zero(data)) {
if (!zstr(data)) {
mydata = switch_core_session_strdup(session, data);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
}
@@ -3210,19 +3210,19 @@ SWITCH_STANDARD_APP(voicemail_function)
auth = 1;
}
if (switch_strlen_zero(profile_name)) {
if (zstr(profile_name)) {
profile_name = switch_channel_get_variable(channel, "voicemail_profile_name");
}
if (switch_strlen_zero(domain_name)) {
if (zstr(domain_name)) {
domain_name = switch_channel_get_variable(channel, "voicemail_domain_name");
}
if (switch_strlen_zero(id)) {
if (zstr(id)) {
id = switch_channel_get_variable(channel, "voicemail_id");
}
if (switch_strlen_zero(profile_name) || switch_strlen_zero(domain_name)) {
if (zstr(profile_name) || zstr(domain_name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error Usage: %s\n", VM_USAGE);
return;
}
@@ -3254,7 +3254,7 @@ SWITCH_STANDARD_API(boxcount_api_function)
vm_profile_t *profile;
char *id, *domain, *p, *profilename = NULL;
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%d", 0);
return SWITCH_STATUS_SUCCESS;
}
@@ -3271,7 +3271,7 @@ SWITCH_STANDARD_API(boxcount_api_function)
id += 4;
}
if (switch_strlen_zero(id)) {
if (zstr(id)) {
stream->write_function(stream, "%d", 0);
goto done;
}
@@ -3283,7 +3283,7 @@ SWITCH_STANDARD_API(boxcount_api_function)
how = p;
}
if (!switch_strlen_zero(profilename)) {
if (!zstr(profilename)) {
if ((profile = get_profile(profilename))) {
message_count(profile, id, domain, "inbox", &total_new_messages, &total_saved_messages,
&total_new_urgent_messages, &total_saved_urgent_messages);
@@ -3334,7 +3334,7 @@ SWITCH_STANDARD_API(prefs_api_function)
char sql[256];
prefs_callback_t cbt = {{0}};
if (switch_strlen_zero(cmd)) {
if (zstr(cmd)) {
stream->write_function(stream, "%d", 0);
goto done;
}
@@ -3351,7 +3351,7 @@ SWITCH_STANDARD_API(prefs_api_function)
id += 4;
}
if (switch_strlen_zero(id)) {
if (zstr(id)) {
stream->write_function(stream, "%d", 0);
goto done;
}
@@ -3363,7 +3363,7 @@ SWITCH_STANDARD_API(prefs_api_function)
how = p;
}
if (!switch_strlen_zero(profilename) && !(profile = get_profile(profilename))) {
if (!zstr(profilename) && !(profile = get_profile(profilename))) {
stream->write_function(stream, "-ERR No such profile\n");
goto done;
}
@@ -3958,7 +3958,7 @@ SWITCH_STANDARD_API(voicemail_api_function)
path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
if (!switch_strlen_zero(cmd)) {
if (!zstr(cmd)) {
mydata = strdup(cmd);
switch_assert(mydata);
argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));