[Freeswitch-svn] [commit] r6526 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Wed Dec 5 17:35:37 EST 2007


Author: anthm
Date: Wed Dec  5 17:35:37 2007
New Revision: 6526

Modified:
   freeswitch/trunk/src/include/switch_ivr.h
   freeswitch/trunk/src/switch_ivr.c

Log:
fix transfer

Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h	(original)
+++ freeswitch/trunk/src/include/switch_ivr.h	Wed Dec  5 17:35:37 2007
@@ -395,7 +395,7 @@
   \param dialplan the new dialplan (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

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Wed Dec  5 17:35:37 2007
@@ -846,7 +846,7 @@
 	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_caller_profile_t *profile, *new_profile;
@@ -864,24 +864,33 @@
 	/* clear all state handlers */
 	switch_channel_clear_state_handler(channel, NULL);
 
-	if (switch_strlen_zero(dialplan)) {
-		dialplan = "XML";
-	}
+	if ((profile = switch_channel_get_caller_profile(channel))) {
+
+		if (switch_strlen_zero(dialplan)) {
+			dialplan = profile->dialplan;
+		}
 	
-	if (switch_strlen_zero(context)) {
-		context = "default";
-	}
+		if (switch_strlen_zero(context)) {
+			context = profile->context;
+		}
 
-	if (switch_strlen_zero(extension)) {
-		extension = "service";
-	}
+		if (switch_strlen_zero(dialplan)) {
+			dialplan = "XML";
+		}
 	
-	if ((profile = switch_channel_get_caller_profile(channel))) {
+		if (switch_strlen_zero(context)) {
+			context = "default";
+		}
+
+		if (switch_strlen_zero(extension)) {
+			extension = "service";
+		}
+		
 		new_profile = switch_caller_profile_clone(session, profile);
 
-		new_profile->dialplan = switch_core_session_strdup(session, dialplan);
-		new_profile->context = switch_core_session_strdup(session, context);
-		new_profile->destination_number = switch_core_session_strdup(session, extension);
+		new_profile->dialplan = switch_core_strdup(profile->pool, dialplan);
+		new_profile->context = switch_core_strdup(profile->pool, context);
+		new_profile->destination_number = switch_core_strdup(profile->pool, extension);
 
 		switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, NULL);
 



More information about the Freeswitch-svn mailing list