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

Freeswitch SVN anthm at freeswitch.org
Mon Aug 11 17:27:20 EDT 2008


Author: anthm
Date: Mon Aug 11 17:27:20 2008
New Revision: 9248

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/switch_core_session.c
   freeswitch/trunk/src/switch_ivr_originate.c

Log:
fix for MODAPP-122

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Mon Aug 11 17:27:20 2008
@@ -181,7 +181,9 @@
 typedef enum {
 	SOF_NONE = 0,
 	SOF_NOBLOCK = (1 << 0),
-	SOF_FORKED_DIAL = (1 << 1)
+	SOF_FORKED_DIAL = (1 << 1),
+	SOF_NO_EFFECTIVE_CID_NUM = (1 << 2),
+	SOF_NO_EFFECTIVE_CID_NAME = (1 << 3)
 } switch_originate_flag_enum_t;
 typedef uint32_t switch_originate_flag_t;
 

Modified: freeswitch/trunk/src/switch_core_session.c
==============================================================================
--- freeswitch/trunk/src/switch_core_session.c	(original)
+++ freeswitch/trunk/src/switch_core_session.c	Mon Aug 11 17:27:20 2008
@@ -270,9 +270,14 @@
 
 		if (caller_profile) {
 			const char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
+			
+			if (!(flags & SOF_NO_EFFECTIVE_CID_NAME)) {
+				ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name");
+			}
 
-			ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name");
-			ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number");
+			if (!(flags & SOF_NO_EFFECTIVE_CID_NUM)) {
+				ecaller_id_number = switch_channel_get_variable(channel, "effective_caller_id_number");
+			}
 
 			if (ecaller_id_name || ecaller_id_number) {
 				outgoing_profile = switch_caller_profile_clone(session, caller_profile);

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Mon Aug 11 17:27:20 2008
@@ -506,7 +506,7 @@
 													 const char *cid_num_override,
 													 switch_caller_profile_t *caller_profile_override, switch_originate_flag_t flags)
 {
-	switch_originate_flag_t myflags = SOF_NONE;
+	switch_originate_flag_t dftflags = SOF_NONE, myflags = dftflags;
 	char *pipe_names[MAX_PEERS] = { 0 };
 	char *data = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -538,6 +538,7 @@
 	uint8_t ring_ready = 0;
 	char *loop_data = NULL;
 	uint32_t progress_timelimit_sec = 0;
+	const char *cid_tmp;
 
 	*bleg = NULL;
 
@@ -742,18 +743,34 @@
 		}
 	}
 
+	if ((cid_tmp = switch_event_get_header(var_event, "origination_caller_id_name"))) {
+		cid_name_override = cid_tmp;
+	}
+
 	if (cid_name_override) {
 		switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_name", cid_name_override);
 	} else {
 		cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
 	}
 
+	if ((cid_tmp = switch_event_get_header(var_event, "origination_caller_id_number"))) {
+		cid_num_override = cid_tmp;
+	}
+
 	if (cid_num_override) {
 		switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_caller_id_number", cid_num_override);
 	} else {
 		cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
 	}
 
+	if (cid_num_override) {
+		dftflags |= SOF_NO_EFFECTIVE_CID_NUM;
+	}
+
+	if (cid_name_override) {
+		dftflags |= SOF_NO_EFFECTIVE_CID_NAME;
+	}
+
 	if (!progress_timelimit_sec) {
 		progress_timelimit_sec = timelimit_sec;
 	}
@@ -793,7 +810,8 @@
 			to = 0;
 			sent_ring = 0;
 			progress = 0;
-
+			myflags = dftflags;
+			
 			if (try > 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries, sleep_ms);
 				switch_yield(sleep_ms * 1000);
@@ -915,6 +933,7 @@
 						strncpy(tmp, var_begin, strlen(var_begin));
 					}
 					new_profile->caller_id_number = switch_core_strdup(new_profile->pool, tmp);
+					myflags |= SOF_NO_EFFECTIVE_CID_NUM;
 				}
 
 				if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) {
@@ -927,8 +946,10 @@
 						strncpy(tmp, var_begin, strlen(var_begin));
 					}
 					new_profile->caller_id_name = switch_core_strdup(new_profile->pool, tmp);
+					myflags |= SOF_NO_EFFECTIVE_CID_NAME;
 				}
 
+
 				if ((reason =
 					 switch_core_session_outgoing_channel(session, var_event, chan_type, new_profile, &new_session, &pool,
 														  myflags)) != SWITCH_CAUSE_SUCCESS) {



More information about the Freeswitch-svn mailing list