mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-28 22:24:16 +00:00
change switch_strlen_zero to zstr
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15211 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
1 parent
410b6ebd1f
commit
df7637f687
96 files changed
+1033
-1033
No files matched your search
@@ -88,7 +88,7 @@ static switch_status_t sofia_on_init(switch_core_session_t *session)
|
||||
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);
|
||||
@@ -185,17 +185,17 @@ char *generate_pai_str(switch_core_session_t *session)
|
||||
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);
|
||||
}
|
||||
@@ -312,7 +312,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||
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",
|
||||
@@ -389,8 +389,8 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||
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 {
|
||||
@@ -402,7 +402,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||
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 {
|
||||
@@ -413,7 +413,7 @@ switch_status_t sofia_on_hangup(switch_core_session_t *session)
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -488,7 +488,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
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());
|
||||
|
||||
@@ -577,7 +577,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
|
||||
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);
|
||||
@@ -1276,7 +1276,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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);
|
||||
|
||||
@@ -1286,37 +1286,37 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -1348,20 +1348,20 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -1375,7 +1375,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -1423,7 +1423,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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++;
|
||||
@@ -1442,9 +1442,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
}
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -1455,7 +1455,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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);
|
||||
@@ -1479,12 +1479,12 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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, ' '))) {
|
||||
@@ -1498,7 +1498,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
} 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)) {
|
||||
@@ -1509,11 +1509,11 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -1528,7 +1528,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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);
|
||||
@@ -1614,7 +1614,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
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);
|
||||
@@ -1795,7 +1795,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
||||
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));
|
||||
@@ -1832,7 +1832,7 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
||||
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);
|
||||
@@ -1848,8 +1848,8 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
||||
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) {
|
||||
@@ -1906,9 +1906,9 @@ static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t
|
||||
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);
|
||||
@@ -2019,7 +2019,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
||||
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));
|
||||
@@ -2059,7 +2059,7 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
||||
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));
|
||||
@@ -2068,8 +2068,8 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
||||
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");
|
||||
@@ -2127,9 +2127,9 @@ static switch_status_t cmd_xml_status(char **argv, int argc, switch_stream_handl
|
||||
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);
|
||||
@@ -2244,7 +2244,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
||||
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;
|
||||
}
|
||||
@@ -2344,7 +2344,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
||||
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;
|
||||
}
|
||||
@@ -2371,7 +2371,7 @@ static switch_status_t cmd_profile(char **argv, int argc, switch_stream_handle_t
|
||||
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;
|
||||
}
|
||||
@@ -2447,7 +2447,7 @@ static int contact_callback(void *pArg, int argc, char **argv, char **columnName
|
||||
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);
|
||||
}
|
||||
@@ -2545,11 +2545,11 @@ SWITCH_STANDARD_API(sofia_contact_function)
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -2583,7 +2583,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
|
||||
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;
|
||||
}
|
||||
@@ -2599,7 +2599,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -2647,7 +2647,7 @@ SWITCH_STANDARD_API(sofia_function)
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(cmd)) {
|
||||
if (zstr(cmd)) {
|
||||
stream->write_function(stream, "%s", usage_string);
|
||||
goto done;
|
||||
}
|
||||
@@ -2880,11 +2880,11 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -3115,7 +3115,7 @@ static int notify_callback(void *pArg, int argc, char **argv, char **columnNames
|
||||
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());
|
||||
|
||||
|
||||
@@ -3193,7 +3193,7 @@ static void general_event_handler(switch_event_t *event)
|
||||
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);
|
||||
@@ -3212,7 +3212,7 @@ static void general_event_handler(switch_event_t *event)
|
||||
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);
|
||||
@@ -3296,7 +3296,7 @@ static void general_event_handler(switch_event_t *event)
|
||||
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());
|
||||
|
||||
|
||||
@@ -3392,7 +3392,7 @@ static void general_event_handler(switch_event_t *event)
|
||||
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) {
|
||||
|
||||
@@ -818,7 +818,7 @@ void sofia_reg_release_gateway__(const char *file, const char *func, int line, s
|
||||
|
||||
#define check_decode(_var, _session) do { \
|
||||
assert(_session); \
|
||||
if (!switch_strlen_zero(_var)) { \
|
||||
if (!zstr(_var)) { \
|
||||
int d = 0; \
|
||||
char *p; \
|
||||
if (strchr(_var, '%')) { \
|
||||
|
||||
@@ -327,7 +327,7 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||
|
||||
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);
|
||||
|
||||
@@ -338,9 +338,9 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status,
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -384,19 +384,19 @@ void sofia_send_callee_id(switch_core_session_t *session, const char *name, cons
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -449,7 +449,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro
|
||||
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;
|
||||
@@ -539,7 +539,7 @@ void sofia_event_callback(nua_event_t event,
|
||||
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);
|
||||
@@ -553,7 +553,7 @@ void sofia_event_callback(nua_event_t event,
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1381,7 +1381,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
||||
char *name = (char *) switch_xml_attr_soft(gateway_tag, "name");
|
||||
sofia_gateway_t *gateway;
|
||||
|
||||
if (switch_strlen_zero(name)) {
|
||||
if (zstr(name)) {
|
||||
name = "anonymous";
|
||||
}
|
||||
|
||||
@@ -1545,33 +1545,33 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1580,11 +1580,11 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
||||
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 {
|
||||
@@ -1592,7 +1592,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -1631,13 +1631,13 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag)
|
||||
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;
|
||||
|
||||
@@ -2157,7 +2157,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
||||
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) {
|
||||
@@ -2180,7 +2180,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
|
||||
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);
|
||||
@@ -2236,7 +2236,7 @@ switch_status_t config_sofia(int reload, char *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);
|
||||
@@ -2342,7 +2342,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||
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, ':'))) {
|
||||
@@ -2467,7 +2467,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||
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")) {
|
||||
@@ -2501,7 +2501,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||
}
|
||||
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;
|
||||
@@ -3007,7 +3007,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||
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) {
|
||||
@@ -3030,7 +3030,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
|
||||
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);
|
||||
@@ -3083,7 +3083,7 @@ static void sofia_handle_sip_r_options(switch_core_session_t *session, int statu
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -3526,7 +3526,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
|
||||
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 {
|
||||
@@ -4369,7 +4369,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
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 {
|
||||
@@ -4429,11 +4429,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4477,7 +4477,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
port = refer_to->r_url->url_port;
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(port)) {
|
||||
if (zstr(port)) {
|
||||
port = "5060";
|
||||
}
|
||||
|
||||
@@ -4517,11 +4517,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4564,10 +4564,10 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -4688,7 +4688,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
}
|
||||
|
||||
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());
|
||||
@@ -4697,7 +4697,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -4810,16 +4810,16 @@ const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -4926,7 +4926,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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))) {
|
||||
@@ -4992,7 +4992,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
"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))) {
|
||||
@@ -5139,7 +5139,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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 {
|
||||
@@ -5156,10 +5156,10 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5167,12 +5167,12 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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");
|
||||
@@ -5182,11 +5182,11 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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");
|
||||
@@ -5196,12 +5196,12 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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");
|
||||
@@ -5346,7 +5346,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
|
||||
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 {
|
||||
@@ -5383,7 +5383,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -5590,7 +5590,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
|
||||
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")) {
|
||||
@@ -5603,7 +5603,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
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);
|
||||
@@ -5615,7 +5615,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_
|
||||
} 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(;;) {
|
||||
@@ -5768,24 +5768,24 @@ void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
||||
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) {
|
||||
@@ -276,7 +276,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
|
||||
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
|
||||
@@ -571,7 +571,7 @@ switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -632,7 +632,7 @@ const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name)
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -670,7 +670,7 @@ switch_status_t sofia_glue_tech_choose_port(private_object_t *tech_pvt, int forc
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -738,7 +738,7 @@ switch_status_t sofia_glue_tech_choose_video_port(private_object_t *tech_pvt, in
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,7 @@ switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1137,7 +1137,7 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
|
||||
char *new_sdp;
|
||||
int bad = 0;
|
||||
|
||||
if (switch_strlen_zero(tech_pvt->local_sdp_str)) {
|
||||
if (zstr(tech_pvt->local_sdp_str)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1148,7 +1148,7 @@ void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
|
||||
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;
|
||||
@@ -1360,7 +1360,7 @@ char* sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix
|
||||
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);
|
||||
@@ -1380,7 +1380,7 @@ void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, c
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -1448,7 +1448,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
format,
|
||||
cid_name,
|
||||
cid_num,
|
||||
!switch_strlen_zero(cid_num) ? "@" : "",
|
||||
!zstr(cid_num) ? "@" : "",
|
||||
sipip);
|
||||
}
|
||||
|
||||
@@ -1482,7 +1482,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
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;
|
||||
}
|
||||
@@ -1501,15 +1501,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
} 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);
|
||||
}
|
||||
|
||||
@@ -1529,7 +1529,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
* 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);
|
||||
@@ -1553,7 +1553,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
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;
|
||||
@@ -1740,7 +1740,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
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) {
|
||||
@@ -1766,17 +1766,17 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
|
||||
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),
|
||||
@@ -1828,7 +1828,7 @@ void sofia_glue_do_xfer_invite(switch_core_session_t *session)
|
||||
|
||||
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),
|
||||
@@ -2606,7 +2606,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *cod
|
||||
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);
|
||||
@@ -2622,7 +2622,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *cod
|
||||
}
|
||||
|
||||
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
|
||||
if (switch_strlen_zero(attr->a_name)) {
|
||||
if (zstr(attr->a_name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2638,7 +2638,7 @@ void sofia_glue_set_r_sdp_codec_string(switch_channel_t *channel,const char *cod
|
||||
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) {
|
||||
@@ -2744,7 +2744,7 @@ switch_status_t sofia_glue_tech_media(private_object_t *tech_pvt, const char *r_
|
||||
switch_assert(tech_pvt != NULL);
|
||||
switch_assert(r_sdp != NULL);
|
||||
|
||||
if (switch_strlen_zero(r_sdp)) {
|
||||
if (zstr(r_sdp)) {
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
@@ -2903,7 +2903,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
}
|
||||
|
||||
for (attr = sdp->sdp_attributes; attr; attr = attr->a_next) {
|
||||
if (switch_strlen_zero(attr->a_name)) {
|
||||
if (zstr(attr->a_name)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2975,7 +2975,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
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) {
|
||||
@@ -3030,7 +3030,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
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);
|
||||
@@ -3075,7 +3075,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -3160,7 +3160,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
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;
|
||||
@@ -3226,7 +3226,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
|
||||
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 {
|
||||
@@ -3994,7 +3994,7 @@ void sofia_glue_actually_execute_sql(sofia_profile_t *profile, switch_bool_t mas
|
||||
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);
|
||||
@@ -4225,7 +4225,7 @@ sofia_destination_t* sofia_glue_get_destination(char *data)
|
||||
char *eoc = NULL;
|
||||
char *p = NULL;
|
||||
|
||||
if (switch_strlen_zero(data)) {
|
||||
if (zstr(data)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!switch_strlen_zero(type)) {
|
||||
if (!zstr(type)) {
|
||||
ct = type;
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(host)) {
|
||||
if (zstr(host)) {
|
||||
host = profile->domain_name;
|
||||
if (switch_strlen_zero(host)) {
|
||||
if (zstr(host)) {
|
||||
host = prof;
|
||||
}
|
||||
}
|
||||
@@ -123,9 +123,9 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co
|
||||
*p++ = '\0';
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(p)) {
|
||||
if (zstr(p)) {
|
||||
p = profile->domain_name;
|
||||
if (switch_strlen_zero(p)) {
|
||||
if (zstr(p)) {
|
||||
p = host;
|
||||
}
|
||||
}
|
||||
@@ -463,11 +463,11 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||
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";
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||
|
||||
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;
|
||||
@@ -638,7 +638,7 @@ static void actual_sofia_presence_event_handler(switch_event_t *event)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -839,13 +839,13 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -863,11 +863,11 @@ static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char
|
||||
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");
|
||||
@@ -1004,7 +1004,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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];
|
||||
}
|
||||
@@ -1012,11 +1012,11 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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")) {
|
||||
@@ -1135,9 +1135,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
|
||||
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 {
|
||||
@@ -1171,7 +1171,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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",
|
||||
@@ -1183,7 +1183,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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);
|
||||
@@ -1191,7 +1191,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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);
|
||||
@@ -1214,7 +1214,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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));
|
||||
@@ -1231,15 +1231,15 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
|
||||
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));
|
||||
@@ -1450,10 +1450,10 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
|
||||
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\"";
|
||||
}
|
||||
}
|
||||
@@ -1481,7 +1481,7 @@ void sofia_presence_handle_sip_i_subscribe(int status,
|
||||
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))) {
|
||||
@@ -1922,12 +1922,12 @@ void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, n
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ void sofia_reg_expire_call_id(sofia_profile_t *profile, const char *call_id, int
|
||||
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);
|
||||
@@ -822,10 +822,10 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(display)) {
|
||||
if (zstr(display)) {
|
||||
if (to) {
|
||||
display = to->a_display;
|
||||
if (switch_strlen_zero(display)) {
|
||||
if (zstr(display)) {
|
||||
display = "\"user\"";
|
||||
}
|
||||
}
|
||||
@@ -991,7 +991,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand
|
||||
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;
|
||||
@@ -1320,7 +1320,7 @@ void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_h
|
||||
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))) {
|
||||
@@ -1649,14 +1649,14 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
|
||||
/* 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);
|
||||
@@ -1726,13 +1726,13 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
}
|
||||
|
||||
|
||||
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"
|
||||
@@ -1751,7 +1751,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
}
|
||||
|
||||
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");
|
||||
@@ -1854,7 +1854,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
}
|
||||
}
|
||||
|
||||
if (switch_strlen_zero(passwd) && switch_strlen_zero(a1_hash)) {
|
||||
if (zstr(passwd) && zstr(a1_hash)) {
|
||||
ret = AUTH_OK;
|
||||
goto skip_auth;
|
||||
}
|
||||
@@ -1973,7 +1973,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
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);
|
||||
@@ -1989,7 +1989,7 @@ auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
|
||||
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";
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user