diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index af79f4b683..1808d92892 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -14531,7 +14531,8 @@ static void state_notify_build_xml(struct state_notify_data *data, int full, con
else
ast_str_append(tmp, 0, "%s\n", (local_state != NOTIFY_CLOSED) ? "open" : "closed");
- if (allow_notify_user_presence(p) && (data->presence_state > 0)) {
+ if (allow_notify_user_presence(p) && (data->presence_state != AST_PRESENCE_INVALID)
+ && (data->presence_state != AST_PRESENCE_NOT_SET)) {
ast_str_append(tmp, 0, "\n");
ast_str_append(tmp, 0, "\n");
ast_str_append(tmp, 0, "\n");