[Freeswitch-svn] [commit] r9288 - in freeswitch/trunk/src: . include
Freeswitch SVN
anthm at freeswitch.org
Wed Aug 13 17:46:07 EDT 2008
Author: anthm
Date: Wed Aug 13 17:46:06 2008
New Revision: 9288
Modified:
freeswitch/trunk/src/include/switch_caller.h
freeswitch/trunk/src/switch_caller.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
return channels to the execute state when hangup_after_bridge is false on a bridge started with the intercept app
Modified: freeswitch/trunk/src/include/switch_caller.h
==============================================================================
--- freeswitch/trunk/src/include/switch_caller.h (original)
+++ freeswitch/trunk/src/include/switch_caller.h Wed Aug 13 17:46:06 2008
@@ -142,6 +142,9 @@
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
_In_z_ const char *extension_name, _In_z_ const char *extension_number);
+SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig,
+ switch_memory_pool_t *pool);
+
/*!
\brief Add an application (instruction) to the given extension
\param session session associated with the extension (bound by scope)
Modified: freeswitch/trunk/src/switch_caller.c
==============================================================================
--- freeswitch/trunk/src/switch_caller.c (original)
+++ freeswitch/trunk/src/switch_caller.c Wed Aug 13 17:46:06 2008
@@ -282,6 +282,56 @@
switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "yes" : "no");
}
+SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig,
+ switch_memory_pool_t *pool)
+{
+ switch_caller_extension_t *caller_extension = NULL;
+ switch_caller_application_t *caller_application = NULL, *ap = NULL;
+
+ *new_ext = NULL;
+
+ if ((caller_extension = switch_core_alloc(pool, sizeof(switch_caller_extension_t))) != 0) {
+ int match = 0;
+
+ caller_extension->extension_name = switch_core_strdup(pool, orig->extension_name);
+ caller_extension->extension_number = switch_core_strdup(pool, orig->extension_number);
+
+ for(ap = orig->applications; ap; ap = ap->next) {
+
+ if (!match) {
+ if (ap == orig->current_application) {
+ match++;
+ } else {
+ continue;
+ }
+ }
+ caller_application = switch_core_alloc(pool, sizeof(switch_caller_application_t));
+
+ caller_application->application_name = switch_core_strdup(pool, ap->application_name);
+ caller_application->application_data = switch_core_strdup(pool, ap->application_data);
+
+ if (!caller_extension->applications) {
+ caller_extension->applications = caller_application;
+ } else if (caller_extension->last_application) {
+ caller_extension->last_application->next = caller_application;
+ }
+
+ caller_extension->last_application = caller_application;
+
+ if (ap == orig->current_application) {
+ caller_extension->current_application = caller_application;
+ }
+ }
+
+ *new_ext = caller_extension;
+
+ return SWITCH_STATUS_SUCCESS;
+ }
+
+
+ return SWITCH_STATUS_MEMERR;
+}
+
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, const char *extension_name,
const char *extension_number)
{
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Wed Aug 13 17:46:06 2008
@@ -1147,6 +1147,9 @@
caller_profile->times->progress_media = channel->caller_profile->times->progress_media;
caller_profile->times->created = channel->caller_profile->times->created;
caller_profile->times->hungup = channel->caller_profile->times->hungup;
+ if (channel->caller_profile->caller_extension) {
+ switch_caller_extension_clone(&caller_profile->caller_extension, channel->caller_profile->caller_extension, caller_profile->pool);
+ }
} else {
caller_profile->times->created = switch_timestamp_now();
}
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Wed Aug 13 17:46:06 2008
@@ -814,13 +814,19 @@
state = switch_channel_get_state(caller_channel);
if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !inner_bridge) {
- if ((state != CS_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
+ if ((state != CS_EXECUTE && state != CS_SOFT_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
(switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP &&
switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE)))) {
switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
}
}
+ state = switch_channel_get_state(caller_channel);
+
+ if (state == CS_SOFT_EXECUTE || state == CS_PARK) {
+ switch_channel_set_state(caller_channel, CS_EXECUTE);
+ }
+
return status;
}
More information about the Freeswitch-svn
mailing list