diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 5b272cd040..770ae67ce5 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1170,16 +1170,15 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi const char *var; const char *presence_data = switch_channel_get_variable(channel, "presence_data"); const char *presence_id = switch_channel_get_variable(channel, "presence_id"); - char *sql; if (presence_id || presence_data) { - sql = switch_mprintf("update sip_dialogs set presence_id='%q',presence_data='%q' " + char *sql = switch_mprintf("update sip_dialogs set presence_id='%q',presence_data='%q' " "where uuid='%s';\n", switch_str_nil(presence_id), switch_str_nil(presence_data), switch_core_session_get_uuid(session)); + switch_assert(sql); + sofia_glue_execute_sql(tech_pvt->profile, &sql, SWITCH_TRUE); } - switch_assert(sql); - sofia_glue_execute_sql(tech_pvt->profile, &sql, SWITCH_TRUE); if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {