\param s the string to test
\return true value if the string is NULL or zero length
*/
-#define switch_strlen_zero(s) (!s || *(s) == '\0')
-#define switch_strlen_zero_buf(s) (*(s) == '\0')
+#define zstr(s) (!s || *(s) == '\0')
+#define zstr_buf(s) (*(s) == '\0')
static inline switch_bool_t switch_is_moh(const char *s)
{
- if (switch_strlen_zero(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
+ if (zstr(s) || !strcasecmp(s, "silence") || !strcasecmp(s, "indicate_hold")) {
return SWITCH_FALSE;
}
return SWITCH_TRUE;
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);
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);
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);
}
{
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) {
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;
}
char *fp = NULL;
const char *call_delim = ",";
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto end;
}
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 };
const char *rval = "false";
char *group;
- if (switch_strlen_zero(cmd) || !(mydata = strdup(cmd))) {
+ if (zstr(cmd) || !(mydata = strdup(cmd))) {
goto end;
}
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;
}
{
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));
char *reply = "";
char *data = NULL;
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
data = strdup(cmd);
switch_url_decode(data);
reply = data;
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;
}
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) {
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;
}
}
}
- if (switch_strlen_zero(mycmd)) {
+ if (zstr(mycmd)) {
stream->write_function(stream, "-ERR, no input\n");
return SWITCH_STATUS_SUCCESS;
}
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;
}
}
}
- if (switch_strlen_zero(input)) {
+ if (zstr(input)) {
stream->write_function(stream, "%s", "");
return SWITCH_STATUS_SUCCESS;
}
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 {
{
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);
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);
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;
}
{
const char *err;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", LOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
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;
}
}
end:
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
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;
}
}
end:
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
return SWITCH_STATUS_SUCCESS;
}
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;
}
*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);
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;
}
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;
}
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;
}
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))) {
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))) {
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];
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];
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")) {
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;
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;
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")) {
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 };
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;
int argc = 0;
uint32_t limit = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
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;
}
uint32_t limit = 0;
char *flags = NULL;
- if (switch_strlen_zero(cmd) || !(mycmd = strdup(cmd))) {
+ if (zstr(cmd) || !(mycmd = strdup(cmd))) {
goto usage;
}
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;
}
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;
}
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];
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;
}
/* 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 = ",";
}
{
char showcmd[1024];
int all = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
sprintf(showcmd, "help");
all = 1;
} else {
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;
}
{
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");
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;
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 {
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;
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 {
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;
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 {
char *uuid = NULL, *dtmf_data = NULL;
int argc = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
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;
}
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];
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);
#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)));
#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;
}
#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;
}
const char *tz_name = NULL;
char date[80] = "";
- if (!switch_strlen_zero(cmd)) {
+ if (!zstr(cmd)) {
format = strchr(cmd, ' ');
tz_name = cmd;
if (format) {
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) {
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));
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);
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);
}
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;
goto done;
}
file = dfile;
- } else if (!switch_strlen_zero(file)) {
+ } else if (!zstr(file)) {
status = conference_member_say(member, file, leadin);
goto done;
}
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);
switch_assert(conference != NULL);
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_GENERR;
}
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];
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];
return SWITCH_STATUS_GENERR;
}
- if (switch_strlen_zero(dtmf)) {
+ if (zstr(dtmf)) {
stream->write_function(stream, "Invalid input!\n");
return SWITCH_STATUS_GENERR;
}
{
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;
}
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;
}
id = atoi(workspace);
- if (!id || switch_strlen_zero(text)) {
+ if (!id || zstr(text)) {
stream->write_function(stream, "(saymember) No Text!\n");
goto done;
}
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]);
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++;
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;
}
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));
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Invalid arguments\n");
return;
}
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"));
}
/* 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;
}
/* 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;
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));
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, */
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;
}
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;
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) {
} 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) {
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;
}
}
/* 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";
}
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);
}
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 */
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;
}
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);
*data = '\0';
}
- if switch_strlen_zero(header->data) {
+ if zstr(header->data) {
header = header->next;
continue;
}
switch_memory_pool_t *pool = NULL;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
}
} else {
fullName = caller_name;
}
- if (switch_strlen_zero(fullName)) {
+ if (zstr(fullName)) {
continue;
}
firstName = switch_core_session_strdup(session, fullName);
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);
}
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;
}
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;
}
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;
}
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);
}
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;
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]);
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 {
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 {
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;
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]) {
#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);
#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);
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);
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");
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;
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;
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;
{
uint32_t len = 0;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
len = 1000;
} else {
len = atoi(data);
{
switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
cause = switch_channel_str2cause(data);
}
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);
}
}
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;
}
{
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);
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
{
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);
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
{
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);
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
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);
if (val) {
*val++ = '\0';
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
val = NULL;
}
}
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);
char *buf;
int level = SWITCH_LOG_INFO;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
level = switch_log_str2level(data);
}
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;
{
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);
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;
{
switch_time_t out;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
out = switch_micro_time_now();
} else {
out = switch_str_time(cmd);
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);
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")) {
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");
{
switch_bool_t do_read = SWITCH_TRUE;
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
if (!strcasecmp(data, "write")) {
do_read = SWITCH_FALSE;
}
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;
}
{
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);
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;
}
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");
timeout = 1000;
}
- if (switch_strlen_zero(valid_terminators)) {
+ if (zstr(valid_terminators)) {
valid_terminators = "#";
}
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");
timeout = 1000;
}
- if (switch_strlen_zero(valid_terminators)) {
+ if (zstr(valid_terminators)) {
valid_terminators = "#";
}
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;
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;
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;
}
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];
}
}
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");
char *path_end;
uint32_t limit = 0;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
return;
}
char *camp_data = NULL;
switch_status_t status;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
return;
}
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"),
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;
}
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]);
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);
}
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");
}
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);
}
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);
root = mroot;
}
- if (switch_strlen_zero(root)) {
+ if (zstr(root)) {
root = globals.root;
}
char *last_delim = "|";
int ok = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", "none");
return SWITCH_STATUS_SUCCESS;
}
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);
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;
size_t len;
int ec = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto error;
}
break;
}
- if (!switch_strlen_zero(msg)) {
+ if (!zstr(msg)) {
switch_log_printf(SWITCH_CHANNEL_LOG, fs_log_level, "%s", msg);
}
}
}
}
- 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)) {
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;
}
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)
{
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);
int argc;
uint32_t priority = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto fail;
}
return;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Args\n");
return;
}
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")) {
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;
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);
}
}
- 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);
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;
}
}
- } 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) {
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;
}
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, ':'))) {
}
}
- 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";
}
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;
}
char *dst_regex = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(cid)) {
+ if (!zstr(cid)) {
len = strlen(cid);
} else {
goto done;
}
}
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));
}
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);
{
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);
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]),
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;
}
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, ':'))) {
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")) {
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 "
}
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);
}
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 {
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 {
switch_bool_t as_xml = SWITCH_FALSE;
int rowcount=0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
}
}
}
- 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
void *val;
profile_t *profile;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
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 {
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);
}
- 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";
}
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])));
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])));
}
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])));
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])));
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])));
}
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])));
}
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])));
}
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])));
}
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;
}
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])));
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])));
}
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])));
}
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;
}
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])));
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])));
}
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])));
}
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;
}
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])));
memcached_stat_st *stat = NULL;
memcached_server_st *server_list;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
/* 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");
}
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]));
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;
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]));
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;
}
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 {
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);
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 {
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];
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);
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;
}
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, ':'))) {
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;
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);
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;
}
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;
}
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;
} 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);
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++;
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,
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,
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;
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);
}
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);
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",
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",
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;
}
}
}
- 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;
}
}
}
- 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,
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));
}
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]);
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]);
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])));
}
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;
}
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;
}
id += 4;
}
- if (switch_strlen_zero(id)) {
+ if (zstr(id)) {
stream->write_function(stream, "%d", 0);
goto done;
}
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);
char sql[256];
prefs_callback_t cbt = {{0}};
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%d", 0);
goto done;
}
id += 4;
}
- if (switch_strlen_zero(id)) {
+ if (zstr(id)) {
stream->write_function(stream, "%d", 0);
goto done;
}
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;
}
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])));
voice_name = NULL;
}
- if (switch_strlen_zero(voice_name)) {
+ if (zstr(voice_name)) {
/* Find the first voice on the system */
if ((cepstral->voice = swift_port_find_first_voice(cepstral->port, NULL, NULL)) == NULL) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find any voices!\n");
cepstral->tts_stream = NULL;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_FALSE;
}
if (!strncasecmp(text, fp, len)) {
text += len;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_FALSE;
}
swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL);
} else {
char *to_say;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
return SWITCH_STATUS_FALSE;
}
switch_mutex_lock(ps->flag_mutex);
if ((hyp = ps_get_hyp(ps->ps, &ps->score, &ps->uttid))) {
- if (!switch_strlen_zero(hyp)) {
+ if (!zstr(hyp)) {
ps_end_utt(ps->ps);
switch_clear_flag(ps, PSFLAG_READY);
if ((hyp = ps_get_hyp(ps->ps, &ps->score, &ps->uttid))) {
- if (switch_strlen_zero(hyp)) {
+ if (zstr(hyp)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Lost the text, never mind....\n");
ps_start_utt(ps->ps, NULL);
switch_set_flag(ps, PSFLAG_READY);
switch_xml_free(xml);
}
- if (switch_strlen_zero(globals.command)) {
+ if (zstr(globals.command)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No command set, please edit %s\n", cf);
}
{
int result = 0;
- if (!switch_strlen_zero(text)) {
+ if (!zstr(text)) {
size_t textlen, matchlen;
/* find first non-space character */
char *lname = "";
*audio_queue = NULL;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
lname = "";
} else {
lname = switch_core_strdup(pool, name);
{
if (queue) {
char *name = queue->name;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "";
}
if (queue->buffer) {
}
switch_core_hash_init(&schan->params, pool);
schan->data = NULL;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
schan->name = "";
} else {
schan->name = switch_core_strdup(pool, name);
switch_hash_this(hi, &key, NULL, &val);
param_name = (char *)key;
param_val = (char *)val;
- if (!switch_strlen_zero(param_name) && !switch_strlen_zero(param_val)) {
+ if (!zstr(param_name) && !zstr(param_val)) {
unimrcp_param_id_t *id = (unimrcp_param_id_t *)switch_core_hash_find(schannel->application->param_id_map, param_name);
if (id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s: %s\n", schannel->name, param_name, param_val);
static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *param, const char *val)
{
switch_mutex_lock(schannel->mutex);
- if (!switch_strlen_zero(param) && val != NULL) {
+ if (!zstr(param) && val != NULL) {
/* check if this is a FreeSWITCH param that needs to be translated to an MRCP param: e.g. voice ==> voice-name */
char *mrcp_param = (char *)switch_core_hash_find(schannel->application->fs_param_map, param);
char *lcparam = NULL;
- if (switch_strlen_zero(mrcp_param)) {
+ if (zstr(mrcp_param)) {
lcparam = switch_lc_strdup(param);
mrcp_param = lcparam;
}
sh->private_info = schannel;
/* try to open an MRCP channel */
- if (switch_strlen_zero(profile_name)) {
+ if (zstr(profile_name)) {
profile_name = globals.unimrcp_default_synth_profile;
}
profile = (profile_t *)switch_core_hash_find(globals.profiles, profile_name);
}
/* Set session TTS params */
- if (!switch_strlen_zero(voice_name)) {
+ if (!zstr(voice_name)) {
speech_channel_set_param(schannel, "Voice-Name", voice_name);
}
switch_status_t status = SWITCH_STATUS_SUCCESS;
speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
status = SWITCH_STATUS_FALSE;
} else {
status = synth_channel_speak(schannel, text);
/* input timers are started by default unless the start-input-timers=false param is set */
start_input_timers = (char *)switch_core_hash_find(schannel->params, "start-input-timers");
- r->timers_started = switch_strlen_zero(start_input_timers) || strcasecmp(start_input_timers, "false");
+ r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false");
/* get the cached grammar */
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
grammar = r->last_grammar;
} else {
grammar = (grammar_t *)switch_core_hash_find(r->grammars, name);
/* set Content-Type */
mime_type = grammar_type_to_mime(grammar->type, schannel->profile);
- if (switch_strlen_zero(mime_type)) {
+ if (zstr(mime_type)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
goto done;
}
mime_type = grammar_type_to_mime(type, schannel->profile);
- if (switch_strlen_zero(mime_type)) {
+ if (zstr(mime_type)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
- if (switch_strlen_zero(grammar_name)) {
+ if (zstr(grammar_name)) {
status = SWITCH_STATUS_FALSE;
} else {
recognizer_data_t *r = (recognizer_data_t *)schannel->data;
recognizer_data_t *r;
switch_mutex_lock(schannel->mutex);
r = (recognizer_data_t *)schannel->data;
- if (!switch_strlen_zero(r->result)) {
+ if (!zstr(r->result)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SUCCESS, have result\n", schannel->name);
} else if (r->start_of_input) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SUCCESS, start of input\n", schannel->name);
recognizer_data_t *r;
switch_mutex_lock(schannel->mutex);
r = (recognizer_data_t *)schannel->data;
- if (!switch_strlen_zero(r->result)) {
+ if (!zstr(r->result)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result is already set\n", schannel->name);
status = SWITCH_STATUS_FALSE;
goto done;
}
- if (switch_strlen_zero(result)) {
+ if (zstr(result)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result is NULL\n", schannel->name);
status = SWITCH_STATUS_FALSE;
goto done;
switch_status_t status = SWITCH_STATUS_SUCCESS;
recognizer_data_t *r = (recognizer_data_t *)schannel->data;
switch_mutex_lock(schannel->mutex);
- if (!switch_strlen_zero(r->result)) {
+ if (!zstr(r->result)) {
*result = strdup(r->result);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result);
r->result = NULL;
switch_hash_this(hi, &key, NULL, &val);
param_name = (char *)key;
param_val = (char *)val;
- if (!switch_strlen_zero(param_name) && !switch_strlen_zero(param_val)) {
+ if (!zstr(param_name) && !zstr(param_val)) {
unimrcp_param_id_t *id = (unimrcp_param_id_t *)switch_core_hash_find(schannel->application->param_id_map, param_name);
if (id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val);
char *filename = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar = %s, name = %s\n", schannel->name, grammar, name);
- if (switch_strlen_zero(grammar) || switch_strlen_zero(name)) {
+ if (zstr(grammar) || zstr(name)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
{
switch_status_t status = SWITCH_STATUS_SUCCESS;
speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
- if (switch_strlen_zero(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS ||
+ if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS ||
recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
}
}
/* set up MRCPv2 connection agent that will be shared with all profiles */
- if (!switch_strlen_zero(globals.unimrcp_max_connection_count)) {
+ if (!zstr(globals.unimrcp_max_connection_count)) {
max_connection_count = atoi(globals.unimrcp_max_connection_count);
}
if (max_connection_count <= 0) {
max_connection_count = 100;
}
- if (!switch_strlen_zero(globals.unimrcp_offer_new_connection)) {
+ if (!zstr(globals.unimrcp_offer_new_connection)) {
offer_new_connection = strcasecmp("true", globals.unimrcp_offer_new_connection);
}
connection_agent = mrcp_client_connection_agent_create(max_connection_count, offer_new_connection, pool);
/* get profile attributes */
const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name"));
const char *version = switch_xml_attr(profile, "version");
- if (switch_strlen_zero(name) || switch_strlen_zero(version)) {
+ if (zstr(name) || zstr(version)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "<profile> missing name or version attribute\n");
client = NULL;
goto done;
for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
const char *param_name = switch_xml_attr(param, "name");
const char *param_value = switch_xml_attr(param, "value");
- if (switch_strlen_zero(param_name)) {
+ if (zstr(param_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
client = NULL;
goto done;
for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) {
const char *param_name = switch_xml_attr(param, "name");
const char *param_value = switch_xml_attr(param, "value");
- if (switch_strlen_zero(param_name)) {
+ if (zstr(param_name)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n");
client = NULL;
goto done;
/* get MRCP module configuration */
mod_unimrcp_do_config();
- if (switch_strlen_zero(globals.unimrcp_default_synth_profile)) {
+ if (zstr(globals.unimrcp_default_synth_profile)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-tts-profile\n");
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(globals.unimrcp_default_recog_profile)) {
+ if (zstr(globals.unimrcp_default_recog_profile)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-asr-profile\n");
return SWITCH_STATUS_FALSE;
}
char log_message[4096] = { 0 }; /* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */
size_t msglen;
- if (switch_strlen_zero(format)) {
+ if (zstr(format)) {
return TRUE;
}
caller_profile = switch_channel_get_caller_profile(channel);
}
- if (!caller_profile || switch_strlen_zero(caller_profile->destination_number)) {
+ if (!caller_profile || zstr(caller_profile->destination_number)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Obtaining Profile!\n");
return NULL;
}
switch_regex_safe_free(re);
if (!extension) {
- if (switch_strlen_zero(field_data)) {
+ if (zstr(field_data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No extension!\n");
break;
}
} else {
profile = switch_core_get_variable("sip_profile");
}
- if (switch_strlen_zero(profile)) {
+ if (zstr(profile)) {
profile = "default";
}
const char *inline_ = switch_xml_attr_soft(xaction, "inline");
int xinline = switch_true(inline_);
- if (!switch_strlen_zero(xaction->txt)) {
+ if (!zstr(xaction->txt)) {
data = xaction->txt;
} else {
data = (char *) switch_xml_attr_soft(xaction, "data");
/* get our handle to the "dialplan" section of the config */
- if (!switch_strlen_zero(alt_path)) {
+ if (!zstr(alt_path)) {
switch_xml_t conf = NULL, tag = NULL;
if (!(alt_root = switch_xml_parse_file_simple(alt_path))) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of [%s] failed\n", alt_path);
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(tech_pvt->call_id)) {
+ if (zstr(tech_pvt->call_id)) {
snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
if (outbound_profile) {
char name[128];
- const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
+ const char *id = !zstr(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
snprintf(name, sizeof(name), "alsa/%s", id);
switch_channel_set_name(channel, name);
char *dtmf_str = argv[0];
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
- if (switch_strlen_zero(dtmf_str)) {
+ if (zstr(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
switch_mutex_lock(globals.pvt_lock);
uint8_t one_call = 0;
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
if (globals.call_list) {
if (globals.call_list->next) {
tech_pvt = globals.call_list->next;
char *callid = argv[0];
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
tech_pvt = globals.call_list;
} else {
tech_pvt = switch_core_hash_find(globals.call_hash, callid);
switch_mutex_lock(globals.pvt_lock);
- if (!switch_strlen_zero(callid)) {
+ if (!zstr(callid)) {
if ((tp = switch_core_hash_find(globals.call_hash, callid))) {
if (switch_test_flag(tp, TFLAG_ANSWER)) {
stream->write_function(stream, "CALL ALREADY ANSWERED\n");
return SWITCH_STATUS_MEMERR;
}
- if (!switch_strlen_zero(argv[1])) {
+ if (!zstr(argv[1])) {
dialplan = argv[1];
}
- if (!switch_strlen_zero(argv[2])) {
+ if (!zstr(argv[2])) {
cid_num = argv[2];
}
- if (!switch_strlen_zero(argv[3])) {
+ if (!zstr(argv[3])) {
cid_name = argv[3];
}
- if (!switch_strlen_zero(argv[4])) {
+ if (!zstr(argv[4])) {
tech_pvt->sample_rate = atoi(argv[4]);
}
- if (!switch_strlen_zero(argv[5])) {
+ if (!zstr(argv[5])) {
tech_pvt->codec_ms = atoi(argv[5]);
}
}
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto done;
}
} else {
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
char *status = argv[4];
//char *proto = argv[5];
- if (switch_strlen_zero(type)) {
+ if (zstr(type)) {
type = NULL;
} else if (!strcasecmp(type, "unavailable")) {
status = NULL;
status = NULL;
}
- if (switch_strlen_zero(event_type)) {
+ if (zstr(event_type)) {
event_type = "presence";
}
profile->password = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "avatar")) {
profile->avatar = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available()) {
profile->odbc_dsn = switch_core_strdup(module_pool, val);
if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
}
} else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) {
switch_set_flag(profile, TFLAG_TIMER);
- } else if (!strcasecmp(var, "dialplan") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "dialplan") && !zstr(val)) {
profile->dialplan = switch_core_strdup(module_pool, val);
#ifdef AUTO_REPLY // gotta fix looping on this
} else if (!strcasecmp(var, "auto-reply")) {
profile->auto_reply = switch_core_strdup(module_pool, val);
#endif
- } else if (!strcasecmp(var, "name") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "name") && !zstr(val)) {
profile->name = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "message") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "message") && !zstr(val)) {
profile->message = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "local-network-acl") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "local-network-acl") && !zstr(val)) {
profile->local_network = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "rtp-ip")) {
profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip);
ip = globals.guess_ip;
} else {
globals.auto_nat = 0;
- ip = switch_strlen_zero(val) ? globals.guess_ip : val;
+ ip = zstr(val) ? globals.guess_ip : val;
}
profile->extip = switch_core_strdup(module_pool, ip);
- } else if (!strcasecmp(var, "server") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "server") && !zstr(val)) {
profile->server = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "rtp-timer-name") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rtp-timer-name") && !zstr(val)) {
profile->timer_name = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "lanaddr") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "lanaddr") && !zstr(val)) {
profile->lanaddr = switch_core_strdup(module_pool, val);
} else if (!strcasecmp(var, "candidate-acl")) {
if (profile->acl_count < MAX_ACL) {
} else if (val && !strcasecmp(val, "md5")) {
profile->user_flags |= LDL_FLAG_SASL_MD5;
}
- } else if (!strcasecmp(var, "exten") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "exten") && !zstr(val)) {
profile->exten = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "context") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "context") && !zstr(val)) {
profile->context = switch_core_strdup(module_pool, val);
- } else if (!strcasecmp(var, "auto-login") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "auto-login") && !zstr(val)) {
if (switch_true(val)) {
switch_set_flag(profile, TFLAG_AUTO);
}
if (session) return status;
- if (switch_strlen_zero(cmd) || !(myarg = strdup(cmd))) {
+ if (zstr(cmd) || !(myarg = strdup(cmd))) {
stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
return SWITCH_STATUS_FALSE;
}
goto done;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
status = SWITCH_STATUS_SUCCESS;
goto done;
argc = switch_separate_string(myarg, ';', argv, (sizeof(argv) / sizeof(argv[0])));
- if (switch_strlen_zero(cmd) || argc != 1) {
+ if (zstr(cmd) || argc != 1) {
stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX);
status = SWITCH_STATUS_SUCCESS;
goto done;
*dialplan++ = '\0';
}
- if (!switch_strlen_zero(context)) {
+ if (!zstr(context)) {
caller_profile->context = switch_core_strdup(caller_profile->pool, context);
}
- if (!switch_strlen_zero(dialplan)) {
+ if (!zstr(dialplan)) {
caller_profile->dialplan = switch_core_strdup(caller_profile->pool, dialplan);
}
}
- if (switch_strlen_zero(caller_profile->context)) {
+ if (zstr(caller_profile->context)) {
caller_profile->context = switch_core_strdup(caller_profile->pool, "default");
}
- if (switch_strlen_zero(caller_profile->dialplan)) {
+ if (zstr(caller_profile->dialplan)) {
caller_profile->dialplan = switch_core_strdup(caller_profile->pool, "xml");
}
if (outbound_profile) {
char name[128];
- const char *id = !switch_strlen_zero(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
+ const char *id = !zstr(outbound_profile->caller_id_number) ? outbound_profile->caller_id_number : "na";
switch_snprintf(name, sizeof(name), "portaudio/%s", id);
switch_channel_set_name(channel, name);
int match = 0;
pdi = Pa_GetDeviceInfo(i);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
match = 1;
} else if (pdi && pdi->name && strstr(pdi->name, name)) {
match = 1;
char *dtmf_str = argv[0];
switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) };
- if (switch_strlen_zero(dtmf_str)) {
+ if (zstr(dtmf_str)) {
stream->write_function(stream, "No DTMF Supplied!\n");
} else {
switch_mutex_lock(globals.pvt_lock);
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
if (globals.call_list) {
if (globals.call_list->next) {
tech_pvt = globals.call_list->next;
char *callid = argv[0];
switch_mutex_lock(globals.pvt_lock);
- if (switch_strlen_zero(callid)) {
+ if (zstr(callid)) {
tech_pvt = globals.call_list;
} else {
tech_pvt = switch_core_hash_find(globals.call_hash, callid);
switch_mutex_lock(globals.pvt_lock);
- if (!switch_strlen_zero(callid)) {
+ if (!zstr(callid)) {
if ((tp = switch_core_hash_find(globals.call_hash, callid))) {
if (switch_test_flag(tp, TFLAG_ANSWER)) {
stream->write_function(stream, "CALL ALREADY ANSWERED\n");
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *dest = NULL;
- if (switch_strlen_zero(argv[0])) {
+ if (zstr(argv[0])) {
stream->write_function(stream, "FAIL:Usage: call <dest>\n");
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_MEMERR;
}
- if (!switch_strlen_zero(argv[1])) {
+ if (!zstr(argv[1])) {
dialplan = argv[1];
}
- if (!switch_strlen_zero(argv[2])) {
+ if (!zstr(argv[2])) {
cid_num = argv[2];
}
- if (!switch_strlen_zero(argv[3])) {
+ if (!zstr(argv[3])) {
cid_name = argv[3];
}
- if (!switch_strlen_zero(argv[4])) {
+ if (!zstr(argv[4])) {
tech_pvt->sample_rate = atoi(argv[4]);
}
- if (!switch_strlen_zero(argv[5])) {
+ if (!zstr(argv[5])) {
tech_pvt->codec_ms = atoi(argv[5]);
}
}
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto done;
}
} else {
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
switch_core_session_add_stream(*new_session, NULL);
- if (!switch_strlen_zero(outbound_profile->destination_number)) {
+ if (!zstr(outbound_profile->destination_number)) {
int i;
char *slash;
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
} else {
ERRORA("No session???\n", SKYPIAX_P_LOG);
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
} else {
ERRORA("No session???\n\n\n", SKYPIAX_P_LOG);
switch_core_session_t *session = NULL;
switch_channel_t *channel = NULL;
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
} else {
ERRORA("No session???\n", SKYPIAX_P_LOG);
else
stream->write_function(stream, "sk console is NOT yet assigned\n");
- 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])));
}
int argc = 0;
private_t *tech_pvt = NULL;
- 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])));
}
DEBUGA_SKYPE("received CHATMESSAGE on interface %s\n", SKYPIAX_P_LOG, tech_pvt->name);
- if (!switch_strlen_zero(tech_pvt->session_uuid_str)) {
+ if (!zstr(tech_pvt->session_uuid_str)) {
session = switch_core_session_locate(tech_pvt->session_uuid_str);
}
if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
int found = 0;
//char skype_msg[1024];
- 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 (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
const char *var;
- if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !switch_strlen_zero(var)) {
+ if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !zstr(var)) {
if (switch_true(var) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_32)) {
sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
sofia_glue_build_crypto(tech_pvt, 1, AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
}
- if (switch_strlen_zero((callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number")))) {
- if (switch_strlen_zero((callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number")))) {
+ if (zstr((callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number")))) {
+ if (zstr((callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number")))) {
callee_number = tech_pvt->caller_profile->destination_number;
}
}
- if (switch_strlen_zero(callee_name) && !switch_strlen_zero(callee_number)) {
+ if (zstr(callee_name) && !zstr(callee_number)) {
callee_name = callee_number;
}
- if (!switch_strlen_zero(callee_name) && !switch_strlen_zero(callee_number)) {
+ if (!zstr(callee_name) && !zstr(callee_number)) {
pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>\nX-FS-Display-Name: %s\nX-FS-Display-Number: %s\n",
callee_name, callee_number, callee_name, callee_number);
}
ps_cause = switch_channel_get_variable(channel, SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE);
}
- if (!switch_strlen_zero(ps_cause) && (!strncasecmp(ps_cause, "sip:", 4) || !strncasecmp(ps_cause, "sips:", 5))) {
+ if (!zstr(ps_cause) && (!strncasecmp(ps_cause, "sip:", 4) || !strncasecmp(ps_cause, "sips:", 5))) {
int new_cause = atoi(sofia_glue_strip_proto(ps_cause));
if (new_cause) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Overriding SIP cause %d with %d from the other leg\n",
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
nua_bye(tech_pvt->nh,
SIPTAG_REASON_STR(reason),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
- TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
}
} else {
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
nua_cancel(tech_pvt->nh,
SIPTAG_REASON_STR(reason),
- TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+ TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
}
} else {
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
SIPTAG_REASON_STR(reason),
- TAG_IF(!switch_strlen_zero(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
+ TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
TAG_END());
}
}
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
TAG_END());
SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
TAG_END());
switch_safe_free(extra_headers);
char *argv[2] = { 0 };
int argc;
- if (switch_strlen_zero(name) && !switch_strlen_zero(msg->string_arg)) {
+ if (zstr(name) && !zstr(msg->string_arg)) {
arg = strdup(msg->string_arg);
switch_assert(arg);
}
- if (!switch_strlen_zero(name)) {
+ if (!zstr(name)) {
char message[256] = "";
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
switch_event_t *event;
- if (switch_strlen_zero(number)) {
+ if (zstr(number)) {
number = tech_pvt->caller_profile->destination_number;
}
if (!sofia_test_flag(tech_pvt, TFLAG_UPDATING_DISPLAY)) {
- if (switch_strlen_zero(tech_pvt->last_sent_callee_id_name) || strcmp(tech_pvt->last_sent_callee_id_name, name) ||
- switch_strlen_zero(tech_pvt->last_sent_callee_id_number) || strcmp(tech_pvt->last_sent_callee_id_number, number)) {
+ if (zstr(tech_pvt->last_sent_callee_id_name) || strcmp(tech_pvt->last_sent_callee_id_name, name) ||
+ zstr(tech_pvt->last_sent_callee_id_number) || strcmp(tech_pvt->last_sent_callee_id_number, number)) {
if (switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote)) {
snprintf(message, sizeof(message), "X-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", name, number);
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/update_display"),
- TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_END());
} else if (ua && switch_stristr("snom", ua)) {
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SIPTAG_PAYLOAD_STR(message), TAG_END());
} else if ((ua && (switch_stristr("polycom", ua)))) {
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
nua_update(tech_pvt->nh,
- TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_END());
}
{
sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
sofia_glue_do_invite(session);
- if (!switch_strlen_zero(msg->string_arg)) {
+ if (!zstr(msg->string_arg)) {
char message[256] = "";
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
if (ua && switch_stristr("snom", ua)) {
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SIPTAG_PAYLOAD_STR(message), TAG_END());
} else if (ua && switch_stristr("polycom", ua)) {
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
nua_update(tech_pvt->nh,
- TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_END());
}
}
}
break;
case SWITCH_MESSAGE_INDICATE_REDIRECT:
- if (!switch_strlen_zero(msg->string_arg)) {
+ if (!zstr(msg->string_arg)) {
if (!switch_channel_test_flag(channel, CF_ANSWERED) && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
char *dest = (char *) msg->string_arg;
if (code) {
reason = msg->string_arg;
} else {
- if (!switch_strlen_zero(msg->string_arg)) {
+ if (!zstr(msg->string_arg)) {
if ((code = atoi(msg->string_arg))) {
if ((reason = strchr(msg->string_arg, ' '))) {
reason++;
}
}
- if (switch_strlen_zero(reason) && code != 407 && code != 302) {
+ if (zstr(reason) && code != 407 && code != 302) {
reason = sip_status_phrase(code);
- if (switch_strlen_zero(reason)) {
+ if (zstr(reason)) {
reason = "Because";
}
}
const char *to_uri = switch_channel_get_variable(channel, "sip_to_uri");
const char *to_host = reason;
- if (switch_strlen_zero(to_host)) {
+ if (zstr(to_host)) {
to_host = switch_channel_get_variable(channel, "sip_to_host");
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Challenging call %s\n", to_uri);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Overlap Dial with %d %s\n", code, reason);
nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), TAG_IF(to_uri, SIPTAG_CONTACT_STR(to_uri)),
SIPTAG_SUPPORTED_STR(NULL), SIPTAG_ACCEPT_STR(NULL),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
- TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
}
- } else if (code == 302 && !switch_strlen_zero(msg->string_arg)) {
+ } else if (code == 302 && !zstr(msg->string_arg)) {
char *p;
if ((p = strchr(msg->string_arg, ' '))) {
} else {
if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
- if (!switch_strlen_zero(((char *) msg->pointer_arg))) {
+ if (!zstr(((char *) msg->pointer_arg))) {
sofia_glue_tech_set_local_sdp(tech_pvt, (char *) msg->pointer_arg, SWITCH_TRUE);
if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_END());
} else {
nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
TAG_END());
}
}
nua_respond(tech_pvt->nh, SIP_180_RINGING,
SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
SIPTAG_HEADER_STR(generate_pai_str(session)),
- TAG_IF(!switch_strlen_zero(extra_header), SIPTAG_HEADER_STR(extra_header)),
+ TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
TAG_END());
switch_safe_free(extra_header);
SOATAG_ORDERED_USER(1),
SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
- TAG_IF(!switch_strlen_zero(extra_header), SIPTAG_HEADER_STR(extra_header)),
+ TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
TAG_END());
switch_safe_free(extra_header);
stream->write_function(stream, "Scheme \t%s\n", switch_str_nil(gp->register_scheme));
stream->write_function(stream, "Realm \t%s\n", switch_str_nil(gp->register_realm));
stream->write_function(stream, "Username\t%s\n", switch_str_nil(gp->register_username));
- stream->write_function(stream, "Password\t%s\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+ stream->write_function(stream, "Password\t%s\n", zstr(gp->register_password) ? "no" : "yes");
stream->write_function(stream, "From \t%s\n", switch_str_nil(gp->register_from));
stream->write_function(stream, "Contact \t%s\n", switch_str_nil(gp->register_contact));
stream->write_function(stream, "Exten \t%s\n", switch_str_nil(gp->extension));
stream->write_function(stream, "Dialplan \t%s\n", switch_str_nil(profile->dialplan));
stream->write_function(stream, "Context \t%s\n", switch_str_nil(profile->context));
stream->write_function(stream, "Challenge Realm \t%s\n",
- switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
+ zstr(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
stream->write_function(stream, "RTP-IP \t%s\n", switch_str_nil(profile->rtpip));
if (profile->extrtpip) {
stream->write_function(stream, "Ext-RTP-IP \t%s\n", profile->extrtpip);
stream->write_function(stream, "TLS-URL \t%s\n", switch_str_nil(profile->tls_url));
stream->write_function(stream, "TLS-BIND-URL \t%s\n", switch_str_nil(profile->tls_bindurl));
}
- stream->write_function(stream, "HOLD-MUSIC \t%s\n", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
- stream->write_function(stream, "OUTBOUND-PROXY \t%s\n", switch_strlen_zero(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+ stream->write_function(stream, "HOLD-MUSIC \t%s\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
+ stream->write_function(stream, "OUTBOUND-PROXY \t%s\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
stream->write_function(stream, "CODECS \t%s\n", switch_str_nil(profile->codec_string));
stream->write_function(stream, "TEL-EVENT \t%d\n", profile->te);
if (profile->dtmf_type == DTMF_2833) {
host = dup;
}
- if (switch_strlen_zero(user) ) {
+ if (zstr(user) ) {
sqlextra = switch_mprintf("(sip_host='%q')", host);
- } else if (switch_strlen_zero(host)) {
+ } else if (zstr(host)) {
sqlextra = switch_mprintf("(sip_user='%q')", user);
} else {
sqlextra = switch_mprintf("(sip_user='%q' and sip_host='%q')", user, host);
stream->write_function(stream, " <scheme>%s</scheme>\n", switch_str_nil(gp->register_scheme));
stream->write_function(stream, " <realm>%s</realm>\n", switch_str_nil(gp->register_realm));
stream->write_function(stream, " <username>%s</username>\n", switch_str_nil(gp->register_username));
- stream->write_function(stream, " <password>%s</password>\n", switch_strlen_zero(gp->register_password) ? "no" : "yes");
+ stream->write_function(stream, " <password>%s</password>\n", zstr(gp->register_password) ? "no" : "yes");
stream->write_function(stream, " <from>%s</from>\n", switch_amp_encode(switch_str_nil(gp->register_from),xmlbuf,buflen));
stream->write_function(stream, " <contact>%s</contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact),xmlbuf,buflen));
stream->write_function(stream, " <exten>%s</exten>\n", switch_amp_encode(switch_str_nil(gp->extension),xmlbuf,buflen));
stream->write_function(stream, " <dialplan>%s</dialplan>\n", switch_str_nil(profile->dialplan));
stream->write_function(stream, " <context>%s</context>\n", switch_str_nil(profile->context));
stream->write_function(stream, " <challenge-realm>%s</challenge-realm>\n",
- switch_strlen_zero(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
+ zstr(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
stream->write_function(stream, " <rtp-ip>%s</rtp-ip>\n", switch_str_nil(profile->rtpip));
stream->write_function(stream, " <ext-rtp-ip>%s</ext-rtp-ip>\n", profile->extrtpip);
stream->write_function(stream, " <sip-ip>%s</sip-ip>\n", switch_str_nil(profile->sipip));
stream->write_function(stream, " <bind-url>%s</bind-url>\n", switch_str_nil(profile->bindurl));
stream->write_function(stream, " <tls-url>%s</tls-url>\n", switch_str_nil(profile->tls_url));
stream->write_function(stream, " <tls-bind-url>%s</tls-bind-url>\n", switch_str_nil(profile->tls_bindurl));
- stream->write_function(stream, " <hold-music>%s</hold-music>\n", switch_strlen_zero(profile->hold_music) ? "N/A" : profile->hold_music);
- stream->write_function(stream, " <outbound-proxy>%s</outbound-proxy>\n", switch_strlen_zero(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+ stream->write_function(stream, " <hold-music>%s</hold-music>\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
+ stream->write_function(stream, " <outbound-proxy>%s</outbound-proxy>\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
stream->write_function(stream, " <codecs>%s</codecs>\n", switch_str_nil(profile->codec_string));
stream->write_function(stream, " <tel-event>%d</tel-event>\n", profile->te);
stream->write_function(stream, " <dtmf-mode>rfc2833</dtmf-mode>\n");
host = dup;
}
- if (switch_strlen_zero(user)) {
+ if (zstr(user)) {
sqlextra = switch_mprintf("(sip_host='%q')", host);
- } else if (switch_strlen_zero(host)) {
+ } else if (zstr(host)) {
sqlextra = switch_mprintf("(sip_user='%q')", user);
} else {
sqlextra = switch_mprintf("(sip_user='%q' and sip_host='%q')", user, host);
return SWITCH_STATUS_SUCCESS;
}
- if (switch_strlen_zero(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
+ if (zstr(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
stream->write_function(stream, "Invalid Profile [%s]", switch_str_nil(profile_name));
return SWITCH_STATUS_SUCCESS;
}
char *gname = argv[2];
sofia_gateway_t *gateway_ptr;
- if (switch_strlen_zero(gname)) {
+ if (zstr(gname)) {
stream->write_function(stream, "No gateway name provided!\n");
goto done;
}
char *gname = argv[2];
sofia_gateway_t *gateway_ptr;
- if (switch_strlen_zero(gname)) {
+ if (zstr(gname)) {
stream->write_function(stream, "No gateway name provided!\n");
goto done;
}
struct cb_helper *cb = (struct cb_helper *) pArg;
char *contact;
- if (!switch_strlen_zero(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1)) ) {
+ if (!zstr(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1)) ) {
cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], sofia_glue_strip_proto(contact));
free(contact);
}
sofia_glue_execute_sql_callback(profile, SWITCH_FALSE, profile->ireg_mutex, sql, contact_callback, &cb);
switch_safe_free(sql);
reply = (char *) mystream.data;
- if (!switch_strlen_zero(reply) && end_of(reply) == ',') {
+ if (!zstr(reply) && end_of(reply) == ',') {
end_of(reply) = '\0';
}
- if (switch_strlen_zero(reply)) {
+ if (zstr(reply)) {
reply = "error/user_not_registered";
}
char *gwname, *param, *varname;
const char *val = NULL;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR Parameter missing\n");
return SWITCH_STATUS_SUCCESS;
}
param = argv[1];
varname = argv[2];
- if (switch_strlen_zero(gwname) || switch_strlen_zero(param) || switch_strlen_zero(varname)) {
+ if (zstr(gwname) || zstr(param) || zstr(varname)) {
goto end;
}
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
gateway_ptr->ob_calls++;
- if (!switch_strlen_zero(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) {
+ if (!zstr(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) {
switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain);
}
- if (!switch_strlen_zero(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) {
+ if (!zstr(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) {
switch_channel_set_variable(nchannel, "sip_route_uri", gateway_ptr->outbound_sticky_proxy);
}
NUTAG_NEWSUB(1),
SIPTAG_EVENT_STR(es),
SIPTAG_CONTENT_TYPE_STR(ct),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
NUTAG_WITH_THIS(profile->nua),
SIPTAG_EVENT_STR(es),
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
sofia_glue_release_profile(profile);
NUTAG_NEWSUB(1),
SIPTAG_EVENT_STR(es),
SIPTAG_CONTENT_TYPE_STR(ct),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
}
switch_core_session_rwunlock(session);
nua_message(nh,
NUTAG_NEWSUB(1),
SIPTAG_CONTENT_TYPE_STR(ct),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
TAG_IF(alert_info, SIPTAG_ALERT_INFO_STR(alert_info)),
TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
- TAG_IF(!switch_strlen_zero(body), SIPTAG_PAYLOAD_STR(body)),
+ TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
TAG_END());
if (call_id && nh) {
#define check_decode(_var, _session) do { \
assert(_session); \
- if (!switch_strlen_zero(_var)) { \
+ if (!zstr(_var)) { \
int d = 0; \
char *p; \
if (strchr(_var, '%')) { \
switch_channel_hangup(channel, cause);
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
switch_safe_free(extra_headers);
#endif
- if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
+ if (sip->sip_user_agent && !zstr(sip->sip_user_agent->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
- } else if (sip->sip_server && !switch_strlen_zero(sip->sip_server->g_string)) {
+ } else if (sip->sip_server && !zstr(sip->sip_server->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
}
switch_caller_profile_t *caller_profile = switch_channel_get_caller_profile(channel);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = caller_profile->callee_id_name;
}
- if (switch_strlen_zero(number)) {
+ if (zstr(number)) {
number = caller_profile->callee_id_number;
}
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = number;
}
- if (switch_strlen_zero(number)) {
+ if (zstr(number)) {
number = caller_profile->destination_number;
}
if (passerted->paid_url && passerted->paid_url->url_user) {
number = passerted->paid_url->url_user;
}
- if (!switch_strlen_zero(passerted->paid_display)) {
+ if (!zstr(passerted->paid_display)) {
dup = strdup(passerted->paid_display);
if (*dup == '"') {
name = dup + 1;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile %s is locked\n", gateway->profile->name);
return;
}
- } else if (!switch_strlen_zero(sofia_private->uuid)) {
+ } else if (!zstr(sofia_private->uuid)) {
if ((session = switch_core_session_locate(sofia_private->uuid))) {
tech_pvt = switch_core_session_get_private(session);
channel = switch_core_session_get_channel(session);
if (status >= 180 && !*sofia_private->auth_gateway_name) {
const char *gwname = switch_channel_get_variable(channel, "sip_use_gateway");
- if (!switch_strlen_zero(gwname)) {
+ if (!zstr(gwname)) {
switch_set_string(sofia_private->auth_gateway_name, gwname);
}
}
char *name = (char *) switch_xml_attr_soft(gateway_tag, "name");
sofia_gateway_t *gateway;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "anonymous";
}
parse_gateway_subscriptions(profile, gateway, gw_subs_tag);
}
- if (switch_strlen_zero(realm)) {
- if (switch_strlen_zero(proxy)) {
+ if (zstr(realm)) {
+ if (zstr(proxy)) {
realm = name;
} else {
realm = proxy;
}
}
- if (switch_strlen_zero(username)) {
+ if (zstr(username)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: username param is REQUIRED!\n");
goto skip;
}
- if (switch_strlen_zero(password)) {
+ if (zstr(password)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERROR: password param is REQUIRED!\n");
goto skip;
}
- if (switch_strlen_zero(from_user)) {
+ if (zstr(from_user)) {
from_user = username;
}
- if (switch_strlen_zero(extension)) {
+ if (zstr(extension)) {
extension = username;
}
- if (switch_strlen_zero(proxy)) {
+ if (zstr(proxy)) {
proxy = realm;
}
gateway->status = SOFIA_GATEWAY_UP;
}
- if (switch_strlen_zero(auth_username)) {
+ if (zstr(auth_username)) {
auth_username = username;
}
- if (!switch_strlen_zero(register_proxy)) {
+ if (!zstr(register_proxy)) {
if (strncasecmp(register_proxy, "sip:", 4) && strncasecmp(register_proxy, "sips:", 5)) {
gateway->register_sticky_proxy = switch_core_sprintf(gateway->pool, "sip:%s", register_proxy);
} else {
}
}
- if (!switch_strlen_zero(outbound_proxy)) {
+ if (!zstr(outbound_proxy)) {
if (strncasecmp(outbound_proxy, "sip:", 4) && strncasecmp(outbound_proxy, "sips:", 5)) {
gateway->outbound_sticky_proxy = switch_core_sprintf(gateway->pool, "sip:%s", outbound_proxy);
} else {
params = switch_core_sprintf(gateway->pool, ";transport=%s;gw=%s", register_transport, gateway->name);
}
- if (!switch_strlen_zero(from_domain)) {
+ if (!zstr(from_domain)) {
gateway->from_domain = switch_core_strdup(gateway->pool, from_domain);
}
gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>",
- from_user, !switch_strlen_zero(from_domain) ? from_domain : proxy, register_transport);
+ from_user, !zstr(from_domain) ? from_domain : proxy, register_transport);
sipip = contact_host ? contact_host : profile->extsipip ? profile->extsipip : profile->sipip;
const char *parse = switch_xml_attr_soft(domain_tag, "parse");
const char *alias = switch_xml_attr_soft(domain_tag, "alias");
- if (!switch_strlen_zero(dname)) {
+ if (!zstr(dname)) {
if (!strcasecmp(dname, "all")) {
switch_xml_t xml_root, x_domains;
if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, xml_params, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
for (alias_tag = switch_xml_child(aliases_tag, "alias"); alias_tag; alias_tag = alias_tag->next) {
char *aname = (char *) switch_xml_attr_soft(alias_tag, "name");
- if (!switch_strlen_zero(aname)) {
+ if (!zstr(aname)) {
if (sofia_glue_add_profile(switch_core_strdup(profile->pool, aname), profile) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", aname, profile->name);
su_log_redirect(stun_log, logger, NULL);
}
- if (!switch_strlen_zero(profile_name) && (profile = sofia_glue_find_profile(profile_name))) {
+ if (!zstr(profile_name) && (profile = sofia_glue_find_profile(profile_name))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Profile [%s] Already exists.\n", switch_str_nil(profile_name));
status = SWITCH_STATUS_FALSE;
sofia_glue_release_profile(profile);
profile->debug = atoi(val);
} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
sofia_set_flag(profile, TFLAG_TPORT_LOG);
- } else if (!strcasecmp(var, "odbc-dsn") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
if (switch_odbc_available()) {
profile->odbc_dsn = switch_core_strdup(profile->pool, val);
if ((profile->odbc_user = strchr(profile->odbc_dsn, ':'))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val);
}
} else if (!strcasecmp(var, "ext-rtp-ip")) {
- if (!switch_strlen_zero(val)) {
+ if (!zstr(val)) {
char *ip = mod_sofia_globals.guess_ip;
if (!strcmp(val, "0.0.0.0")) {
}
profile->sipip = switch_core_strdup(profile->pool, ip);
} else if (!strcasecmp(var, "ext-sip-ip")) {
- if (!switch_strlen_zero(val)) {
+ if (!zstr(val)) {
char *ip = mod_sofia_globals.guess_ip;
char stun_ip[50] = "";
char *myip = stun_ip;
const char *parse = switch_xml_attr_soft(domain_tag, "parse");
const char *alias = switch_xml_attr_soft(domain_tag, "alias");
- if (!switch_strlen_zero(dname)) {
+ if (!zstr(dname)) {
if (!strcasecmp(dname, "all")) {
switch_xml_t xml_root, x_domains;
if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, xml_params, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
if ((aliases_tag = switch_xml_child(xprofile, "aliases"))) {
for (alias_tag = switch_xml_child(aliases_tag, "alias"); alias_tag; alias_tag = alias_tag->next) {
char *aname = (char *) switch_xml_attr_soft(alias_tag, "name");
- if (!switch_strlen_zero(aname)) {
+ if (!zstr(aname)) {
if (sofia_glue_add_profile(switch_core_strdup(profile->pool, aname), profile) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", aname, profile->name);
{
sofia_gateway_t *gateway = NULL;
- if (sofia_private && !switch_strlen_zero(sofia_private->gateway_name)) {
+ if (sofia_private && !zstr(sofia_private->gateway_name)) {
gateway = sofia_reg_find_gateway(sofia_private->gateway_name);
sofia_private->destroy_me = 1;
}
sdp_parser_t *parser;
sdp_session_t *sdp;
- if (!switch_strlen_zero(tech_pvt->remote_sdp_str) && !strcmp(tech_pvt->remote_sdp_str, r_sdp)) {
+ if (!zstr(tech_pvt->remote_sdp_str) && !strcmp(tech_pvt->remote_sdp_str, r_sdp)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Duplicate SDP\n%s\n", r_sdp);
is_dup_sdp = 1;
} else {
sofia_set_flag_locked(b_tech_pvt, TFLAG_BYE);
nua_bye(b_tech_pvt->nh,
SIPTAG_REASON_STR("Q.850;cause=16;text=\"normal_clearing\""),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_END());
}
} else {
const char *idest = switch_channel_get_variable(hup_channel, "inline_destination");
ext = switch_channel_get_variable(hup_channel, "destination_number");
- if (!switch_strlen_zero(full_ref_by)) {
+ if (!zstr(full_ref_by)) {
switch_channel_set_variable(t_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
- if (!switch_strlen_zero(full_ref_to)) {
+ if (!zstr(full_ref_to)) {
switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
port = refer_to->r_url->url_port;
}
- if (switch_strlen_zero(port)) {
+ if (zstr(port)) {
port = "5060";
}
switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, rep);
- if (!switch_strlen_zero(full_ref_by)) {
+ if (!zstr(full_ref_by)) {
switch_channel_set_variable(channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
- if (!switch_strlen_zero(full_ref_to)) {
+ if (!zstr(full_ref_to)) {
switch_channel_set_variable(channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
if ((b_session = switch_core_session_locate(br))) {
switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
switch_channel_set_variable(channel, "transfer_fallback_extension", from->a_user);
- if (!switch_strlen_zero(full_ref_by)) {
+ if (!zstr(full_ref_by)) {
switch_channel_set_variable(b_channel, SOFIA_SIP_HEADER_PREFIX "Referred-By", full_ref_by);
}
- if (!switch_strlen_zero(full_ref_to)) {
+ if (!zstr(full_ref_to)) {
switch_channel_set_variable(b_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
}
}
if ((clientcode_header = sofia_glue_get_unknown_header(sip, "x-clientcode"))) {
- if (!switch_strlen_zero(clientcode_header)) {
+ if (!zstr(clientcode_header)) {
switch_channel_set_variable(channel, "call_clientcode", clientcode_header);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Setting CMC to %s\n", clientcode_header);
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
}
if ((rec_header = sofia_glue_get_unknown_header(sip, "record"))) {
- if (switch_strlen_zero(profile->record_template)) {
+ if (zstr(profile->record_template)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Record attempted but no template defined.\n");
nua_respond(nh, 488, "Recording not enabled", NUTAG_WITH_THIS(nua), TAG_END());
} else {
user = url->url_user;
host = url->url_host;
port = url->url_port;
- if (!switch_strlen_zero(url->url_params)) {
+ if (!zstr(url->url_params)) {
switch_channel_set_variable(channel, params_var, url->url_params);
}
}
- if (switch_strlen_zero(user)) {
+ if (zstr(user)) {
user = "nobody";
}
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
host = "nowhere";
}
contact_host = sip->sip_contact->m_url->url_host;
}
- if (!switch_strlen_zero(contact_host)) {
+ if (!zstr(contact_host)) {
for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
"found auth ip [%s] header of [%s]\n",
un->un_name, un->un_value
);
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
for (x = 0; x < profile->acl_count; x++) {
last_acl = profile->acl[x];
if ((ok = switch_check_network_list_ip_token(un->un_value, last_acl, &token))) {
from_host = sip->sip_from->a_url->url_host;
channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from);
- if (!switch_strlen_zero(from_user)) {
+ if (!zstr(from_user)) {
if (*from_user == '+') {
switch_channel_set_variable(channel, "sip_from_user_stripped", (const char *) (from_user + 1));
} else {
switch_channel_set_variable(channel, "sofia_profile_name", profile->name);
switch_channel_set_variable(channel, "sofia_profile_domain_name", profile->domain_name);
- if (!switch_strlen_zero(sip->sip_from->a_display)) {
+ if (!zstr(sip->sip_from->a_display)) {
displayname = sip->sip_from->a_display;
} else {
- displayname = switch_strlen_zero(from_user) ? "unknown" : from_user;
+ displayname = zstr(from_user) ? "unknown" : from_user;
}
}
if (rpid->rpid_url && rpid->rpid_url->url_user) {
char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid);
from_user = rpid->rpid_url->url_user;
- if (!switch_strlen_zero(full_rpid_header)) {
+ if (!zstr(full_rpid_header)) {
switch_channel_set_variable(channel, "sip_Remote-Party-ID", full_rpid_header);
}
}
- if (!switch_strlen_zero(rpid->rpid_display)) {
+ if (!zstr(rpid->rpid_display)) {
displayname = rpid->rpid_display;
}
switch_channel_set_variable(channel, "sip_cid_type", "rpid");
if (passerted->paid_url && passerted->paid_url->url_user) {
char *full_paid_header = sip_header_as_string(nh->nh_home, (void *) passerted);
from_user = passerted->paid_url->url_user;
- if (!switch_strlen_zero(full_paid_header)) {
+ if (!zstr(full_paid_header)) {
switch_channel_set_variable(channel, "sip_P-Asserted-Identity", from_user);
}
}
- if (!switch_strlen_zero(passerted->paid_display)) {
+ if (!zstr(passerted->paid_display)) {
displayname = passerted->paid_display;
}
switch_channel_set_variable(channel, "sip_cid_type", "pid");
if (ppreferred->ppid_url && ppreferred->ppid_url->url_user) {
char *full_ppid_header = sip_header_as_string(nh->nh_home, (void *) ppreferred);
from_user = ppreferred->ppid_url->url_user;
- if (!switch_strlen_zero(full_ppid_header)) {
+ if (!zstr(full_ppid_header)) {
switch_channel_set_variable(channel, "sip_P-Preferred-Identity", full_ppid_header);
}
}
- if (!switch_strlen_zero(ppreferred->ppid_display)) {
+ if (!zstr(ppreferred->ppid_display)) {
displayname = ppreferred->ppid_display;
}
switch_channel_set_variable(channel, "sip_cid_type", "pid");
check_decode(referred_by_user, session);
- if (!switch_strlen_zero(referred_by_user)) {
+ if (!zstr(referred_by_user)) {
if (*referred_by_user == '+') {
switch_channel_set_variable(channel, "sip_referred_by_user_stripped", (const char *) (referred_by_user + 1));
} else {
switch_channel_set_variable(channel, "sip_subject", sip->sip_subject->g_string);
}
- if (sip->sip_user_agent && !switch_strlen_zero(sip->sip_user_agent->g_string)) {
+ if (sip->sip_user_agent && !zstr(sip->sip_user_agent->g_string)) {
switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
}
if ((privacy = sip_privacy(sip))) {
char *full_priv_header = sip_header_as_string(nh->nh_home, (void *) privacy);
- if (!switch_strlen_zero(full_priv_header)) {
+ if (!zstr(full_priv_header)) {
switch_channel_set_variable(channel, "sip_Privacy", full_priv_header);
}
if (msg_params_find(privacy->priv_values, "id")) {
if (!strncasecmp(un->un_name, "Diversion", 9)) {
/* Basic Diversion Support for Diversion Indication in SIP */
/* draft-levy-sip-diversion-08 */
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
char *tmp_name;
if ((tmp_name = switch_mprintf("%s%s", SOFIA_SIP_HEADER_PREFIX, un->un_name))) {
switch_channel_set_variable(channel, tmp_name, un->un_value);
} else if (!strcasecmp(un->un_name, "X-FS-Support")) {
tech_pvt->x_freeswitch_support_remote = switch_core_session_strdup(session, un->un_value);
} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
char new_name[512] = "";
int reps = 0;
for(;;) {
switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
if (ua && switch_stristr("snom", ua)) {
- if (switch_strlen_zero(acp->caller_id_name)) {
+ if (zstr(acp->caller_id_name)) {
snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", acp->caller_id_number);
} else {
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
}
nua_info(b_tech_pvt->nh,
SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
- TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
+ TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
SIPTAG_PAYLOAD_STR(message), TAG_END());
} else if (ua && switch_stristr("polycom", ua)) {
- if (switch_strlen_zero(acp->caller_id_name)) {
+ if (zstr(acp->caller_id_name)) {
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
} else {
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_name, acp->caller_id_number);
}
nua_update(b_tech_pvt->nh,
- TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
- TAG_IF(!switch_strlen_zero(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
+ TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+ TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
TAG_END());
}
tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip,
srbuf,
port,
- (!switch_strlen_zero(tech_pvt->local_crypto_key)
+ (!zstr(tech_pvt->local_crypto_key)
&& sofia_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
if (tech_pvt->rm_encoding) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
}
- if (!switch_strlen_zero(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
+ if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
//switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n");
#if 0
}
}
- if (switch_strlen_zero(stun_ip)) {
+ if (zstr(stun_ip)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "STUN Failed! NO STUN SERVER\n");
goto out;
}
sip_unknown_t *un;
for (un = sip->sip_unknown; un; un = un->un_next) {
if (!strcasecmp(un->un_name, name)) {
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
return un->un_value;
}
}
sdp_port = tech_pvt->local_sdp_audio_port;
if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))
- && !switch_strlen_zero(tech_pvt->profile->extrtpip)) {
+ && !zstr(tech_pvt->profile->extrtpip)) {
use_ip = tech_pvt->profile->extrtpip;
}
sdp_port = tech_pvt->local_sdp_video_port;
if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_video_ip"))
- && !switch_strlen_zero(tech_pvt->profile->extrtpip)) {
+ && !zstr(tech_pvt->profile->extrtpip)) {
use_ip = tech_pvt->profile->extrtpip;
}
int x;
const char *val;
- if (switch_strlen_zero(tech_pvt->remote_sdp_str)) {
+ if (zstr(tech_pvt->remote_sdp_str)) {
return SWITCH_STATUS_FALSE;
}
char *new_sdp;
int bad = 0;
- if (switch_strlen_zero(tech_pvt->local_sdp_str)) {
+ if (zstr(tech_pvt->local_sdp_str)) {
return;
}
return;
}
- if (switch_strlen_zero(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {
+ if (zstr(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {
if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "%s I/O Error\n", switch_channel_get_name(tech_pvt->channel));
return;
switch_channel_variable_last(channel);
}
- if (!switch_strlen_zero((char*)stream.data)) {
+ if (!zstr((char*)stream.data)) {
extra_headers = stream.data;
} else {
switch_safe_free(stream.data);
for (un = sip->sip_unknown; un; un = un->un_next) {
if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
- if (!switch_strlen_zero(un->un_value)) {
+ if (!zstr(un->un_value)) {
switch_snprintf(name, sizeof(name), "%s%s", prefix, un->un_name);
switch_channel_set_variable(channel, name, un->un_value);
}
format,
cid_name,
cid_num,
- !switch_strlen_zero(cid_num) ? "@" : "",
+ !zstr(cid_num) ? "@" : "",
sipip);
}
const char *from_var = switch_channel_get_variable(tech_pvt->channel, "sip_from_uri");
const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display");
- if (switch_strlen_zero(tech_pvt->dest)) {
+ if (zstr(tech_pvt->dest)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "URL Error!\n");
return SWITCH_STATUS_FALSE;
}
} else {
use_from_str = switch_core_session_sprintf(tech_pvt->session, "sip:%s", from_var);
}
- } else if (!switch_strlen_zero(tech_pvt->gateway_from_str)) {
+ } else if (!zstr(tech_pvt->gateway_from_str)) {
use_from_str = tech_pvt->gateway_from_str;
} else {
use_from_str = tech_pvt->from_str;
}
- if (!switch_strlen_zero(tech_pvt->gateway_from_str)) {
+ if (!zstr(tech_pvt->gateway_from_str)) {
rpid_domain = switch_core_session_strdup(session, tech_pvt->gateway_from_str);
- } else if (!switch_strlen_zero(tech_pvt->from_str)) {
+ } else if (!zstr(tech_pvt->from_str)) {
rpid_domain = switch_core_session_strdup(session, tech_pvt->from_str);
}
* Ignore transport chanvar and uri parameter for gateway connections
* since all of them have been already taken care of in mod_sofia.c:sofia_outgoing_channel()
*/
- if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN && switch_strlen_zero(tech_pvt->gateway_name)) {
+ if (tech_pvt->transport == SOFIA_TRANSPORT_UNKNOWN && zstr(tech_pvt->gateway_name)) {
if ((p = (char *) switch_stristr("port=", url))) {
p += 5;
tech_pvt->transport = sofia_glue_str2transport(p);
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(tech_pvt->invite_contact)) {
+ if (zstr(tech_pvt->invite_contact)) {
const char * contact;
if ((contact = switch_channel_get_variable(channel, "sip_contact_user"))) {
char *ip_addr;
sofia_glue_tech_patch_sdp(tech_pvt);
}
- if (!switch_strlen_zero(tech_pvt->dest)) {
+ if (!zstr(tech_pvt->dest)) {
dst = sofia_glue_get_destination(tech_pvt->dest);
if (dst->route_uri) {
NUTAG_AUTOANSWER(0),
NUTAG_SESSION_TIMER(session_timeout),
TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
- TAG_IF(!switch_strlen_zero(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
- TAG_IF(!switch_strlen_zero(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
- TAG_IF(!switch_strlen_zero(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
- TAG_IF(!switch_strlen_zero(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
- TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)),
- TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
+ TAG_IF(!zstr(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
+ TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
+ TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
+ TAG_IF(!zstr(alert_info), SIPTAG_HEADER_STR(alert_info)),
+ TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
- TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
- TAG_IF(!switch_strlen_zero(route_uri), NUTAG_PROXY(route_uri)),
- TAG_IF(!switch_strlen_zero(route), SIPTAG_ROUTE_STR(route)),
+ TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
+ TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)),
+ TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),
SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
nua_invite(tech_pvt->nh2,
SIPTAG_CONTACT_STR(contact_url),
- TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+ TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
SOATAG_REUSE_REJECTED(1),
char *codec_order[SWITCH_MAX_CODECS];
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS] = { 0 };
- if (!switch_strlen_zero(codec_string)) {
+ if (!zstr(codec_string)) {
char *tmp_codec_string;
if ((tmp_codec_string = strdup(codec_string))) {
num_codecs = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
- if (switch_strlen_zero(attr->a_name)) {
+ if (zstr(attr->a_name)) {
continue;
}
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",t38");
} else if (m->m_type == sdp_media_audio && m->m_port) {
for (attr = m->m_attributes; attr; attr = attr->a_next) {
- if (switch_strlen_zero(attr->a_name)) {
+ if (zstr(attr->a_name)) {
continue;
}
if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) {
switch_assert(tech_pvt != NULL);
switch_assert(r_sdp != NULL);
- if (switch_strlen_zero(r_sdp)) {
+ if (zstr(r_sdp)) {
return SWITCH_STATUS_FALSE;
}
}
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
- if (switch_strlen_zero(attr->a_name)) {
+ if (zstr(attr->a_name)) {
continue;
}
ptime = atoi(attr->a_value);
} else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) {
maxptime = atoi(attr->a_value);
- } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !switch_strlen_zero(attr->a_value)) {
+ } else if (!got_crypto && !strcasecmp(attr->a_name, "crypto") && !zstr(attr->a_value)) {
int crypto_tag;
if (m->m_proto != sdp_proto_srtp) {
tech_pvt->crypto_tag = crypto_tag;
got_crypto++;
- if (switch_strlen_zero(tech_pvt->local_crypto_key)) {
+ if (zstr(tech_pvt->local_crypto_key)) {
if (switch_stristr(SWITCH_RTP_CRYPTO_KEY_32, crypto)) {
switch_channel_set_variable(tech_pvt->channel, SOFIA_HAS_CRYPTO_VARIABLE, SWITCH_RTP_CRYPTO_KEY_32);
sofia_glue_build_crypto(tech_pvt, atoi(crypto), AES_CM_128_HMAC_SHA1_32, SWITCH_RTP_CRYPTO_SEND);
}
for (map = m->m_rtpmaps; map; map = map->rm_next) {
- if (switch_strlen_zero(map->rm_encoding) && map->rm_pt < 96) {
+ if (zstr(map->rm_encoding) && map->rm_pt < 96) {
match = (map->rm_pt == tech_pvt->pt) ? 1 : 0;
} else {
match = strcasecmp(switch_str_nil(map->rm_encoding), tech_pvt->iananame) ? 0 : 1;
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Compare [%s:%d:%u:%d]/[%s:%d:%u:%d]\n",
rm_encoding, map->rm_pt, (int) map->rm_rate, ptime,
imp->iananame, imp->ianacode, codec_rate, imp->microseconds_per_packet / 1000);
- if (switch_strlen_zero(map->rm_encoding) && map->rm_pt < 96) {
+ if (zstr(map->rm_encoding) && map->rm_pt < 96) {
match = (map->rm_pt == imp->ianacode) ? 1 : 0;
} else {
match = strcasecmp(rm_encoding, imp->iananame) ? 0 : 1;
tech_pvt->iananame = switch_core_session_strdup(session, (char *) mimp->iananame);
tech_pvt->pt = (switch_payload_t) map->rm_pt;
tech_pvt->rm_rate = map->rm_rate;
- if (!strcasecmp((char *) mimp->iananame, "ilbc") && switch_strlen_zero((char*)map->rm_fmtp)) {
+ if (!strcasecmp((char *) mimp->iananame, "ilbc") && zstr((char*)map->rm_fmtp)) {
/* default to 30 when no mode is defined for ilbc ONLY */
tech_pvt->codec_ms = 30;
} else {
if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
char *err_str;
err_str = switch_odbc_handle_get_error(profile->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, err_str);
}
switch_safe_free(err_str);
char *eoc = NULL;
char *p = NULL;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
return NULL;
}
goto end;
}
- if (!switch_strlen_zero(type)) {
+ if (!zstr(type)) {
ct = type;
}
goto end;
}
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
host = profile->domain_name;
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
host = prof;
}
}
*p++ = '\0';
}
- if (switch_strlen_zero(p)) {
+ if (zstr(p)) {
p = profile->domain_name;
- if (switch_strlen_zero(p)) {
+ if (zstr(p)) {
p = host;
}
}
return;
}
- if (switch_strlen_zero(event_type)) {
+ if (zstr(event_type)) {
event_type = "presence";
}
- if (switch_strlen_zero(alt_event_type)) {
+ if (zstr(alt_event_type)) {
alt_event_type = "presence";
}
switch_safe_free(sql);
- if (!switch_strlen_zero((char *) helper.stream.data)) {
+ if (!zstr((char *) helper.stream.data)) {
char *this_sql = (char *) helper.stream.data;
char *next = NULL;
char *last = NULL;
}
}
- if (!switch_strlen_zero(this_sql) && (!last || strcmp(last, this_sql))) {
+ if (!zstr(this_sql) && (!last || strcmp(last, this_sql))) {
sofia_glue_execute_sql(profile, &this_sql, SWITCH_FALSE);
last = this_sql;
}
switch_url_decode(to_buf);
to_user = to_buf;
}
- if (argc > 10 && !switch_strlen_zero(argv[9]) && !switch_strlen_zero(argv[10])) {
+ if (argc > 10 && !zstr(argv[9]) && !zstr(argv[10])) {
status = argv[9];
rpid = argv[10];
}
}
- if (switch_strlen_zero(proto)) {
+ if (zstr(proto)) {
proto = NULL;
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", 0);
- if (!switch_strlen_zero(to_user)) {
+ if (!zstr(to_user)) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to-user", to_user);
}
- if (switch_strlen_zero(state)) {
+ if (zstr(state)) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", SOFIA_CHAT_PROTO);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "answer-state", "resubscribe");
int kill_handle = 0;
char expires_str[10] = "";
- if (argc > 18 && !switch_strlen_zero(argv[17]) && !switch_strlen_zero(argv[18])) {
+ if (argc > 18 && !zstr(argv[17]) && !zstr(argv[18])) {
status = argv[17];
rpid = argv[18];
}
in = helper->event && helper->event->event_id == SWITCH_EVENT_PRESENCE_IN;
- if (switch_strlen_zero(rpid)) {
+ if (zstr(rpid)) {
rpid = "unknown";
}
- if (switch_strlen_zero(status)) {
+ if (zstr(status)) {
if (!strcasecmp(rpid, "busy")) {
status = "Busy";
} else if (!strcasecmp(rpid, "unavailable")) {
if (!strcasecmp(state, "cs_hangup")) {
astate = "terminated";
- } else if (switch_strlen_zero(astate)) {
+ } else if (zstr(astate)) {
astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
- if (switch_strlen_zero(astate)) {
+ if (zstr(astate)) {
if (is_dialog) {
astate = dft_state;
} else {
clean_from_user = switch_mprintf("%s", from_id ? from_id : from_user);
if (is_dialog) {
- if (!switch_strlen_zero(clean_to_user) && !switch_strlen_zero(clean_from_user)) {
+ if (!zstr(clean_to_user) && !zstr(clean_from_user)) {
stream.write_function(&stream, "<local>\n<identity display=\"%s\">sip:%s@%s</identity>\n", clean_to_user, clean_to_user, host);
stream.write_function(&stream, "<target uri=\"sip:%s@%s\">\n", clean_to_user, host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"%s\"/>\n",
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "park")) {
stream.write_function(&stream, "<local>\n<identity display=\"parking\">sip:parking@%s;fifo=%s</identity>\n",
- host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
+ host, !zstr(clean_to_user) ? clean_to_user : "unknown");
stream.write_function(&stream, "<target uri=\"sip:parking@%s\">\n", host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"no\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"parking\">sip:%s</identity>\n", uuid);
stream.write_function(&stream, "</remote>\n");
} else if (!strcasecmp(proto, "conf")) {
stream.write_function(&stream, "<local>\n<identity display=\"conference\">sip:conference@%s;conference=%s</identity>\n",
- host, !switch_strlen_zero(clean_to_user) ? clean_to_user : "unknown");
+ host, !zstr(clean_to_user) ? clean_to_user : "unknown");
stream.write_function(&stream, "<target uri=\"sip:conference@%s\">\n", host);
stream.write_function(&stream, "<param pname=\"+sip.rendering\" pvalue=\"yes\"/>\n</target>\n</local>\n");
stream.write_function(&stream, "<remote>\n<identity display=\"conference\">sip:%s@%s</identity>\n", uuid, host);
ct = "application/dialog-info+xml";
}
- if (!switch_strlen_zero(astate) && !switch_strlen_zero(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
+ if (!zstr(astate) && !zstr(uuid) && helper && helper->stream.data && strcmp(helper->last_uuid, uuid)) {
helper->stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';", astate, uuid);
switch_copy_string(helper->last_uuid, uuid, sizeof(helper->last_uuid));
rpid = "on-the-phone";
} else if (!strcmp(astate, "confirmed")) {
char *dest = switch_event_get_header(helper->event, "Caller-Destination-Number");
- if (switch_strlen_zero(from_id) && !switch_strlen_zero(dest)) {
+ if (zstr(from_id) && !zstr(dest)) {
from_id = dest;
}
- if (switch_strlen_zero(from_id)) {
+ if (zstr(from_id)) {
from_id = p_to_user;
}
- if (switch_strlen_zero(from_id)) {
+ if (zstr(from_id)) {
switch_snprintf(status_line, sizeof(status_line), "On The Phone %s", status);
} else {
switch_snprintf(status_line, sizeof(status_line), "Talk %s", switch_str_nil(from_id));
display = contact->m_display;
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
if (from) {
display = from->a_display;
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
display = "\"user\"";
}
}
int ok = 1;
char *last_acl = NULL;
- if (!switch_strlen_zero(contact_host)) {
+ if (!zstr(contact_host)) {
for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
}
if (!strcasecmp(status_txt, "open")) {
- if (switch_strlen_zero(note_txt)) {
+ if (zstr(note_txt)) {
note_txt = "Available";
}
in = 1;
} else if (!strcasecmp(status_txt, "closed")) {
- if (switch_strlen_zero(note_txt)) {
+ if (zstr(note_txt)) {
note_txt = "Unavailable";
}
}
host = "none";
}
- if (switch_strlen_zero(user)) {
+ if (zstr(user)) {
sqlextra = switch_mprintf(" or (sip_host='%q')", host);
} else {
sqlextra = switch_mprintf(" or (sip_user='%q' and sip_host='%q')", user, host);
}
}
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
if (to) {
display = to->a_display;
- if (switch_strlen_zero(display)) {
+ if (zstr(display)) {
display = "\"user\"";
}
}
if (!authorization || stale) {
const char *realm = profile->challenge_realm;
- if (switch_strlen_zero(realm) || !strcasecmp(realm, "auto_to")) {
+ if (zstr(realm) || !strcasecmp(realm, "auto_to")) {
realm = to_host;
} else if (!strcasecmp(realm, "auto_from")) {
realm = from_host;
contact_host = sip->sip_contact->m_url->url_host;
}
- if (!switch_strlen_zero(contact_host)) {
+ if (!zstr(contact_host)) {
for (x = 0; x < profile->nat_acl_count; x++) {
last_acl = profile->nat_acl[x];
if (!(ok = switch_check_network_list_ip(contact_host, last_acl))) {
/* Optional check that auth name == SIP username */
if ((regtype == REG_REGISTER) && sofia_test_pflag(profile, PFLAG_CHECKUSER)) {
- if (switch_strlen_zero(username) || switch_strlen_zero(to_user) || strcasecmp(to_user, username)) {
+ if (zstr(username) || zstr(to_user) || strcasecmp(to_user, username)) {
/* Names don't match, so fail */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SIP username %s does not match auth username\n", switch_str_nil(to_user));
goto end;
}
}
- if (switch_strlen_zero(np)) {
+ if (zstr(np)) {
first = 1;
sql = switch_mprintf("select nonce from sip_authentication where nonce='%q'", nonce);
switch_assert(sql != NULL);
}
- if (!switch_strlen_zero(profile->reg_domain)) {
+ if (!zstr(profile->reg_domain)) {
domain_name = profile->reg_domain;
} else {
domain_name = realm;
}
- if (switch_xml_locate_user("id", switch_strlen_zero(username) ? "nobody" : username,
+ if (switch_xml_locate_user("id", zstr(username) ? "nobody" : username,
domain_name, ip, &xml, &domain, &user, &group, params) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n"
"You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n"
}
if (!(number_alias = (char *) switch_xml_attr(user, "number-alias"))) {
- number_alias = switch_strlen_zero(username) ? "nobody" : username;
+ number_alias = zstr(username) ? "nobody" : username;
}
dparams = switch_xml_child(domain, "params");
}
}
- if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
+ if (zstr(passwd) && zstr(a1_hash)) {
ret = AUTH_OK;
goto skip_auth;
}
const char *val = switch_xml_attr_soft(param, "value");
sofia_gateway_t *gateway_ptr = NULL;
- if (!switch_strlen_zero(var) && !switch_strlen_zero(val) && (xparams_type[j] == 1 || !strncasecmp(var, "sip-",4) || !strcasecmp(var, "register-gateway")) ) {
+ if (!zstr(var) && !zstr(val) && (xparams_type[j] == 1 || !strncasecmp(var, "sip-",4) || !strcasecmp(var, "register-gateway")) ) {
if (!switch_event_get_header(*v_event, var)) {
if (profile->debug) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event_add_header -> '%s' = '%s'\n",var, val);
if ((gateways_tag = switch_xml_child(user, "gateways"))) {
for (gateway_tag = switch_xml_child(gateways_tag, "gateway"); gateway_tag; gateway_tag = gateway_tag->next) {
char *name = (char *) switch_xml_attr_soft(gateway_tag, "name");
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "anonymous";
}
}
- if (switch_strlen_zero(globals.default_template)) {
+ if (zstr(globals.default_template)) {
globals.default_template = switch_core_strdup(pool, "default");
}
#endif
memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN);
- if (switch_strlen_zero_buf(thishostname)) {
+ if (zstr_buf(thishostname)) {
gethostname(thishostname, EI_MAXHOSTNAMELEN);
}
}
else {
switch_core_session_t *session;
- if (!switch_strlen_zero_buf(uuid) && (session = switch_core_session_locate(uuid))) {
+ if (!zstr_buf(uuid) && (session = switch_core_session_locate(uuid))) {
switch_event_t *event;
if (switch_event_create(&event, SWITCH_EVENT_SEND_MESSAGE) == SWITCH_STATUS_SUCCESS) {
ei_x_encode_atom(rbuf, "badarg");
} else {
switch_core_session_t *session;
- if (!switch_strlen_zero_buf(uuid_str)) {
+ if (!zstr_buf(uuid_str)) {
if ((session = switch_core_session_locate(uuid_str))) {
/* create a new session list element and attach it to this listener */
if ((arity==2 && attach_call_to_pid(listener, &msg->from, session)) ||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds!\n", xmlstr, i*10);
- if (switch_strlen_zero(xmlstr)) {
+ if (zstr(xmlstr)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str_dynamic(xmlstr, SWITCH_FALSE))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
static switch_bool_t check_inbound_acl(listener_t* listener)
{
/* check acl to see if inbound connection is allowed */
- if (prefs.acl_count && !switch_strlen_zero(listener->remote_ip)) {
+ if (prefs.acl_count && !zstr(listener->remote_ip)) {
uint32_t x = 0;
for (x = 0; x < prefs.acl_count; x++) {
if (!switch_check_network_list_ip(listener->remote_ip, prefs.acl[x])) {
switch_assert(listener != NULL);
if (check_inbound_acl(listener)) {
- if (switch_strlen_zero(listener->remote_ip)) {
+ if (zstr(listener->remote_ip)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n");
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s\n", listener->remote_ip);/*, listener->remote_port);*/
switch_xml_free(xml);
}
- if (switch_strlen_zero(prefs.ip)) {
+ if (zstr(prefs.ip)) {
set_pref_ip("0.0.0.0");
}
- if (switch_strlen_zero(prefs.cookie)) {
+ if (zstr(prefs.cookie)) {
set_pref_cookie("ClueCon");
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error - need registered name and node!\n");
return;
}
- if (switch_strlen_zero(argv[0])) {
+ if (zstr(argv[0])) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing registered name or module:function!\n");
return;
}
node = argv[1];
- if (switch_strlen_zero(node)) {
+ if (zstr(node)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing node name!\n");
return;
}
"erlang sessions <node_name>\n"
"--------------------------------------------------------------------------------\n";
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
host = argv[0];
- if (switch_strlen_zero(host)) {
+ if (zstr(host)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing Host!\n");
return;
}
goto end;
}
- if (switch_strlen_zero(action)) {
+ if (zstr(action)) {
stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
goto end;
}
}
if (!strcasecmp(action, "delete")) {
- if (switch_strlen_zero(header_val)) {
+ if (zstr(header_val)) {
stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
goto filter_end;
}
}
stream->write_function(stream, "<data>\n <reply type=\"success\">filter deleted.</reply>\n<api-command>\n");
} else if (!strcasecmp(action, "add")) {
- if (switch_strlen_zero(header_name) || switch_strlen_zero(header_val)) {
+ if (zstr(header_name) || zstr(header_val)) {
stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
goto filter_end;
}
uint8_t custom = 0;
char *edup;
- if (switch_strlen_zero(events) && switch_strlen_zero(loglevel)) {
+ if (zstr(events) && zstr(loglevel)) {
stream->write_function(stream, "<data><reply type=\"error\">Missing parameter!</reply></data>\n");
goto end;
}
char *var, *val;
var = cur;
strip_cr(var);
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
if ((val = strchr(var, ':'))) {
*val++ = '\0';
while (*val == ' ') {
}
}
- if (switch_strlen_zero(onoff)) {
+ if (zstr(onoff)) {
switch_snprintf(reply, reply_len, "-ERR missing value.");
goto done;
}
}
}
- if (switch_strlen_zero(uuid)) {
+ if (zstr(uuid)) {
uuid = switch_event_get_header(*event, "session-id");
}
uuid = NULL;
}
- if (switch_strlen_zero(uuid) && listener->session) {
+ if (zstr(uuid) && listener->session) {
if (async) {
if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(reply, reply_len, "+OK");
switch_snprintf(reply, reply_len, "+OK");
}
} else {
- if (!switch_strlen_zero(uuid) && (session = switch_core_session_locate(uuid))) {
+ if (!zstr(uuid) && (session = switch_core_session_locate(uuid))) {
if ((status = switch_core_session_queue_private_event(session, event)) == SWITCH_STATUS_SUCCESS) {
switch_snprintf(reply, reply_len, "+OK");
} else {
level_s = cmd + 3;
//see if we got an argument
- if (!switch_strlen_zero(level_s)) {
+ if (!zstr(level_s)) {
//if so move to the argument
level_s++;
}
//see if we lined up on an argument or not
- if (!switch_strlen_zero(level_s)) {
+ if (!zstr(level_s)) {
ltype = switch_log_str2level(level_s);
}
done:
- if (switch_strlen_zero(reply)) {
+ if (zstr(reply)) {
switch_snprintf(reply, reply_len, "-ERR command not found");
}
switch_socket_opt_set(listener->sock, SWITCH_SO_TCP_NODELAY, TRUE);
switch_socket_opt_set(listener->sock, SWITCH_SO_NONBLOCK, TRUE);
- if (prefs.acl_count && listener->sa && !switch_strlen_zero(listener->remote_ip)) {
+ if (prefs.acl_count && listener->sa && !zstr(listener->remote_ip)) {
uint32_t x = 0;
for (x = 0; x < prefs.acl_count; x++) {
}
if (globals.debug > 0) {
- if (switch_strlen_zero(listener->remote_ip)) {
+ if (zstr(listener->remote_ip)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Connection Open\n");
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Connection Open from %s:%d\n", listener->remote_ip, listener->remote_port);
switch_xml_free(xml);
}
- if (switch_strlen_zero(prefs.ip)) {
+ if (zstr(prefs.ip)) {
set_pref_ip("127.0.0.1");
}
- if (switch_strlen_zero(prefs.password)) {
+ if (zstr(prefs.password)) {
set_pref_pass("ClueCon");
}
int argc = 0;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
}
local_stream_name = argv[0];
- if (switch_strlen_zero(local_stream_name)) {
+ if (zstr(local_stream_name)) {
goto usage;
}
switch_mutex_lock(globals.mutex);
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
for (hi = switch_hash_first(NULL, globals.source_hash); hi; hi = switch_hash_next(hi)) {
switch_hash_this(hi, &var, NULL, &val);
if ((source = (local_stream_source_t *) val)) {
switch_xml_t cfg, xml, directory, param;
int tmp;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
switch_xml_free(xml);
}
- if (switch_strlen_zero(local_stream_name) || switch_strlen_zero(path)) {
+ if (zstr(local_stream_name) || zstr(path)) {
goto usage;
}
int match = 0;
pdi = Pa_GetDeviceInfo(i);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
match = 1;
} else if (pdi && pdi->name && strstr(pdi->name, name)) {
match = 1;
lua_call(L, arg_count, 1);
err = lua_tostring(L, -1);
- if (!switch_strlen_zero(err)) {
+ if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
if (func) {
hangup_func_str = strdup(func);
- if (!switch_strlen_zero(arg)) {
+ if (!zstr(arg)) {
hangup_func_arg = strdup(arg);
}
switch_channel_set_private(channel, "CoreSession", this);
lua_pushnumber(L, dtmf->duration);
lua_rawset(L, -3);
- if (!switch_strlen_zero(cb_arg)) {
+ if (!zstr(cb_arg)) {
lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
arg_count++;
}
mod_lua_conjure_event(L, event, "__Input_Event__", 1);
lua_getfield(L, LUA_GLOBALSINDEX, "__Input_Event__");
- if (!switch_strlen_zero(cb_arg)) {
+ if (!zstr(cb_arg)) {
lua_getfield(L, LUA_GLOBALSINDEX, (char *) cb_arg);
arg_count++;
}
{
int error = 0;
- if (switch_strlen_zero(input_code)) {
+ if (zstr(input_code)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n");
return 1;
}
if (error) {
const char *err = lua_tostring(L, -1);
- if (!switch_strlen_zero(err)) {
+ if (!zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
lua_pop(L, 1); /* pop error message from the stack */
switch_xml_t xml = NULL;
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
lua_State *L = lua_init();
char *mycmd = strdup(globals.xml_handler);
const char *str;
str = lua_tostring(L, 1);
if (str) {
- if (switch_strlen_zero(str)) {
+ if (zstr(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str_dynamic((char *)str, SWITCH_TRUE))) {
/* const char -> char conversion was OK because switch_xml_parse_str_dynamic makes a duplicate of str
if (!strcmp(var, "xml-handler-script")) {
globals.xml_handler = switch_core_strdup(globals.pool, val);
} else if (!strcmp(var, "xml-handler-bindings")) {
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
switch_xml_bind_search_function(lua_fetch, switch_xml_parse_section_string(val), NULL);
}
- } else if (!strcmp(var, "module-directory") && !switch_strlen_zero(val)) {
+ } else if (!strcmp(var, "module-directory") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending module directory: '%s'\n", val);
if (cpath_stream.data_len) {
cpath_stream.write_function(&cpath_stream, ";");
}
cpath_stream.write_function(&cpath_stream, "%s", val);
- } else if (!strcmp(var, "script-directory") && !switch_strlen_zero(val)) {
+ } else if (!strcmp(var, "script-directory") && !zstr(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "lua: appending script directory: '%s'\n", val);
if (path_stream.data_len) {
path_stream.write_function(&path_stream, ";");
char *mycmd;
int error;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "no args specified!\n");
return;
}
SWITCH_STANDARD_API(luarun_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR no args specified!\n");
} else {
lua_thread(cmd);
char *mycmd;
int error;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "");
} else {
#endif\r
SWITCH_STANDARD_API(managedrun_api_function) \r
{\r
- if (switch_strlen_zero(cmd)) {\r
+ if (zstr(cmd)) {\r
stream->write_function(stream, "-ERR no args specified!\n"); \r
return SWITCH_STATUS_SUCCESS;\r
}\r
\r
SWITCH_STANDARD_API(managed_api_function) \r
{\r
- if (switch_strlen_zero(cmd)) {\r
+ if (zstr(cmd)) {\r
stream->write_function(stream, "-ERR no args specified!\n"); \r
return SWITCH_STATUS_SUCCESS;\r
}\r
\r
SWITCH_STANDARD_APP(managed_app_function) \r
{\r
- if (switch_strlen_zero(data)) {\r
+ if (zstr(data)) {\r
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No args specified!\n");\r
return;\r
}\r
\r
SWITCH_STANDARD_API(managedreload_api_function) \r
{\r
- if (switch_strlen_zero(cmd)) {\r
+ if (zstr(cmd)) {\r
stream->write_function(stream, "-ERR no args specified!\n"); \r
return SWITCH_STATUS_SUCCESS;\r
}\r
Perl_eval_pv(my_perl, string, FALSE);
- if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
+ if ((err = SvPV(get_sv("@", TRUE), n_a)) && !zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%s]\n%s\n", string, err);
return -1;
}
{
int error = 0;
- if (switch_strlen_zero(input_code)) {
+ if (zstr(input_code)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No code to execute!\n");
return -1;
}
}
}
- if ((err = SvPV(get_sv("@", TRUE), n_a)) && !switch_strlen_zero(err)) {
+ if ((err = SvPV(get_sv("@", TRUE), n_a)) && !zstr(err)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err);
}
SWITCH_STANDARD_API(perlrun_api_function)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR Missing args.\n");
return SWITCH_STATUS_SUCCESS;
}
struct perl_o po = { 0 };
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "-ERR Missing args.\n");
return SWITCH_STATUS_SUCCESS;
}
int argc = 0;
switch_xml_t xml = NULL;
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
PerlInterpreter *my_perl = clone_perl();
HV *hash;
char *str;
abort();
}
- if (switch_strlen_zero(section)) {
+ if (zstr(section)) {
section = "";
}
sv_setpv(this, section);
hv_store(hash, "section", 7, this, 0);
- if (switch_strlen_zero(tag_name)) {
+ if (zstr(tag_name)) {
tag_name = "";
}
sv_setpv(this, tag_name);
hv_store(hash, "tag_name", 8, this, 0);
- if (switch_strlen_zero(key_name)) {
+ if (zstr(key_name)) {
key_name = "";
}
sv_setpv(this, key_name);
hv_store(hash, "key_name", 8, this, 0);
- if (switch_strlen_zero(key_value)) {
+ if (zstr(key_value)) {
key_value = "";
}
perl_run(my_perl);
str = SvPV(get_sv("XML_STRING", TRUE), n_a);
- if (!switch_strlen_zero(str)) {
- if (switch_strlen_zero(str)) {
+ if (!zstr(str)) {
+ if (zstr(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str(str, strlen(str)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
if (!strcmp(var, "xml-handler-script")) {
globals.xml_handler = switch_core_strdup(globals.pool, val);
} else if (!strcmp(var, "xml-handler-bindings")) {
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, var);
switch_xml_bind_search_function(perl_fetch, switch_xml_parse_section_string(val), NULL);
}
switch_xml_t xml = NULL;
char *str = NULL;
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
char *mycmd = strdup(globals.xml_handler);
switch_assert(mycmd);
eval_some_python("xml_fetch", mycmd, NULL, NULL, params, &str, NULL);
if (str) {
- if (switch_strlen_zero(str)) {
+ if (zstr(str)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
} else if (!(xml = switch_xml_parse_str((char *) str, strlen(str)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing XML Result!\n");
if (!strcmp(var, "xml-handler-script")) {
globals.xml_handler = switch_core_strdup(globals.pool, val);
} else if (!strcmp(var, "xml-handler-bindings")) {
- if (!switch_strlen_zero(globals.xml_handler)) {
+ if (!zstr(globals.xml_handler)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "binding '%s' to '%s'\n", globals.xml_handler, val);
switch_xml_bind_search_function(python_fetch, switch_xml_parse_section_string(val), NULL);
}
SWITCH_STANDARD_API(launch_python)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", python_run_interface.syntax);
return SWITCH_STATUS_SUCCESS;
}
if ((mods = switch_xml_child(cfg, "modules"))) {
for (ld = switch_xml_child(mods, "load"); ld; ld = ld->next) {
const char *val = switch_xml_attr_soft(ld, "module");
- if (!switch_strlen_zero(val) && strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
+ if (!zstr(val) && strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
if (argc > 0) {
file_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- if (switch_strlen_zero(file_name)) {
+ if (zstr(file_name)) {
return JS_FALSE;
}
}
if (argc > 0) {
phrase_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- if (switch_strlen_zero(phrase_name)) {
+ if (zstr(phrase_name)) {
return JS_FALSE;
}
} else {
if (argc > 2) {
tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
- if (!switch_strlen_zero(tmp)) {
+ if (!zstr(tmp)) {
phrase_lang = tmp;
}
}
}
JS_CallFunction(jss->cx, jss->obj, jss->on_hangup, argc, argv, &ret);
resp = JS_GetStringBytes(JS_ValueToString(jss->cx, ret));
- if (!switch_strlen_zero(resp)) {
+ if (!zstr(resp)) {
ret = !strcasecmp(resp, "exit") ? JS_FALSE : JS_TRUE;
}
}
if (argc > 0) {
file_name = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
- if (switch_strlen_zero(file_name)) {
+ if (zstr(file_name)) {
return JS_FALSE;
}
}
voice_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
text = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
- if (switch_strlen_zero(tts_name)) {
+ if (zstr(tts_name)) {
eval_some_js("~throw new Error(\"Invalid TTS Name\");", cx, obj, rval);
return JS_FALSE;
}
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
eval_some_js("~throw new Error(\"Invalid Text\");", cx, obj, rval);
return JS_FALSE;
}
}
- if (!switch_strlen_zero(jss->dialplan))
+ if (!zstr(jss->dialplan))
dialplan = jss->dialplan;
- if (!switch_strlen_zero(jss->caller_id_name))
+ if (!zstr(jss->caller_id_name))
cid_name = jss->caller_id_name;
- if (!switch_strlen_zero(jss->caller_id_number))
+ if (!zstr(jss->caller_id_number))
cid_num = jss->caller_id_number;
- if (!switch_strlen_zero(jss->ani))
+ if (!zstr(jss->ani))
ani = jss->ani;
- if (!switch_strlen_zero(jss->aniii))
+ if (!zstr(jss->aniii))
aniii = jss->aniii;
- if (!switch_strlen_zero(jss->rdnis))
+ if (!zstr(jss->rdnis))
rdnis = jss->rdnis;
- if (!switch_strlen_zero(jss->context))
+ if (!zstr(jss->context))
context = jss->context;
- if (!switch_strlen_zero(jss->username))
+ if (!zstr(jss->username))
username = jss->username;
dest = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
if (argc > 2) {
tmp = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
- if (!switch_strlen_zero(tmp)) {
+ if (!zstr(tmp)) {
to = tmp;
}
}
struct js_task *task;
switch_memory_pool_t *pool;
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "missing required input!\n");
return;
}
path_info = switch_event_get_header(stream->param_event, "http-path-info");
}
- if (switch_strlen_zero(cmd) && path_info) {
+ if (zstr(cmd) && path_info) {
cmd = path_info;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", jsapi_interface->syntax);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_STANDARD_API(launch_async)
{
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", js_run_interface->syntax);
return SWITCH_STATUS_SUCCESS;
}
if (argc > 5) {
cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
- if (!switch_strlen_zero(cred)) {
+ if (!zstr(cred)) {
curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
}
data = "";
}
curl_easy_setopt(co->curl_handle, CURLOPT_POSTFIELDS, data);
- } else if (!switch_strlen_zero(data)) {
+ } else if (!zstr(data)) {
durl = switch_mprintf("%s?%s", url, data);
url_p = durl;
}
}
}
- if (switch_strlen_zero(username)) {
+ if (zstr(username)) {
username = NULL;
}
- if (switch_strlen_zero(password)) {
+ if (zstr(password)) {
password = NULL;
}
char *path = NULL;
FILE *input;
- if (!switch_strlen_zero(alt_path)) {
+ if (!zstr(alt_path)) {
path = strdup(alt_path);
} else {
path = switch_mprintf("%s/yaml/extensions.yaml", SWITCH_GLOBAL_dirs.conf_dir);
#else
COLORIZE = 1;
#endif
- } else if (!strcasecmp(var, "loglevel") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "loglevel") && !zstr(val)) {
hard_log_level = switch_log_str2level(val);
}
}
if (session)
return SWITCH_STATUS_FALSE;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
stream->write_function(stream, "%s", usage_string);
goto done;
}
}
}
- if (switch_strlen_zero(new_profile->logfile)) {
+ if (zstr(new_profile->logfile)) {
char logfile[512];
switch_snprintf(logfile, sizeof(logfile), "%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, "freeswitch.log");
new_profile->logfile = strdup(logfile);
}
/* don't log blank lines */
- if (!switch_strlen_zero(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) {
+ if (!zstr(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) {
syslog(syslog_level, "%s", node->data);
}
set_global_format(val);
} else if (!strcmp(var, "facility")) {
set_global_facility(val);
- } else if (!strcasecmp(var, "loglevel") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "loglevel") && !zstr(val)) {
log_level = switch_log_str2level(val);
if (log_level == SWITCH_LOG_INVALID) {
log_level = SWITCH_LOG_WARNING;
switch_xml_free(xml);
}
- if (switch_strlen_zero(globals.ident)) {
+ if (zstr(globals.ident)) {
set_global_ident(DEFAULT_IDENT);
}
- if (switch_strlen_zero(globals.format)) {
+ if (zstr(globals.format)) {
set_global_format(DEFAULT_FORMAT);
}
- if (switch_strlen_zero(globals.facility)) {
+ if (zstr(globals.facility)) {
set_global_facility(DEFAULT_FACILITY);
}
return 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file paths\n");
- if (!switch_strlen_zero(globals.base_log_dir)) {
+ if (!zstr(globals.base_log_dir)) {
if (globals.rotate) {
if ((path = switch_mprintf("%s%s%s", globals.base_log_dir, SWITCH_PATH_SEPARATOR, date))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file path to %s\n", path);
}
}
- if (!switch_strlen_zero(globals.base_err_log_dir)) {
+ if (!zstr(globals.base_err_log_dir)) {
if (globals.rotate) {
if ((path = switch_mprintf("%s%s%s", globals.base_err_log_dir, SWITCH_PATH_SEPARATOR, date))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating err log file path to %s\n", path);
logdir = globals.log_dir;
}
- if (!switch_strlen_zero(logdir)) {
+ if (!zstr(logdir)) {
path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
switch_thread_rwlock_unlock(globals.log_path_lock);
if (path) {
goto error;
}
- if (!switch_strlen_zero(globals.cred)) {
+ if (!zstr(globals.cred)) {
curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, globals.cred);
}
char *var = (char *) switch_xml_attr_soft(param, "name");
char *val = (char *) switch_xml_attr_soft(param, "value");
- if (!strcasecmp(var, "cred") && !switch_strlen_zero(val)) {
+ if (!strcasecmp(var, "cred") && !zstr(val)) {
globals.cred = switch_core_strdup(globals.pool, val);
- } else if (!strcasecmp(var, "url") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "url") && !zstr(val)) {
if (globals.url_count >= MAX_URLS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "maximum urls configured!\n");
} else {
globals.urls[globals.url_count++] = switch_core_strdup(globals.pool, val);
}
- } else if (!strcasecmp(var, "delay") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "delay") && !zstr(val)) {
globals.delay = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "log-b-leg")) {
globals.log_b = switch_true(val);
globals.prefix_a = switch_true(val);
} else if (!strcasecmp(var, "disable-100-continue") && switch_true(val)) {
globals.disable100continue = 1;
- } else if (!strcasecmp(var, "encode") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "encode") && !zstr(val)) {
if (!strcasecmp(val, "base64")) {
globals.encode = 2;
} else {
globals.encode = switch_true(val) ? 1 : 0;
}
- } else if (!strcasecmp(var, "retries") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "retries") && !zstr(val)) {
globals.retries = (uint32_t) atoi(val);
- } else if (!strcasecmp(var, "rotate") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rotate") && !zstr(val)) {
globals.rotate = switch_true(val);
} else if (!strcasecmp(var, "log-dir")) {
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
globals.base_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
} else {
if (switch_is_file_path(val)) {
}
}
} else if (!strcasecmp(var, "err-log-dir")) {
- if (switch_strlen_zero(val)) {
+ if (zstr(val)) {
globals.base_err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
} else {
if (switch_is_file_path(val)) {
globals.enable_ssl_verifyhost = 1;
}
- if (switch_strlen_zero(globals.base_err_log_dir)) {
- if (!switch_strlen_zero(globals.base_log_dir)) {
+ if (zstr(globals.base_err_log_dir)) {
+ if (!zstr(globals.base_log_dir)) {
globals.base_err_log_dir = switch_core_strdup(globals.pool, globals.base_log_dir);
} else {
globals.base_err_log_dir = switch_core_sprintf(globals.pool, "%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
config_data.max_bytes = XML_CURL_MAX_BYTES;
if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
- if (!switch_strlen_zero(binding->cred)) {
+ if (!zstr(binding->cred)) {
curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, binding->auth_scheme);
curl_easy_setopt(curl_handle, CURLOPT_USERPWD, binding->cred);
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->url, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->bindings), binding);
x++;
binding = NULL;
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
goto usage;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] (%s) [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] (%s) [%s]\n",
- switch_strlen_zero(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
+ zstr(bname) ? "N/A" : bname, binding->basedn, binding->filter, binding->bindings ? binding->bindings : "all");
switch_xml_bind_search_function(xml_ldap_search, switch_xml_parse_section_string(bname), binding);
return FALSE;
}
- if (switch_strlen_zero(globals.realm) && switch_strlen_zero(globals.user)) {
+ if (zstr(globals.realm) && zstr(globals.user)) {
return TRUE;
}
domain_name = dp;
}
- if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !strcmp(user, globals.user)) {
+ if (!zstr(globals.realm) && !zstr(globals.user) && !strcmp(user, globals.user)) {
switch_safe_free(user);
return TRUE;
}
- if (switch_strlen_zero(user) || switch_strlen_zero(domain_name)) {
+ if (zstr(user) || zstr(domain_name)) {
switch_safe_free(user);
return FALSE;
}
}
}
- if (switch_strlen_zero(user) || switch_strlen_zero(domain_name)) {
+ if (zstr(user) || zstr(domain_name)) {
goto fail;
}
- if (!switch_strlen_zero(globals.realm) && !switch_strlen_zero(globals.user) && !switch_strlen_zero(globals.pass)) {
+ if (!zstr(globals.realm) && !zstr(globals.user) && !zstr(globals.pass)) {
if (at) {
switch_snprintf(z, sizeof(z), "%s@%s:%s", globals.user, globals.realm, globals.pass);
} else {
}
- if (!switch_strlen_zero(mypass2) && !strcasecmp(mypass2, "user-choose")) {
+ if (!zstr(mypass2) && !strcasecmp(mypass2, "user-choose")) {
mypass2 = NULL;
}
relative_oid = oid;
}
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
switch_copy_string(buf, data, sizeof(buf));
}
#include <switch.h>
#include <switch_caller.h>
-#define profile_dup(a,b,p) if (!switch_strlen_zero(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
-#define profile_dup_clean(a,b,p) if (!switch_strlen_zero(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
+#define profile_dup(a,b,p) if (!zstr(a)) { b = switch_core_strdup(p, a); } else { b = SWITCH_BLANK_STRING; }
+#define profile_dup_clean(a,b,p) if (!zstr(a)) { b = switch_var_clean_string(switch_clean_string(switch_core_strdup(p, a)));} else { b = SWITCH_BLANK_STRING; }
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool,
const char *username,
context = "default";
}
- if (switch_strlen_zero(caller_id_name)) {
+ if (zstr(caller_id_name)) {
caller_id_name = "FreeSWITCH";
}
- if (switch_strlen_zero(caller_id_number)) {
+ if (zstr(caller_id_number)) {
caller_id_number = "0000000000";
}
{
char header_name[1024];
- if (!switch_strlen_zero(caller_profile->username)) {
+ if (!zstr(caller_profile->username)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Username", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->username);
}
- if (!switch_strlen_zero(caller_profile->dialplan)) {
+ if (!zstr(caller_profile->dialplan)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Dialplan", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->dialplan);
}
- if (!switch_strlen_zero(caller_profile->caller_id_name)) {
+ if (!zstr(caller_profile->caller_id_name)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Name", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_name);
}
- if (!switch_strlen_zero(caller_profile->caller_id_number)) {
+ if (!zstr(caller_profile->caller_id_number)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Caller-ID-Number", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->caller_id_number);
}
- if (!switch_strlen_zero(caller_profile->network_addr)) {
+ if (!zstr(caller_profile->network_addr)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Network-Addr", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->network_addr);
}
- if (!switch_strlen_zero(caller_profile->ani)) {
+ if (!zstr(caller_profile->ani)) {
switch_snprintf(header_name, sizeof(header_name), "%s-ANI", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->ani);
}
- if (!switch_strlen_zero(caller_profile->aniii)) {
+ if (!zstr(caller_profile->aniii)) {
switch_snprintf(header_name, sizeof(header_name), "%s-ANI-II", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->aniii);
}
- if (!switch_strlen_zero(caller_profile->destination_number)) {
+ if (!zstr(caller_profile->destination_number)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Destination-Number", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->destination_number);
}
- if (!switch_strlen_zero(caller_profile->uuid)) {
+ if (!zstr(caller_profile->uuid)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Unique-ID", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->uuid);
}
- if (!switch_strlen_zero(caller_profile->source)) {
+ if (!zstr(caller_profile->source)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Source", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->source);
}
- if (!switch_strlen_zero(caller_profile->context)) {
+ if (!zstr(caller_profile->context)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Context", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->context);
}
- if (!switch_strlen_zero(caller_profile->rdnis)) {
+ if (!zstr(caller_profile->rdnis)) {
switch_snprintf(header_name, sizeof(header_name), "%s-RDNIS", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->rdnis);
}
- if (!switch_strlen_zero(caller_profile->chan_name)) {
+ if (!zstr(caller_profile->chan_name)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Name", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->chan_name);
}
- if (!switch_strlen_zero(caller_profile->profile_index)) {
+ if (!zstr(caller_profile->profile_index)) {
switch_snprintf(header_name, sizeof(header_name), "%s-Profile-Index", prefix);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, caller_profile->profile_index);
}
int i, argc;
char *argv[256];
- if (switch_strlen_zero(dtmf_string)) {
+ if (zstr(dtmf_string)) {
return SWITCH_STATUS_FALSE;
}
const char *val = NULL, *r = NULL;
switch_assert(channel != NULL);
- if (!switch_strlen_zero(varname)) {
+ if (!zstr(varname)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
const char *old = NULL;
switch_assert(channel != NULL);
- if (!switch_strlen_zero(channel->name)) {
+ if (!zstr(channel->name)) {
old = channel->name;
}
channel->name = NULL;
SWITCH_DECLARE(char *) switch_channel_get_name(switch_channel_t *channel)
{
switch_assert(channel != NULL);
- return (!switch_strlen_zero(channel->name)) ? channel->name : "N/A";
+ return (!zstr(channel->name)) ? channel->name : "N/A";
}
SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val)
switch_mutex_lock(channel->profile_mutex);
- if (!switch_strlen_zero(val)) {
+ if (!zstr(val)) {
v = switch_core_strdup(channel->caller_profile->pool, val);
} else {
v = SWITCH_BLANK_STRING;
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- if (channel->variables && !switch_strlen_zero(varname)) {
+ if (channel->variables && !zstr(varname)) {
switch_event_del_header(channel->variables, varname);
- if (!switch_strlen_zero(value)) {
+ if (!zstr(value)) {
int ok = 1;
if (var_check) {
switch_assert(channel != NULL);
switch_mutex_lock(channel->profile_mutex);
- if (channel->variables && !switch_strlen_zero(varname)) {
+ if (channel->variables && !zstr(varname)) {
switch_event_del_header(channel->variables, varname);
va_start(ap, fmt);
const char *uuid;
switch_assert(channel != NULL);
- if (!switch_strlen_zero(varname)) {
+ if (!zstr(varname)) {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
switch_core_session_t *session;
if ((session = switch_core_session_locate(uuid))) {
switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ANSWER");
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
- if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) && !switch_strlen_zero(var)) {
+ if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) && !zstr(var)) {
char *arg = NULL;
app = switch_core_session_strdup(channel->session, var);
}
}
- if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE)) && !switch_strlen_zero(var)) {
+ if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE)) && !zstr(var)) {
switch_stream_handle_t stream = { 0 };
char *arg = NULL;
char *func_val = NULL;
int nv = 0;
- if (switch_strlen_zero(in)) {
+ if (zstr(in)) {
return (char *) in;
}
prof_names[10] = "uuid";
for (x = 0; prof[x]; x++) {
- if (switch_strlen_zero(prof[x])) {
+ if (zstr(prof[x])) {
continue;
}
new_len = (strlen(prof[x]) * 3) + 1;
switch_mutex_lock(channel->profile_mutex);
switch_mutex_lock(other_channel->profile_mutex);
- if (!switch_strlen_zero(channel->caller_profile->callee_id_name)) {
+ if (!zstr(channel->caller_profile->callee_id_name)) {
other_channel->caller_profile->callee_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name);
x++;
}
- if (!switch_strlen_zero(channel->caller_profile->callee_id_number)) {
+ if (!zstr(channel->caller_profile->callee_id_number)) {
other_channel->caller_profile->callee_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number);
x++;
}
ocp = switch_channel_get_originator_caller_profile(channel);
}
- if (!switch_strlen_zero(caller_profile->caller_id_name)) {
+ if (!zstr(caller_profile->caller_id_name)) {
cid_buf = switch_core_session_sprintf(channel->session, "\"%s\" <%s>", caller_profile->caller_id_name,
switch_str_nil(caller_profile->caller_id_number));
} else {
line = el_gets(el, &count);
if (count > 1) {
- if (!switch_strlen_zero(line)) {
+ if (!zstr(line)) {
char *cmd = strdup(line);
char *p;
const LineInfo *lf = el_line(el);
switch_copy_string(h->last, target, sizeof(h->last));
- if (!switch_strlen_zero(target)) {
+ if (!zstr(target)) {
if ((++h->hits % 4) == 0) {
fprintf(h->out, "\n");
}
const char *dft = switch_xml_attr(x_list, "default");
switch_bool_t default_type = SWITCH_TRUE;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
continue;
}
#endif
} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
runtime.colorize_console = SWITCH_TRUE;
- } else if (!strcasecmp(var, "mailer-app") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "mailer-app") && !zstr(val)) {
runtime.mailer_app = switch_core_strdup(runtime.memory_pool, val);
} else if (!strcasecmp(var, "mailer-app-args") && val) {
runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val);
- } else if (!strcasecmp(var, "sessions-per-second") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "sessions-per-second") && !zstr(val)) {
switch_core_sessions_per_second(atoi(val));
- } else if (!strcasecmp(var, "max_dtmf_duration") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "max_dtmf_duration") && !zstr(val)) {
int tmp = atoi(val);
if (tmp > 0) {
switch_core_max_dtmf_duration((uint32_t) tmp);
}
- } else if (!strcasecmp(var, "min_dtmf_duration") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "min_dtmf_duration") && !zstr(val)) {
int tmp = atoi(val);
if (tmp > 0) {
switch_core_min_dtmf_duration((uint32_t) tmp);
}
- } else if (!strcasecmp(var, "default_dtmf_duration") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "default_dtmf_duration") && !zstr(val)) {
int tmp = atoi(val);
if (tmp > 0) {
switch_core_default_dtmf_duration((uint32_t) tmp);
}
} else if (!strcasecmp(var, "disable-monotonic-timing")) {
switch_time_set_monotonic(SWITCH_FALSE);
- } else if (!strcasecmp(var, "max-sessions") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "max-sessions") && !zstr(val)) {
switch_core_session_limit(atoi(val));
- } else if (!strcasecmp(var, "rtp-start-port") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rtp-start-port") && !zstr(val)) {
switch_rtp_set_start_port((switch_port_t) atoi(val));
- } else if (!strcasecmp(var, "rtp-end-port") && !switch_strlen_zero(val)) {
+ } else if (!strcasecmp(var, "rtp-end-port") && !zstr(val)) {
switch_rtp_set_end_port((switch_port_t) atoi(val));
#ifdef ENABLE_ZRTP
} else if (!strcasecmp(var, "rtp-enable-zrtp")) {
switch_assert(ah != NULL);
- if (switch_strlen_zero(grammar)) {
+ if (zstr(grammar)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
while (data && *data == ' ') {
data++;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
if (*data == '{') {
param_string = data + 1;
data = switch_find_end_paren(data, '{', '}');
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
} else {
}
/* set ASR params */
- if (!switch_strlen_zero(param_string)) {
+ if (!zstr(param_string)) {
char *param[256] = { 0 };
int i;
int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(file_path)) {
+ if (zstr(file_path)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Filename\n");
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_FALSE;
}
- if (switch_strlen_zero(dtmf_string)) {
+ if (zstr(dtmf_string)) {
return SWITCH_STATUS_FALSE;
}
return NULL;
}
- if (switch_strlen_zero(todup)) {
+ if (zstr(todup)) {
return SWITCH_BLANK_STRING;
}
return NULL;
}
- if (switch_strlen_zero(todup)) {
+ if (zstr(todup)) {
return SWITCH_BLANK_STRING;
}
return NULL;
}
- if (switch_strlen_zero(todup)) {
+ if (zstr(todup)) {
return SWITCH_BLANK_STRING;
}
switch_assert(channel != NULL);
forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
- if (!switch_strlen_zero(forwardvar)) {
+ if (!zstr(forwardvar)) {
forwardval = atoi(forwardvar) - 1;
}
if (forwardval <= 0) {
char *myarg = NULL;
if (expanded) {
myarg = switch_mprintf("%s(%s)", app, expanded);
- } else if (!switch_strlen_zero(arg)) {
+ } else if (!zstr(arg)) {
myarg = switch_mprintf("%s(%s)", app, arg);
} else {
myarg = switch_mprintf("%s", app);
new_profile = switch_caller_profile_clone(session, profile);
new_profile->destination_number = switch_core_strdup(new_profile->pool, exten);
- if (!switch_strlen_zero(dialplan)) {
+ if (!zstr(dialplan)) {
new_profile->dialplan = switch_core_strdup(new_profile->pool, dialplan);
}
- if (!switch_strlen_zero(context)) {
+ if (!zstr(context)) {
new_profile->context = switch_core_strdup(new_profile->pool, context);
}
char buf[256] = "";
char *param = NULL;
- if (!sh || !flags || switch_strlen_zero(module_name)) {
+ if (!sh || !flags || zstr(module_name)) {
return SWITCH_STATUS_FALSE;
}
switch_assert(sh != NULL);
- if (switch_strlen_zero(text)) {
+ if (zstr(text)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
while (data && *data == ' ') {
data++;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
}
if (*data == '{') {
param_string = data + 1;
data = switch_find_end_paren(data, '{', '}');
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
status = SWITCH_STATUS_FALSE;
goto done;
} else {
}
/* set TTS params */
- if (!switch_strlen_zero(param_string)) {
+ if (!zstr(param_string)) {
char *param[256] = { 0 };
int i;
int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
char *state = switch_event_get_header_nil(event, "channel-state-number");
switch_channel_state_t state_i = CS_DESTROY;
- if (!switch_strlen_zero(state)) {
+ if (!zstr(state)) {
state_i = atoi(state);
}
const char *syntax = switch_event_get_header_nil(event, "syntax");
const char *key = switch_event_get_header_nil(event, "key");
const char *filename = switch_event_get_header_nil(event, "filename");
- if (!switch_strlen_zero(type) && !switch_strlen_zero(name)) {
+ if (!zstr(type) && !zstr(name)) {
sql =
switch_mprintf("insert into interfaces (type,name,description,syntax,key,filename) values('%q','%q','%q','%q','%q','%q')",
type, name, switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename)
{
const char *type = switch_event_get_header_nil(event, "type");
const char *name = switch_event_get_header_nil(event, "name");
- if (!switch_strlen_zero(type) && !switch_strlen_zero(name)) {
+ if (!zstr(type) && !zstr(name)) {
sql = switch_mprintf("delete from interfaces where type='%q' and name='%q'", type, name);
}
break;
{
const char *type = switch_event_get_header_nil(event, "secure_type");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Secure Type: %s\n", type);
- if (switch_strlen_zero(type)) {
+ if (zstr(type)) {
break;
}
sql = switch_mprintf("update channels set secure='%s' where uuid='%s'",
char *dp[25];
int argc, x, count = 0;
- if (!switch_strlen_zero(caller_profile->dialplan)) {
+ if (!zstr(caller_profile->dialplan)) {
if ((dpstr = switch_core_session_strdup(session, caller_profile->dialplan))) {
expanded = switch_channel_expand_variables(session->channel, dpstr);
argc = switch_separate_string(expanded, ',', dp, (sizeof(dp) / sizeof(dp[0])));
use_session = session;
}
- if (!switch_strlen_zero(hook_var)) {
+ if (!zstr(hook_var)) {
switch_stream_handle_t stream = { 0 };
char *cmd = switch_core_session_strdup(session, hook_var);
char *arg = NULL;
driver_state_handler = endpoint_interface->state_handler;
switch_assert(driver_state_handler != NULL);
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
if (!strcasecmp(var, "a_only")) {
if (switch_channel_get_originator_caller_profile(session->channel)) {
do_extra_handlers = 0;
switch_name_event(event_name, &e_event_id);
switch_core_new_memory_pool(&pool);
- if (!switch_strlen_zero(subclass_name)) {
+ if (!zstr(subclass_name)) {
e_subclass_name = switch_core_strdup(pool, subclass_name);
} else {
e_subclass_name = NULL;
menu = NULL;
switch_core_new_memory_pool(&pool);
switch_assert(pool);
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = "no name";
}
event_id = SWITCH_EVENT_MESSAGE;
}
- if (!switch_strlen_zero(subclass_name) && event_id != SWITCH_EVENT_CUSTOM) {
+ if (!zstr(subclass_name) && event_id != SWITCH_EVENT_CUSTOM) {
switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_WARNING, "Changing event type to custom because you specified a subclass name!\n");
event_id = SWITCH_EVENT_CUSTOM;
}
this_check(SWITCH_STATUS_FALSE);
sanity_check(SWITCH_STATUS_FALSE);
- if (switch_strlen_zero(result)) {
+ if (zstr(result)) {
return SWITCH_STATUS_SUCCESS;
}
}
}
- if (!switch_strlen_zero(data)) {
+ if (!zstr(data)) {
body = data;
} else if (event->body) {
body = event->body;
for (x = 0; prof[x]; x++) {
- if (switch_strlen_zero(prof[x])) {
+ if (zstr(prof[x])) {
continue;
}
new_len = (strlen(prof[x]) * 3) + 1;
char *event_lock = switch_event_get_header(event, "event-lock");
switch_status_t status = SWITCH_STATUS_FALSE;
- if (switch_strlen_zero(cmd)) {
+ if (zstr(cmd)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Command!\n");
return SWITCH_STATUS_FALSE;
}
char *transport = switch_event_get_header(event, "transport");
char *flags = switch_event_get_header(event, "flags");
- if (switch_strlen_zero(local_ip)) {
+ if (zstr(local_ip)) {
local_ip = "127.0.0.1";
}
- if (switch_strlen_zero(remote_ip)) {
+ if (zstr(remote_ip)) {
remote_ip = "127.0.0.1";
}
- if (switch_strlen_zero(local_port)) {
+ if (zstr(local_port)) {
local_port = "8025";
}
- if (switch_strlen_zero(remote_port)) {
+ if (zstr(remote_port)) {
remote_port = "8026";
}
- if (switch_strlen_zero(transport)) {
+ if (zstr(transport)) {
transport = "udp";
}
*terminator = '\0';
}
- if (!switch_strlen_zero(terminators)) {
+ if (!zstr(terminators)) {
for (i = 0; i < x; i++) {
if (strchr(terminators, buf[i]) && terminator != NULL) {
*terminator = buf[i];
break;
}
- if (!switch_strlen_zero(terminators) && strchr(terminators, dtmf.digit) && terminator != NULL) {
+ if (!zstr(terminators) && strchr(terminators, dtmf.digit) && terminator != NULL) {
*terminator = dtmf.digit;
return SWITCH_STATUS_SUCCESS;
}
const char *forwardvar = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
int forwardval = 70;
- if (!switch_strlen_zero(forwardvar)) {
+ if (!zstr(forwardvar)) {
forwardval = atoi(forwardvar) - 1;
}
if (forwardval <= 0) {
if ((profile = switch_channel_get_caller_profile(channel))) {
const char *var;
- if (switch_strlen_zero(dialplan)) {
+ if (zstr(dialplan)) {
dialplan = profile->dialplan;
- if (!switch_strlen_zero(dialplan) && !strcasecmp(dialplan, "inline")) {
+ if (!zstr(dialplan) && !strcasecmp(dialplan, "inline")) {
dialplan = NULL;
}
}
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
context = profile->context;
}
- if (switch_strlen_zero(dialplan)) {
+ if (zstr(dialplan)) {
dialplan = "XML";
}
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
context = "default";
}
- if (switch_strlen_zero(extension)) {
+ if (zstr(extension)) {
extension = "service";
}
return off;
for (; hi; hi = hi->next) {
- if (!switch_strlen_zero(hi->name) && !switch_strlen_zero(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
+ if (!zstr(hi->name) && !zstr(hi->value) && ((variable = switch_xml_add_child_d(xml, hi->name, off++)))) {
char *data;
switch_size_t dlen = strlen(hi->value) * 3;
goto error;
}
- if (!switch_strlen_zero(caller_profile->dialplan)) {
+ if (!zstr(caller_profile->dialplan)) {
switch_xml_set_attr_d(x_callflow, "dialplan", caller_profile->dialplan);
}
- if (!switch_strlen_zero(caller_profile->profile_index)) {
+ if (!zstr(caller_profile->profile_index)) {
switch_xml_set_attr_d(x_callflow, "profile_index", caller_profile->profile_index);
}
char * prefix_buffer = NULL, *prefix;
size_t buffer_size =0;
size_t prefix_size=0;
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
goto error;
}
status = SWITCH_STATUS_SUCCESS;
- if (!switch_strlen_zero(prefix)) {
+ if (!zstr(prefix)) {
prefix_size = strlen(prefix);
buffer_size = 1024 + prefix_size + 1;
prefix_buffer = switch_core_session_alloc(session, buffer_size);
}
- if (!switch_strlen_zero(require_group)) {
+ if (!zstr(require_group)) {
int argc, i;
int ok = 0;
char *argv[10] = { 0 };
switch_core_session_get_read_impl(session, &read_impl);
- if (switch_strlen_zero(key)) {
+ if (zstr(key)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Key Specified!\n");
return SWITCH_STATUS_FALSE;
}
}
for (i = 0; i < cont->index; i++) {
- if (!switch_strlen_zero(cont->list[i].key) && !strcasecmp(key, cont->list[i].key)) {
+ if (!zstr(cont->list[i].key) && !strcasecmp(key, cont->list[i].key)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Re-enabling %s\n", key);
cont->list[i].up = 1;
cont->list[i].hits = 0;
}
}
- if (switch_strlen_zero(tone_spec)) {
+ if (zstr(tone_spec)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Spec Specified!\n");
return SWITCH_STATUS_FALSE;
}
}
- if (switch_strlen_zero(flags)) {
+ if (zstr(flags)) {
bflags = SMBF_READ_REPLACE;
} else {
if (strchr(flags, 'o')) {
switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
}
- if (!switch_strlen_zero(app)) {
+ if (!zstr(app)) {
if ((bind_flags & SBF_DIAL_ALEG)) {
md->sr[SWITCH_DTMF_RECV].up = 1;
md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
name = caller_profile->callee_id_name;
number = caller_profile->callee_id_number;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = caller_profile->destination_number;
}
- if (switch_strlen_zero(number)) {
+ if (zstr(number)) {
number = caller_profile->destination_number;
}
} else {
name = caller_profile->caller_id_name;
number = caller_profile->caller_id_number;
- if (switch_strlen_zero(name)) {
+ if (zstr(name)) {
name = caller_profile->destination_number;
}
- if (switch_strlen_zero(number)) {
+ if (zstr(number)) {
number = caller_profile->destination_number;
}
}
hook_var = switch_channel_get_variable(chan_a, SWITCH_API_BRIDGE_END_VARIABLE);
}
- if (!switch_strlen_zero(hook_var)) {
+ if (!zstr(hook_var)) {
switch_stream_handle_t stream = { 0 };
char *cmd = switch_core_session_strdup(session_a, hook_var);
char *arg = NULL;
switch_channel_set_variable(switch_core_session_get_channel(session), SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, NULL);
- if (!switch_strlen_zero(where) && (mydata = switch_core_session_strdup(session, where))) {
+ if (!zstr(where) && (mydata = switch_core_session_strdup(session, where))) {
if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
} else {
const char *sbv = switch_channel_get_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
const char *var;
- if (!switch_strlen_zero(sbv) && !strcmp(sbv, switch_core_session_get_uuid(session))) {
+ if (!zstr(sbv) && !strcmp(sbv, switch_core_session_get_uuid(session))) {
switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Restore media to %s\n", switch_channel_get_name(channel));
switch_ivr_media(switch_core_session_get_uuid(session), SMF_IMMEDIATE);
- if (!switch_strlen_zero(sbv) && (sbsession = switch_core_session_locate(sbv))) {
+ if (!zstr(sbv) && (sbsession = switch_core_session_locate(sbv))) {
switch_channel_t *sbchannel = switch_core_session_get_channel(sbsession);
switch_channel_hangup(sbchannel, SWITCH_CAUSE_ATTENDED_TRANSFER);
switch_core_session_rwunlock(sbsession);
}
}
- if (switch_strlen_zero(uuid) || !(rsession = switch_core_session_locate(uuid))) {
+ if (zstr(uuid) || !(rsession = switch_core_session_locate(uuid))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no uuid %s\n", uuid);
return;
}
inter_timeout = timeout / 2;
}
- if (!switch_strlen_zero(name)) {
+ if (!zstr(name)) {
menu->name = switch_core_strdup(menu->pool, name);
}
- if (!switch_strlen_zero(greeting_sound)) {
+ if (!zstr(greeting_sound)) {
menu->greeting_sound = switch_core_strdup(menu->pool, greeting_sound);
}
- if (!switch_strlen_zero(short_greeting_sound)) {
+ if (!zstr(short_greeting_sound)) {
menu->short_greeting_sound = switch_core_strdup(menu->pool, short_greeting_sound);
}
- if (!switch_strlen_zero(invalid_sound)) {
+ if (!zstr(invalid_sound)) {
menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound);
}
- if (!switch_strlen_zero(exit_sound)) {
+ if (!zstr(exit_sound)) {
menu->exit_sound = switch_core_strdup(menu->pool, exit_sound);
}
- if (!switch_strlen_zero(confirm_macro)) {
+ if (!zstr(confirm_macro)) {
menu->confirm_macro = switch_core_strdup(menu->pool, confirm_macro);
}
- if (!switch_strlen_zero(tts_engine)) {
+ if (!zstr(tts_engine)) {
menu->tts_engine = switch_core_strdup(menu->pool, tts_engine);
}
- if (!switch_strlen_zero(tts_voice)) {
+ if (!zstr(tts_voice)) {
menu->tts_voice = switch_core_strdup(menu->pool, tts_voice);
}
char *sound_expanded = sound;
switch_size_t menu_buf_len = 0;
- if (!session || !menu || switch_strlen_zero(sound)) {
+ if (!session || !menu || zstr(sound)) {
return status;
}
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
- if (!session || !stack || switch_strlen_zero(name)) {
+ if (!session || !stack || zstr(name)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid menu context\n");
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
switch_goto_status(SWITCH_STATUS_FALSE, end);
}
- if (!switch_strlen_zero(menu->tts_engine) && !switch_strlen_zero(menu->tts_voice)) {
+ if (!zstr(menu->tts_engine) && !zstr(menu->tts_voice)) {
switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
}
char substituted[1024];
char *use_arg = ap->arg;
- if (!switch_strlen_zero(menu->tts_engine) && !switch_strlen_zero(menu->tts_voice)) {
+ if (!zstr(menu->tts_engine) && !zstr(menu->tts_voice)) {
switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
}
status = SWITCH_STATUS_FALSE;
- if (!switch_strlen_zero(aptr)) {
+ if (!zstr(aptr)) {
app_name = switch_core_session_strdup(session, aptr);
if ((app_arg = strchr(app_name, ' '))) {
*app_arg++ = '\0';
if (stack->stack_count == 1) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "exit-sound '%s'\n", menu->exit_sound);
- if (!switch_strlen_zero(menu->exit_sound)) {
+ if (!zstr(menu->exit_sound)) {
status = play_and_collect(session, menu, menu->exit_sound, 0);
}
}
{
int i;
- if (!switch_strlen_zero(action_name)) {
+ if (!zstr(action_name)) {
for(i = 0;;i++) {
if (!iam[i].name) {
break;
{
int i;
- if (!switch_strlen_zero(action)) {
+ if (!zstr(action)) {
for(i = 0;;i++) {
if (!iam[i].name) {
break;
switch_ivr_menu_t *menu = NULL;
- if (switch_strlen_zero(max_timeouts)) {
+ if (zstr(max_timeouts)) {
max_timeouts = max_failures;
}
const char *digits = switch_xml_attr(xml_kvp, "digits");
const char *param = switch_xml_attr_soft(xml_kvp, "param");
- if (is_valid_action(action) && !switch_strlen_zero(digits)) {
+ if (is_valid_action(action) && !zstr(digits)) {
switch_ivr_menu_xml_map_t *xml_map = xml_menu_ctx->map;
int found = 0;
if (oglobals->monitor_early_media_fail) {
const char *var = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_fail");
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
char *fail_array[128] = {0};
int fail_count = 0;
char *fail_data = strdup(var);
if (oglobals->monitor_early_media_ring) {
const char *var = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_ring");
const char *var_total = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_ring_total");
- if (!switch_strlen_zero(var)) {
+ if (!zstr(var)) {
char *ring_array[128] = {0};
int ring_count = 0;
char *ring_data = strdup(var);
&& !switch_channel_test_flag(originate_status[i].peer_channel, CF_TAGGED)
) {
- if (!switch_strlen_zero(oglobals->key)) {
+ if (!zstr(oglobals->key)) {
struct key_collect *collect;
if (oglobals->cancel_timeout < 0) {
if ((collect = switch_core_session_alloc(originate_status[i].peer_session, sizeof(*collect)))) {
switch_channel_set_flag(originate_status[i].peer_channel, CF_TAGGED);
- if (!switch_strlen_zero(oglobals->key)) {
+ if (!zstr(oglobals->key)) {
collect->key = switch_core_session_strdup(originate_status[i].peer_session, oglobals->key);
}
- if (!switch_strlen_zero(oglobals->file)) {
+ if (!zstr(oglobals->file)) {
collect->file = switch_core_session_strdup(originate_status[i].peer_session, oglobals->file);
}
switch_channel_audio_sync(originate_status[i].peer_channel);
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
ringback_data = NULL;
- } else if (switch_strlen_zero(ringback_data)) {
+ } else if (zstr(ringback_data)) {
if ((var = switch_channel_get_variable(caller_channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE))) {
int sval = atoi(var);
data++;
}
- if (switch_strlen_zero(data)) {
+ if (zstr(data)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No origination URL specified!\n");
status = SWITCH_STATUS_GENERR;
goto done;
if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
ringback_data = NULL;
- } else if (switch_strlen_zero(ringback_data)) {
+ } else if (zstr(ringback_data)) {
const char *vvar;
if ((vvar = switch_channel_get_variable(caller_channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE))) {
switch_core_session_t *holding_session;
if (caller_channel) {
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
context = switch_channel_get_variable(caller_channel, "context");
}
- if (switch_strlen_zero(dialplan)) {
+ if (zstr(dialplan)) {
dialplan = switch_channel_get_variable(caller_channel, "dialplan");
}
}
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
context = "default";
}
- if (switch_strlen_zero(context)) {
+ if (zstr(context)) {
dialplan = "XML";
}
if (!my_tts_voice) {
my_tts_voice = tts_voice;
}
- if (switch_strlen_zero(tts_engine) || switch_strlen_zero(tts_voice)) {
+ if (zstr(tts_engine) || zstr(tts_voice)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TTS is not configured\n");
} else {
status = switch_ivr_speak_text(session, my_tts_engine, my_tts_voice, odata, args);
prefix = switch_channel_get_variable(channel, "sound_prefix");
timer_name = switch_channel_get_variable(channel, "timer_name");
- if (switch_strlen_zero(file) || !switch_channel_media_ready(channel)) {
+ if (zstr(file) || !switch_channel_media_ready(channel)) {
return SWITCH_STATUS_FALSE;
}
dup = switch_core_session_strdup(session, alt);
engine = dup;
- if (!switch_strlen_zero(engine)) {
+ if (!zstr(engine)) {
if ((voice = strchr(engine, ':'))) {
*voice++ = '\0';
- if (!switch_strlen_zero(voice) && (text = strchr(voice, ':'))) {
+ if (!zstr(voice) && (text = strchr(voice, ':'))) {
*text++ = '\0';
}
}
}
- if (!switch_strlen_zero(engine) && !switch_strlen_zero(voice) && !switch_strlen_zero(text)) {
+ if (!zstr(engine) && !zstr(voice) && !zstr(text)) {
if ((status = switch_ivr_speak_text(session, engine, voice, text, args)) != SWITCH_STATUS_SUCCESS) {
return status;
}
continue;
- } else if (!switch_strlen_zero(engine) && !(voice && text)) {
+ } else if (!zstr(engine) && !(voice && text)) {
text = engine;
engine = (char *) switch_channel_get_variable(channel, "tts_engine");
voice = (char *) switch_channel_get_variable(channel, "tts_voice");
args.buf = digit_buffer;
args.buflen = (uint32_t) digit_buffer_length;
- if (!switch_strlen_zero(prompt_audio_file) && strcasecmp(prompt_audio_file, "silence")) {
+ if (!zstr(prompt_audio_file) && strcasecmp(prompt_audio_file, "silence")) {
if ((status = switch_ivr_play_file(session, NULL, prompt_audio_file, &args)) == SWITCH_STATUS_BREAK) {
status = SWITCH_STATUS_SUCCESS;
}
*digit_buffer = '\0';
}
- if (var_name && !switch_strlen_zero(digit_buffer)) {
+ if (var_name && !zstr(digit_buffer)) {
switch_channel_set_variable(channel, var_name, digit_buffer);
}
}
if (status == SWITCH_STATUS_SUCCESS) {
- if (!switch_strlen_zero(digit_buffer)) {
- if (switch_strlen_zero(digits_regex)) {
+ if (!zstr(digit_buffer)) {
+ if (zstr(digits_regex)) {
return SWITCH_STATUS_SUCCESS;
}
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Test Regex [%s][%s]\n", digit_buffer, digits_regex);
moh = switch_channel_get_variable(other_channel, "hold_music");
}
- if (!switch_strlen_zero(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) {
+ if (!zstr(moh) && strcasecmp(moh, "silence") && !switch_channel_test_flag(other_channel, CF_BROADCAST)) {
switch_ivr_broadcast(other_uuid, moh, SMF_ECHO_ALEG | SMF_LOOP);
moh_br++;
}
moh = switch_channel_get_variable(channel, "hold_music");
}
- if (!switch_strlen_zero(moh) && strcasecmp(moh, "silence")) {
+ if (!zstr(moh) && strcasecmp(moh, "silence")) {
switch_ivr_play_file(session, NULL, moh, &args);
} else {
switch_ivr_collect_digits_callback(session, &args, 0, 0);
{
switch_status_t status;
- if (switch_strlen_zero(mod)) {
+ if (zstr(mod)) {
return SWITCH_STATUS_FALSE;
}
switch_bool_t global = SWITCH_FALSE;
const char *val = switch_xml_attr_soft(ld, "module");
const char *sglobal = switch_xml_attr_soft(ld, "global");
- if (switch_strlen_zero(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
+ if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
switch_bool_t global = SWITCH_FALSE;
const char *val = switch_xml_attr_soft(ld, "module");
const char *sglobal = switch_xml_attr_soft(ld, "global");
- if (switch_strlen_zero(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
+ if (zstr(val) || (strchr(val, '.') && !strstr(val, ext) && !strstr(val, EXT))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Invalid extension for %s\n", val);
continue;
}
continue;
}
- if (switch_strlen_zero(fname) || (!strstr(fname, ext) && !strstr(fname, EXT))) {
+ if (zstr(fname) || (!strstr(fname, ext) && !strstr(fname, EXT))) {
continue;
}
*newnode = *node;
- if (!switch_strlen_zero(node->data)) {
+ if (!zstr(node->data)) {
newnode->data = strdup(node->data);
switch_assert(node->data);
}
- if (!switch_strlen_zero(node->userdata)) {
+ if (!zstr(node->userdata)) {
newnode->userdata = strdup(node->userdata);
switch_assert(node->userdata);
}
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Log-Function", funcp);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Line", "%d", line);
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Log-Level", "%d", (int) level);
- if (!switch_strlen_zero(userdata)) {
+ if (!zstr(userdata)) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "User-Data", userdata);
}
switch_event_fire(&event);
node->content = content;
node->timestamp = now;
node->channel = channel;
- node->userdata = !switch_strlen_zero(userdata) ? strdup(userdata) : NULL;
+ node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
switch_log_node_free(&node);
if (UPNP_GetExternalIPAddress(nat_globals.urls.controlURL,
nat_globals.data.servicetype,
pub_addr) == UPNPCOMMAND_SUCCESS) {
- if (!strcmp(pub_addr, "0.0.0.0") || switch_strlen_zero_buf(pub_addr)) {
+ if (!strcmp(pub_addr, "0.0.0.0") || zstr_buf(pub_addr)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"uPNP Device (url: %s) returned an invalid external address of '%s'. Disabling uPNP\n", nat_globals.urls.controlURL, pub_addr);
return SWITCH_STATUS_GENERR;
if (stmt) {
err_str = switch_odbc_handle_get_error(handle, stmt);
- if (!switch_strlen_zero(err_str)) {
+ if (!zstr(err_str)) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
}
switch_safe_free(err_str);
*err = NULL;
- if (switch_strlen_zero(host) || !port) {
+ if (zstr(host) || !port) {
*err = "Address Error";
goto done;
}
SWITCH_DECLARE(char *) switch_rtp_get_remote_host(switch_rtp_t *rtp_session)
{
- return switch_strlen_zero(rtp_session->remote_host_str) ? "0.0.0.0" : rtp_session->remote_host_str;
+ return zstr(rtp_session->remote_host_str) ? "0.0.0.0" : rtp_session->remote_host_str;
}
SWITCH_DECLARE(switch_port_t) switch_rtp_get_remote_port(switch_rtp_t *rtp_session)
switch_rtp_set_interval(rtp_session, ms_per_packet, samples_per_interval);
rtp_session->conf_samples_per_interval = samples_per_interval;
- if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) && switch_strlen_zero(timer_name)) {
+ if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) && zstr(timer_name)) {
timer_name = "soft";
}
- if (!switch_strlen_zero(timer_name) && !strcasecmp(timer_name, "none")) {
+ if (!zstr(timer_name) && !strcasecmp(timer_name, "none")) {
timer_name = NULL;
}
- if (!switch_strlen_zero(timer_name)) {
+ if (!zstr(timer_name)) {
rtp_session->timer_name = switch_core_strdup(pool, timer_name);
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
{
switch_rtp_t *rtp_session = NULL;
- if (switch_strlen_zero(rx_host)) {
+ if (zstr(rx_host)) {
*err = "Missing local host";
goto end;
}
goto end;
}
- if (switch_strlen_zero(tx_host)) {
+ if (zstr(tx_host)) {
*err = "Missing remote host";
goto end;
}
const char *err;
uint32_t old = rtp_session->remote_port;
- if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
+ if (!zstr(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
"Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
switch_sockaddr_get_port(rtp_session->from_addr));
switch_mutex_lock(globals.task_mutex);
for (tp = globals.task_list; tp; tp = tp->next) {
- if (!switch_strlen_zero(group) && !strcmp(tp->task.group, group)) {
+ if (!zstr(group) && !strcmp(tp->task.group, group)) {
if (switch_test_flag(tp, SSHF_NO_DEL)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Attempt made to delete undeletable task #%u (group %s)\n",
tp->task.task_id, group);
switch_status_t status;
const char *err = NULL;
- if (switch_strlen_zero(path)) {
+ if (zstr(path)) {
path = NULL;
}
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;
}
timep = (thetime) / (int64_t) (1000000);
- if (!switch_strlen_zero(tz_name)) {
+ if (!zstr(tz_name)) {
tzdef = switch_lookup_timezone( tz_name );
} else {
/* We set the default timezone to GMT. */
timep = (thetime) / (int64_t) (1000000);
- if (!switch_strlen_zero(tz_name)) {
+ if (!zstr(tz_name)) {
tzdef = switch_lookup_timezone( tz_name );
} else {
/* We set the default timezone to GMT. */
if (tzdef) { /* The lookup of the zone may fail. */
tztime( &timep, tzdef, &tm );
tm2switchtime( &tm, &stm );
- switch_strftime_nocheck(date, &retsize, len, switch_strlen_zero(format) ? "%Y-%m-%d %T" : format, &stm);
- if (!switch_strlen_zero_buf(date)) {
+ switch_strftime_nocheck(date, &retsize, len, zstr(format) ? "%Y-%m-%d %T" : format, &stm);
+ if (!zstr_buf(date)) {
return SWITCH_STATUS_SUCCESS;
}
}
node->bits = bits;
node->str = switch_core_strdup(list->pool, cidr_str);
- if (!switch_strlen_zero(token)) {
+ if (!zstr(token)) {
node->token = switch_core_strdup(list->pool, token);
}
char *newfile = NULL;
switch_bool_t rval = SWITCH_FALSE;
- if (!switch_strlen_zero(file) && !switch_strlen_zero(convert_cmd) && !switch_strlen_zero(convert_ext)) {
+ if (!zstr(file) && !zstr(convert_cmd) && !zstr(convert_ext)) {
if ((ext = strrchr(file, '.'))) {
dupfile = strdup(file);
if ((ext = strrchr(dupfile, '.'))) {
close(ifd);
}
- if (switch_strlen_zero(from)) {
+ if (zstr(from)) {
from = "freeswitch";
}
SWITCH_DECLARE(switch_bool_t) switch_is_lan_addr(const char *ip)
{
- if (switch_strlen_zero(ip))
+ if (zstr(ip))
return SWITCH_FALSE;
return (strncmp(ip, "10.", 3) &&
char *o;
unsigned int tmp;
- if (switch_strlen_zero(s)) {
+ if (zstr(s)) {
return s;
}
const char *err = NULL;
err = switch_xml_error(xml);
- if (switch_strlen_zero(err)) {
+ if (zstr(err)) {
if ((conf = switch_xml_find_child(xml, "section", "name", "result"))) {
switch_xml_t p;
const char *aname;
*err = switch_xml_error(new_main);
switch_copy_string(not_so_threadsafe_error_buffer, *err, sizeof(not_so_threadsafe_error_buffer));
*err = not_so_threadsafe_error_buffer;
- if (!switch_strlen_zero(*err)) {
+ if (!zstr(*err)) {
switch_xml_free(new_main);
new_main = NULL;
errcnt++;
/* Perform validation */
if (value) {
- if (!switch_strlen_zero(string_options->validation_regex)) {
+ if (!zstr(string_options->validation_regex)) {
if (switch_regex_match(value, string_options->validation_regex) == SWITCH_STATUS_SUCCESS) {
newstring = value; /* Regex match, accept value*/
} else {