diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 0bb119f8d3..1a949044da 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2487,9 +2487,12 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * "\n", version, default_dialog, clean_id); - } + if (!strcasecmp(astate, "hangup")) { + astate = "terminated"; + } + if (!zstr(uuid)) { if (!zstr(answer_state)) { astate = answer_state; @@ -2507,9 +2510,6 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * astate = "confirmed"; } - if (!strcasecmp(astate, "hangup")) { - astate = "terminated"; - } if (is_dialog) { @@ -2629,7 +2629,7 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * if (in) { open = "open"; - if (switch_false(resub)) { + if (!strcasecmp(astate, "terminated") && switch_false(resub)) { int term; const char *direction = switch_event_get_header(helper->event, "Caller-Direction");