switch_stream_handle_t stream = { 0 };
const char *direction = switch_str_nil(switch_event_get_header(helper->event, "presence-call-direction"));
const char *uuid = switch_str_nil(switch_event_get_header(helper->event, "unique-id"));
- const char *state = switch_str_nil(switch_event_get_header(helper->event, "channel-state"));
const char *event_status = switch_str_nil(switch_event_get_header(helper->event, "status"));
const char *astate = switch_str_nil(switch_event_get_header(helper->event, "astate"));
const char *answer_state = switch_str_nil(switch_event_get_header(helper->event, "answer-state"));
dft_state = "confirmed";
}
- if (!strcasecmp(state, "cs_reporting")) {
- goto end;
- }
-
-
if (is_dialog) {
stream.write_function(&stream,
"<?xml version=\"1.0\"?>\n"
}
if (direction) {
- what = !strcasecmp(direction, "outbound") ? "Call" : "Ring";
+ what = strcasecmp(direction, "outbound") ? "Call" : "Ring";
}
if (!strcmp(astate, "early")) {
exp_delta = (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
exp = (long) switch_epoch_time_now(NULL) + exp_delta;
+
if ((sql =
switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "
" and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) {
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
}
-
+
if ((sql =
switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent,"
" profile_name, hostname, open_closed) "
"values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')",
from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname, open_closed))) {
-
+
sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
}
+
event_type = sip_header_as_string(profile->home, (void *) sip->sip_event);
switch_channel_clear_flag(channel, CF_TAGGED);
- if (channel->state >= CS_ROUTING && channel->state <= CS_HANGUP) {
+ if (channel->state == CS_ROUTING || channel->state == CS_HANGUP) {
switch_channel_presence(channel, "unknown", (const char *) state_names[state], NULL);
}
switch_core_session_execute_application(channel->session, app, arg);
}
-
return SWITCH_STATUS_SUCCESS;
}
switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK);
switch_core_session_rwunlock(other_session);
}
+
return SWITCH_STATUS_SUCCESS;
}