diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 36ce888307..95e31af131 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -74,7 +74,10 @@ SWITCH_DECLARE(int) switch_isxdigit(int c); \param s the string to test \return true value if the string is NULL or zero length */ -#define zstr(s) (!s || *(s) == '\0') +static inline int zstr(const char *s) { + return (!s || *(s) == '\0'); +} + #define zstr_buf(s) (*(s) == '\0') static inline switch_bool_t switch_is_moh(const char *s) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9bd58bb845..055010a1ad 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -467,21 +467,21 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro } } - if ((tmp = switch_channel_get_variable(channel, "effective_callee_id_name")) || + if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_name")) || (tmp = switch_channel_get_variable(channel, "sip_callee_id_name")) || - (tmp = switch_channel_get_variable(channel, "callee_id_name"))) { + (tmp = switch_channel_get_variable(channel, "callee_id_name"))) && !zstr(tmp)) { name = (char *)tmp; } - if ((tmp = switch_channel_get_variable(channel, "effective_callee_id_number")) || + if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_number")) || (tmp = switch_channel_get_variable(channel, "sip_callee_id_number")) || - (tmp = switch_channel_get_variable(channel, "callee_id_number"))) { + (tmp = switch_channel_get_variable(channel, "callee_id_number"))) && !zstr(tmp)) { number = tmp; } if (zstr(name)) name = (char *) number; - if (zstr(name) || zstr(number)) { + if (zstr(name) && zstr(number)) { goto end; } @@ -507,7 +507,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro sofia_send_callee_id(session, NULL, NULL); } - end: + end: switch_safe_free(dup); }