[Freeswitch-svn] [commit] r10468 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Wed Nov 19 14:24:17 PST 2008
Author: anthm
Date: Wed Nov 19 17:24:17 2008
New Revision: 10468
Log:
update
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_core_state_machine.c
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Nov 19 17:24:17 2008
@@ -122,6 +122,7 @@
#define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid"
#define SWITCH_API_BRIDGE_END_VARIABLE "api_after_bridge"
#define SWITCH_API_HANGUP_HOOK_VARIABLE "api_hangup_hook"
+#define SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE "session_in_hangup_hook"
#define SWITCH_PROCESS_CDR_VARIABLE "process_cdr"
#define SWITCH_BRIDGE_CHANNEL_VARIABLE "bridge_channel"
#define SWITCH_CHANNEL_NAME_VARIABLE "channel_name"
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 Wed Nov 19 17:24:17 2008
@@ -385,7 +385,8 @@
{
const char *var = switch_channel_get_variable(session->channel, SWITCH_PROCESS_CDR_VARIABLE);
const char *hook_var;
-
+ switch_core_session_t *use_session = NULL;
+
if (!switch_strlen_zero(var)) {
if (!strcasecmp(var, "a_only")) {
if (switch_channel_get_originator_caller_profile(session->channel)) {
@@ -401,21 +402,31 @@
}
STATE_MACRO(hangup, "HANGUP");
-
+
hook_var = switch_channel_get_variable(session->channel, SWITCH_API_HANGUP_HOOK_VARIABLE);
+ if (switch_true(switch_channel_get_variable(session->channel, SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE))) {
+ use_session = session;
+ }
if (!switch_strlen_zero(hook_var)) {
switch_stream_handle_t stream = { 0 };
char *cmd = switch_core_session_strdup(session, hook_var);
char *arg = NULL;
+ char *expanded = NULL;
+
if ((arg = strchr(cmd, ' '))) {
*arg++ = '\0';
}
SWITCH_STANDARD_STREAM(stream);
switch_channel_get_variables(session->channel, &stream.param_event);
- switch_api_execute(cmd, arg, session, &stream);
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, arg,
+ expanded = switch_channel_expand_variables(session->channel, arg);
+
+ switch_api_execute(cmd, expanded, use_session, &stream);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, expanded,
switch_str_nil((char *) stream.data));
+ if (expanded != arg) {
+ switch_safe_free(expanded);
+ }
switch_safe_free(stream.data);
}
}
More information about the Freeswitch-svn
mailing list