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

@ -65,6 +65,7 @@ static const char *EVENT_NAMES[] = {
"CHANNEL_STATE",
"CHANNEL_ANSWER",
"CHANNEL_HANGUP",
"CHANNEL_HANGUP_COMPLETE",
"CHANNEL_EXECUTE",
"CHANNEL_EXECUTE_COMPLETE",
"CHANNEL_BRIDGE",

View File

@ -53,6 +53,7 @@ typedef enum {
ESL_EVENT_CHANNEL_STATE,
ESL_EVENT_CHANNEL_ANSWER,
ESL_EVENT_CHANNEL_HANGUP,
ESL_EVENT_CHANNEL_HANGUP_COMPLETE,
ESL_EVENT_CHANNEL_EXECUTE,
ESL_EVENT_CHANNEL_EXECUTE_COMPLETE,
ESL_EVENT_CHANNEL_BRIDGE,

View File

@ -1210,6 +1210,7 @@ typedef enum {
SWITCH_EVENT_CHANNEL_STATE,
SWITCH_EVENT_CHANNEL_ANSWER,
SWITCH_EVENT_CHANNEL_HANGUP,
SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE,
SWITCH_EVENT_CHANNEL_EXECUTE,
SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE,
SWITCH_EVENT_CHANNEL_BRIDGE,

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);
}

View File

@ -466,7 +466,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
switch_safe_free(stream.data);
}
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP) == SWITCH_STATUS_SUCCESS) {
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(cause));
switch_channel_event_set_data(session->channel, event);
switch_event_fire(&event);

View File

@ -119,6 +119,7 @@ static char *EVENT_NAMES[] = {
"CHANNEL_STATE",
"CHANNEL_ANSWER",
"CHANNEL_HANGUP",
"CHANNEL_HANGUP_COMPLETE",
"CHANNEL_EXECUTE",
"CHANNEL_EXECUTE_COMPLETE",
"CHANNEL_BRIDGE",