fix transfer

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6526 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-12-05 22:35:37 +00:00
parent 7cd8c8c07e
commit efe70a0857
2 changed files with 26 additions and 17 deletions

View File

@ -395,7 +395,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t *
\param dialplan the new dialplan (OPTIONAL, may be NULL) \param dialplan the new dialplan (OPTIONAL, may be NULL)
\param context the new context (OPTIONAL, may be NULL) \param context the new context (OPTIONAL, may be NULL)
*/ */
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, char *dialplan, char *context); SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan, const char *context);
/*! /*!
\brief Transfer an existing session to another location in the future \brief Transfer an existing session to another location in the future

View File

@ -846,7 +846,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
return status; return status;
} }
SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, char *dialplan, char *context) SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_t *session, const char *extension, const char *dialplan, const char *context)
{ {
switch_channel_t *channel; switch_channel_t *channel;
switch_caller_profile_t *profile, *new_profile; switch_caller_profile_t *profile, *new_profile;
@ -864,6 +864,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
/* clear all state handlers */ /* clear all state handlers */
switch_channel_clear_state_handler(channel, NULL); switch_channel_clear_state_handler(channel, NULL);
if ((profile = switch_channel_get_caller_profile(channel))) {
if (switch_strlen_zero(dialplan)) {
dialplan = profile->dialplan;
}
if (switch_strlen_zero(context)) {
context = profile->context;
}
if (switch_strlen_zero(dialplan)) { if (switch_strlen_zero(dialplan)) {
dialplan = "XML"; dialplan = "XML";
} }
@ -876,12 +886,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_session_transfer(switch_core_session_
extension = "service"; extension = "service";
} }
if ((profile = switch_channel_get_caller_profile(channel))) {
new_profile = switch_caller_profile_clone(session, profile); new_profile = switch_caller_profile_clone(session, profile);
new_profile->dialplan = switch_core_session_strdup(session, dialplan); new_profile->dialplan = switch_core_strdup(profile->pool, dialplan);
new_profile->context = switch_core_session_strdup(session, context); new_profile->context = switch_core_strdup(profile->pool, context);
new_profile->destination_number = switch_core_session_strdup(session, extension); new_profile->destination_number = switch_core_strdup(profile->pool, extension);
switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL); switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);