add CHANNEL_HANGUP_COMPLETE event to take the place of CHANNEL_HANGUP, CHANNEL_HANGUP now fires as soon as the channel is hungup but you must wait for CHANNEL_HANGUP_COMPLETE for the CDR data

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13505 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2009-05-29 17:18:03 +00:00
parent 9d7ee8befd
commit c4b67d93fc
6 changed files with 12 additions and 1 deletions

View File

@@ -1648,6 +1648,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
if (channel->state < CS_HANGUP) {
switch_channel_state_t last_state = channel->state;
switch_event_t *event;
switch_mutex_lock(channel->state_mutex);
channel->state = CS_HANGUP;
@@ -1657,6 +1658,12 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Hangup %s [%s] [%s]\n",
channel->name, state_names[last_state], switch_channel_cause2str(channel->hangup_cause));
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(hangup_cause));
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
switch_core_session_kill_channel(channel->session, SWITCH_SIG_KILL);
switch_core_session_signal_state_change(channel->session);
}