diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c
index 9bde6d33f0..d616beb263 100644
--- a/src/mod/endpoints/mod_sofia/sofia_presence.c
+++ b/src/mod/endpoints/mod_sofia/sofia_presence.c
@@ -697,40 +697,40 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
if (strcasecmp(answer_state, "resubscribe")) {
- if (!strcasecmp(state, "cs_hangup")) {
- astate = "terminated";
- } else if (switch_strlen_zero(astate)) {
- astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
- if (switch_strlen_zero(astate)) {
- astate = dft_state;
- }
- }
-
- if (!strcasecmp(event_status, "hold")) {
- astate = "early";
- }
-
- if (!strcasecmp(astate, "answered")) {
- astate = "confirmed";
- }
-
- if (!strcasecmp(astate, "ringing")) {
- if (!strcasecmp(direction, "recipient")) {
+ if (!strcasecmp(state, "cs_hangup")) {
+ astate = "terminated";
+ } else if (switch_strlen_zero(astate)) {
+ astate = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
+ if (switch_strlen_zero(astate)) {
+ astate = dft_state;
+ }
+ }
+
+ if (!strcasecmp(event_status, "hold")) {
astate = "early";
- } else {
+ }
+
+ if (!strcasecmp(astate, "answered")) {
astate = "confirmed";
}
- }
+
+ if (!strcasecmp(astate, "ringing")) {
+ if (!strcasecmp(direction, "recipient")) {
+ astate = "early";
+ } else {
+ astate = "confirmed";
+ }
+ }
stream.write_function(&stream, "\n");
-
}
stream.write_function(&stream, "\n");
@@ -773,7 +771,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char *
if (astate && uuid && helper->stream.data) {
stream.write_function(&helper->stream, "update sip_dialogs set state='%s' where uuid='%s';\n", astate, uuid);
}
-
} else {
pl = switch_mprintf("\r\n"
"