[Freeswitch-svn] [commit] r13505 - in freeswitch/trunk: libs/esl/src libs/esl/src/include src src/include
FreeSWITCH SVN
anthm at freeswitch.org
Fri May 29 10:18:03 PDT 2009
Author: anthm
Date: Fri May 29 12:18:03 2009
New Revision: 13505
Log:
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
Modified:
freeswitch/trunk/libs/esl/src/esl_event.c
freeswitch/trunk/libs/esl/src/include/esl_event.h
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_core_state_machine.c
freeswitch/trunk/src/switch_event.c
Modified: freeswitch/trunk/libs/esl/src/esl_event.c
==============================================================================
--- freeswitch/trunk/libs/esl/src/esl_event.c (original)
+++ freeswitch/trunk/libs/esl/src/esl_event.c Fri May 29 12:18:03 2009
@@ -65,6 +65,7 @@
"CHANNEL_STATE",
"CHANNEL_ANSWER",
"CHANNEL_HANGUP",
+ "CHANNEL_HANGUP_COMPLETE",
"CHANNEL_EXECUTE",
"CHANNEL_EXECUTE_COMPLETE",
"CHANNEL_BRIDGE",
Modified: freeswitch/trunk/libs/esl/src/include/esl_event.h
==============================================================================
--- freeswitch/trunk/libs/esl/src/include/esl_event.h (original)
+++ freeswitch/trunk/libs/esl/src/include/esl_event.h Fri May 29 12:18:03 2009
@@ -53,6 +53,7 @@
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,
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Fri May 29 12:18:03 2009
@@ -1210,6 +1210,7 @@
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,
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Fri May 29 12:18:03 2009
@@ -1648,6 +1648,7 @@
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_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);
}
Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c (original)
+++ freeswitch/trunk/src/switch_core_state_machine.c Fri May 29 12:18:03 2009
@@ -466,7 +466,7 @@
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);
Modified: freeswitch/trunk/src/switch_event.c
==============================================================================
--- freeswitch/trunk/src/switch_event.c (original)
+++ freeswitch/trunk/src/switch_event.c Fri May 29 12:18:03 2009
@@ -119,6 +119,7 @@
"CHANNEL_STATE",
"CHANNEL_ANSWER",
"CHANNEL_HANGUP",
+ "CHANNEL_HANGUP_COMPLETE",
"CHANNEL_EXECUTE",
"CHANNEL_EXECUTE_COMPLETE",
"CHANNEL_BRIDGE",
More information about the Freeswitch-svn
mailing list