[Freeswitch-svn] [commit] r9786 - in freeswitch/trunk/src: . include mod/applications/mod_dptools
Freeswitch SVN
anthm at freeswitch.org
Thu Oct 2 11:38:47 EDT 2008
Author: anthm
Date: Thu Oct 2 11:38:45 2008
New Revision: 9786
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_event.c
Log:
trim down some of the events because people don't like info these days
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Thu Oct 2 11:38:45 2008
@@ -776,7 +776,8 @@
CF_STOP_BROADCAST = (1 << 26),
CF_PROXY_MEDIA = (1 << 27),
CF_INNER_BRIDGE = (1 << 28),
- CF_REQ_MEDIA = (1 << 29)
+ CF_REQ_MEDIA = (1 << 29),
+ CF_VERBOSE_EVENTS = (1 << 30)
} switch_channel_flag_enum_t;
typedef uint32_t switch_channel_flag_t;
@@ -1026,7 +1027,8 @@
SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE - A channel has finshed executing a module's application
SWITCH_EVENT_CHANNEL_BRIDGE - A channel has bridged to another channel
SWITCH_EVENT_CHANNEL_UNBRIDGE - A channel has unbridged from another channel
- SWITCH_EVENT_CHANNEL_PROGRESS - A channel has been parked
+ SWITCH_EVENT_CHANNEL_PROGRESS - A channel has started ringing
+ SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA - A channel has started early media
SWITCH_EVENT_CHANNEL_OUTGOING - A channel has been unparked
SWITCH_EVENT_CHANNEL_PARK - A channel has been parked
SWITCH_EVENT_CHANNEL_UNPARK - A channel has been unparked
@@ -1083,6 +1085,7 @@
SWITCH_EVENT_CHANNEL_BRIDGE,
SWITCH_EVENT_CHANNEL_UNBRIDGE,
SWITCH_EVENT_CHANNEL_PROGRESS,
+ SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA,
SWITCH_EVENT_CHANNEL_OUTGOING,
SWITCH_EVENT_CHANNEL_PARK,
SWITCH_EVENT_CHANNEL_UNPARK,
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Thu Oct 2 11:38:45 2008
@@ -2144,6 +2144,11 @@
switch_ivr_unhold_uuid(switch_core_session_get_uuid(session));
}
+SWITCH_STANDARD_APP(verbose_events_function)
+{
+ switch_channel_set_flag(switch_core_session_get_channel(session), CF_VERBOSE_EVENTS);
+}
+
#define WAIT_FOR_SILENCE_SYNTAX "<silence_thresh> <silence_hits> <listen_hits> <timeout_ms> [<file>]"
SWITCH_STANDARD_APP(wait_for_silence_function)
{
@@ -2279,7 +2284,7 @@
SWITCH_ADD_CHAT(chat_interface, "event", event_chat_send);
SWITCH_ADD_CHAT(chat_interface, "api", api_chat_send);
-
+
SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>");
SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
@@ -2293,6 +2298,7 @@
SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list", "Check an ip against an ACL list", check_acl_function,
"<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA);
+ SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
SWITCH_ADD_APP(app_interface, "strftime", "strftime", "strftime", strftime_function, "[<epoch>|]<format string>", SAF_SUPPORT_NOMEDIA);
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Thu Oct 2 11:38:45 2008
@@ -1129,41 +1129,51 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
}
- /* Index Caller's Profile */
- if (caller_profile) {
- switch_caller_profile_event_set_data(caller_profile, "Caller", event);
- }
-
- if (originator_caller_profile && originatee_caller_profile) {
- /* Index Originator's Profile */
- switch_caller_profile_event_set_data(originator_caller_profile, "Originator", event);
-
- /* Index Originatee's Profile */
- switch_caller_profile_event_set_data(originatee_caller_profile, "Originatee", event);
- } else {
- /* Index Originator's Profile */
- if (originator_caller_profile) {
- switch_caller_profile_event_set_data(originator_caller_profile, "Other-Leg", event);
- } else if (originatee_caller_profile) { /* Index Originatee's Profile */
- switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event);
- }
- }
- x = 0;
- /* Index Variables */
- if (channel->variables) {
- for (hi = channel->variables->headers; hi; hi = hi->next) {
- char buf[1024];
- char *vvar = NULL, *vval = NULL;
-
- vvar = (char *) hi->name;
- vval = (char *) hi->value;
- x++;
-
- switch_assert(vvar && vval);
- switch_snprintf(buf, sizeof(buf), "variable_%s", vvar);
- switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval);
+ if (switch_test_flag(channel, CF_VERBOSE_EVENTS) ||
+ event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE ||
+ event->event_id == SWITCH_EVENT_CHANNEL_ANSWER ||
+ event->event_id == SWITCH_EVENT_CHANNEL_PROGRESS ||
+ event->event_id == SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA ||
+ event->event_id == SWITCH_EVENT_CHANNEL_HANGUP
+ ) {
+
+ /* Index Caller's Profile */
+ if (caller_profile) {
+ switch_caller_profile_event_set_data(caller_profile, "Caller", event);
+ }
+
+ if (originator_caller_profile && originatee_caller_profile) {
+ /* Index Originator's Profile */
+ switch_caller_profile_event_set_data(originator_caller_profile, "Originator", event);
+
+ /* Index Originatee's Profile */
+ switch_caller_profile_event_set_data(originatee_caller_profile, "Originatee", event);
+ } else {
+ /* Index Originator's Profile */
+ if (originator_caller_profile) {
+ switch_caller_profile_event_set_data(originator_caller_profile, "Other-Leg", event);
+ } else if (originatee_caller_profile) { /* Index Originatee's Profile */
+ switch_caller_profile_event_set_data(originatee_caller_profile, "Other-Leg", event);
+ }
+ }
+ x = 0;
+ /* Index Variables */
+ if (channel->variables) {
+ for (hi = channel->variables->headers; hi; hi = hi->next) {
+ char buf[1024];
+ char *vvar = NULL, *vval = NULL;
+
+ vvar = (char *) hi->name;
+ vval = (char *) hi->value;
+ x++;
+
+ switch_assert(vvar && vval);
+ switch_snprintf(buf, sizeof(buf), "variable_%s", vvar);
+ switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, vval);
+ }
}
}
+
switch_mutex_unlock(channel->profile_mutex);
}
@@ -1414,12 +1424,7 @@
channel->hangup_cause = hangup_cause;
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(channel->hangup_cause));
- switch_channel_event_set_data(channel, event);
- switch_event_fire(&event);
- }
-
+
switch_channel_set_variable(channel, "hangup_cause", switch_channel_cause2str(channel->hangup_cause));
switch_channel_presence(channel, "unavailable", switch_channel_cause2str(channel->hangup_cause), NULL);
@@ -1427,6 +1432,13 @@
switch_core_session_signal_state_change(channel->session);
switch_channel_set_timestamps(channel);
+
+ 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(channel->hangup_cause));
+ switch_channel_event_set_data(channel, event);
+ switch_event_fire(&event);
+ }
+
}
switch_mutex_unlock(channel->flag_mutex);
@@ -1437,6 +1449,7 @@
{
const char *var;
char *app;
+ switch_event_t *event;
if (!switch_channel_test_flag(channel, CF_RING_READY)) {
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
@@ -1447,6 +1460,11 @@
switch_mutex_unlock(channel->profile_mutex);
}
+ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) {
+ switch_channel_event_set_data(channel, event);
+ switch_event_fire(&event);
+ }
+
var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE);
if (var) {
char *arg = NULL;
@@ -1477,7 +1495,7 @@
switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Pre-Answer %s!\n", channel->name);
switch_channel_set_flag(channel, CF_EARLY_MEDIA);
switch_channel_set_variable(channel, "endpoint_disposition", "EARLY MEDIA");
- if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS) == SWITCH_STATUS_SUCCESS) {
+ if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(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 Thu Oct 2 11:38:45 2008
@@ -119,6 +119,7 @@
"CHANNEL_BRIDGE",
"CHANNEL_UNBRIDGE",
"CHANNEL_PROGRESS",
+ "CHANNEL_PROGRESS_MEDIA",
"CHANNEL_OUTGOING",
"CHANNEL_PARK",
"CHANNEL_UNPARK",
More information about the Freeswitch-svn
mailing list