[Freeswitch-svn] [commit] r5673 - freeswitch/trunk/src

Freeswitch SVN mikej at freeswitch.org
Tue Aug 28 17:55:30 EDT 2007


Author: mikej
Date: Tue Aug 28 17:55:30 2007
New Revision: 5673

Modified:
   freeswitch/trunk/src/switch_ivr_originate.c

Log:
simplify by using switch_caller_profile_clone and switch_caller_profile_dup.

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Tue Aug 28 17:55:30 2007
@@ -470,38 +470,18 @@
 					}
 
 					caller_caller_profile = caller_profile_override ? caller_profile_override : switch_channel_get_caller_profile(caller_channel);
+					new_profile = switch_caller_profile_clone(session, caller_caller_profile);
+					new_profile->destination_number = chan_data;
 
-					if (!cid_name_override) {
-						cid_name_override = caller_caller_profile->caller_id_name;
+					if (cid_name_override) {
+						new_profile->caller_id_name = cid_name_override;
 					}
-					if (!cid_num_override) {
-						cid_num_override = caller_caller_profile->caller_id_number;
+					if (cid_num_override) {
+						new_profile->caller_id_number = cid_num_override;
 					}
 
-					new_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
-															caller_caller_profile->username,
-															caller_caller_profile->dialplan,
-															cid_name_override,
-															cid_num_override,
-															caller_caller_profile->network_addr,
-															NULL,
-															NULL,
-															caller_caller_profile->rdnis,
-															caller_caller_profile->source, caller_caller_profile->context, chan_data);
-					new_profile->flags = caller_caller_profile->flags;
-					new_profile->caller_ton = caller_caller_profile->caller_ton;
-					new_profile->caller_numplan = caller_caller_profile->caller_numplan;
-					new_profile->destination_number_ton = caller_caller_profile->destination_number_ton;
-					new_profile->destination_number_numplan = caller_caller_profile->destination_number_numplan;
 					pool = NULL;
 				} else {
-					if (!cid_name_override) {
-						cid_name_override = "FreeSWITCH";
-					}
-					if (!cid_num_override) {
-						cid_num_override = "0000000000";
-					}
-
 					if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
 						status = SWITCH_STATUS_TERM;
@@ -509,21 +489,16 @@
 					}
 
 					if (caller_profile_override) {
-						new_profile = switch_caller_profile_new(pool,
-																 caller_profile_override->username,
-																 caller_profile_override->dialplan,
-																 caller_profile_override->caller_id_name,
-																 caller_profile_override->caller_id_number,
-																 caller_profile_override->network_addr,
-																 caller_profile_override->ani,
-																 caller_profile_override->aniii,
-																 caller_profile_override->rdnis,
-																 caller_profile_override->source, caller_profile_override->context, chan_data);
-						new_profile->caller_ton = caller_profile_override->caller_ton;
-						new_profile->caller_numplan = caller_profile_override->caller_numplan;
-						new_profile->destination_number_ton = caller_profile_override->destination_number_ton;
-						new_profile->destination_number_numplan = caller_profile_override->destination_number_numplan;
+						new_profile = switch_caller_profile_dup(pool, caller_profile_override);
+						new_profile->destination_number = chan_data;
 					} else {
+						if (!cid_name_override) {
+							cid_name_override = "FreeSWITCH";
+						}
+						if (!cid_num_override) {
+							cid_num_override = "0000000000";
+						}
+
 						new_profile = switch_caller_profile_new(pool,
 																 NULL,
 																 NULL,



More information about the Freeswitch-svn mailing list