[Freeswitch-svn] [commit] r9170 - in freeswitch/trunk/src: . mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Thu Jul 24 12:31:47 EDT 2008


Author: anthm
Date: Thu Jul 24 12:31:47 2008
New Revision: 9170

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/switch_ivr_bridge.c

Log:
more workarounds for cisco the leader in communication

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Thu Jul 24 12:31:47 2008
@@ -1956,6 +1956,14 @@
 
 		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
 
+		if ((status == 180 || status == 183 || status == 200)) { 
+			if (sip->sip_user_agent && sip->sip_user_agent->g_string) {
+				switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
+			} else if (sip->sip_server && sip->sip_server->g_string) {
+				switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
+			}
+		}
+
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 
 			if (!switch_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
@@ -2137,14 +2145,6 @@
 		status = 180;
 	}
 
-	if (sip && channel && (status == 180 || status == 183 || status == 200) && switch_channel_test_flag(channel, CF_OUTBOUND)) { 
-		if (sip->sip_user_agent && sip->sip_user_agent->g_string) {
-			switch_channel_set_variable(channel, "sip_user_agent", sip->sip_user_agent->g_string);
-		} else if (sip->sip_server && sip->sip_server->g_string) {
-			switch_channel_set_variable(channel, "sip_user_agent", sip->sip_server->g_string);
-		}
-	}
-
 	if (channel && (status == 180 || status == 183) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		const char *val;
 		if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) {
@@ -3686,7 +3686,6 @@
 		}
 	}
 }
-
 /*
  * This subroutine will take the a_params of a sip_addr_s structure and spin through them.
  * Each param will be used to create a channel variable.

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Thu Jul 24 12:31:47 2008
@@ -495,7 +495,12 @@
 			}
 
 			if (!ready_b) {
-				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				const char *cid = switch_channel_get_variable(other_channel, "rdnis");
+				if (ready_a && cid) {
+					switch_ivr_session_transfer(session, cid, NULL, NULL);
+				} else {
+					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+				}
 			}
 			switch_core_session_rwunlock(other_session);
 			return SWITCH_STATUS_FALSE;
@@ -825,6 +830,7 @@
 	switch_channel_t *originator_channel, *originatee_channel, *swap_channel;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_caller_profile_t *cp, *originator_cp, *originatee_cp;
+	char *p;
 
 	if ((originator_session = switch_core_session_locate(originator_uuid))) {
 		if ((originatee_session = switch_core_session_locate(originatee_uuid))) {
@@ -895,6 +901,10 @@
 			cp->destination_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
 			cp->caller_id_number = switch_core_strdup(cp->pool, originator_cp->caller_id_number);
 			cp->caller_id_name = switch_core_strdup(cp->pool, originator_cp->caller_id_name);
+			cp->rdnis = switch_core_strdup(cp->pool, originatee_cp->destination_number);
+			if ((p = strchr(cp->rdnis, '@'))) {
+				*p = '\0';
+			}
 			switch_channel_set_caller_profile(originatee_channel, cp);
 			switch_channel_set_originator_caller_profile(originatee_channel, switch_caller_profile_clone(originatee_session, originator_cp));
 
@@ -902,6 +912,10 @@
 			cp->destination_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
 			cp->caller_id_number = switch_core_strdup(cp->pool, originatee_cp->caller_id_number);
 			cp->caller_id_name = switch_core_strdup(cp->pool, originatee_cp->caller_id_name);
+			cp->rdnis = switch_core_strdup(cp->pool, originator_cp->destination_number);
+			if ((p = strchr(cp->rdnis, '@'))) {
+				*p = '\0';
+			}
 			switch_channel_set_caller_profile(originator_channel, cp);
 			switch_channel_set_originatee_caller_profile(originator_channel, switch_caller_profile_clone(originator_session, originatee_cp));
 



More information about the Freeswitch-svn mailing list