[Freeswitch-svn] [commit] r3599 - in freeswitch/branches/knhor/trunk: . conf src src/mod/endpoints/mod_sofia src/mod/xml_int/mod_xml_curl src/mod/xml_int/mod_xml_rpc

Freeswitch SVN knhor at freeswitch.org
Sun Dec 10 16:11:01 EST 2006


Author: knhor
Date: Sun Dec 10 16:11:00 2006
New Revision: 3599

Added:
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/
      - copied from r3593, /freeswitch/trunk/src/mod/xml_int/mod_xml_curl/
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/Makefile
      - copied unchanged from r3593, /freeswitch/trunk/src/mod/xml_int/mod_xml_curl/Makefile
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
      - copied unchanged from r3593, /freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj
      - copied unchanged from r3593, /freeswitch/trunk/src/mod/xml_int/mod_xml_curl/mod_xml_curl.vcproj
Modified:
   freeswitch/branches/knhor/trunk/   (props changed)
   freeswitch/branches/knhor/trunk/Freeswitch.sln
   freeswitch/branches/knhor/trunk/conf/freeswitch.xml
   freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/Makefile
   freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
   freeswitch/branches/knhor/trunk/src/switch_ivr.c

Log:
Merged revisions 3588-3598 via svnmerge trunk


Modified: freeswitch/branches/knhor/trunk/Freeswitch.sln
==============================================================================
--- freeswitch/branches/knhor/trunk/Freeswitch.sln	(original)
+++ freeswitch/branches/knhor/trunk/Freeswitch.sln	Sun Dec 10 16:11:00 2006
@@ -273,7 +273,6 @@
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_rpc", "src\mod\xml_int\mod_xml_rpc\mod_xml_rpc.vcproj", "{CBEC7225-0C21-4DA8-978E-1F158F8AD950}"
 	ProjectSection(ProjectDependencies) = postProject
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
 		{101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED}
 		{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
@@ -282,6 +281,7 @@
 		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
 		{A3FE0076-B366-429D-A238-D7304DA7D3C1} = {A3FE0076-B366-429D-A238-D7304DA7D3C1}
 		{356EC96D-4C9F-47B5-9083-FC328B87BA94} = {356EC96D-4C9F-47B5-9083-FC328B87BA94}
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_rss", "src\mod\applications\mod_rss\mod_rss.vcproj", "{B69247FA-ECD6-40ED-8E44-5CA6C3BAF9A4}"
@@ -616,6 +616,16 @@
 		{7E60CC2D-E818-4712-8F16-C0E6EC64982F} = {7E60CC2D-E818-4712-8F16-C0E6EC64982F}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_xml_curl", "src\mod\xml_int\mod_xml_curl\mod_xml_curl.vcproj", "{AB91A099-7690-4ECF-8994-E458F4EA1ED4}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}
+		{87EE9DA4-DE1E-4448-8324-183C98DCA588} = {87EE9DA4-DE1E-4448-8324-183C98DCA588}
+		{101130D1-3EA6-4ED2-B65D-CEB5243A20ED} = {101130D1-3EA6-4ED2-B65D-CEB5243A20ED}
+		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
+		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {F057DA7F-79E5-4B00-845C-EF446EF055E3}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
@@ -1006,6 +1016,10 @@
 		{7E60CC2D-E818-4712-8F16-C0E6EC64982F}.Release|Win32.ActiveCfg = Release|Win32
 		{DEB84241-385F-471F-A6B6-0C93FBB3B03D}.Debug|Win32.ActiveCfg = Debug|Win32
 		{DEB84241-385F-471F-A6B6-0C93FBB3B03D}.Release|Win32.ActiveCfg = Release|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.ActiveCfg = Debug|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Debug|Win32.Build.0 = Debug|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.ActiveCfg = Release|Win32
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4}.Release|Win32.Build.0 = Release|Win32
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -1091,6 +1105,7 @@
 		{692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}
 		{CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
+		{AB91A099-7690-4ECF-8994-E458F4EA1ED4} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
 		{C4854C1D-5478-4F87-AB62-36CCDDDBA3C7} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{5786D51D-1C6A-4BE1-8804-29954DB5258F} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{E969F3E0-1043-482A-AD49-787B8356BA92} = {C120A020-773F-4EA3-923F-B67AF28B750D}

Modified: freeswitch/branches/knhor/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/branches/knhor/trunk/conf/freeswitch.xml	(original)
+++ freeswitch/branches/knhor/trunk/conf/freeswitch.xml	Sun Dec 10 16:11:00 2006
@@ -28,6 +28,7 @@
 
         <!-- XML Interfaces -->
         <!-- <load module="mod_xml_rpc"/> -->
+        <!-- <load module="mod_xml_curl"/> -->
 
         <!-- Event Handlers -->
         <!-- <load module="mod_cdr"/> -->
@@ -334,6 +335,16 @@
 
     </configuration>
 
+    <configuration name="xml_curl.conf" description="cURL XML Gateway">
+      <settings>
+	<!-- The url to a gateway cgi that can generate xml similar to
+	     what's in this file only on-the-fly (leave it commented if you dont
+	     need it) -->
+	<!-- one or more |-delim of configuration|directory|dialplan -->
+	<!--<param name="gateway-url" value="http://www.mydomain.com/test.cgi" bindings="dialplan"/>-->
+      </settings>
+    </configuration>
+
     <configuration name="xml_rpc.conf" description="XML RPC">
       <settings>
         <!-- The port where you want to run the http service (default 8080) -->
@@ -342,10 +353,6 @@
         <param name="auth-realm" value="freeswitch"/>
         <param name="auth-user" value="freeswitch"/>
         <param name="auth-pass" value="works"/>
-        <!-- The url to a gateway cgi that can generate xml similar to what's in -->
-        <!-- this file only on-the-fly (leave it commented if you dont need it)-->
-        <!-- one or more |-delim of configuration|directory|dialplan -->
-        <!-- <param name="gateway-url" value="http://www.server.com/gateway.cgi" bindings="configuration"/> -->
       </settings>
     </configuration>
 

Modified: freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Sun Dec 10 16:11:00 2006
@@ -3705,14 +3705,13 @@
 				switch_core_session_t *bsession;
 				
 				if ((bsession = switch_core_session_locate(br))) {
-					channel = switch_core_session_get_channel(bsession);
 					switch_channel_set_variable(channel, "TRANSFER_FALLBACK", (char *) from->a_user);
 					switch_ivr_session_transfer(bsession, exten, profile->dialplan, profile->context);
 					switch_core_session_rwunlock(bsession);
 				} 
-				
+
 				switch_channel_set_variable(channel, "endpoint_disposition", "BLIND_TRANSFER");
-				
+                
 				nua_notify(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
 						   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"),
 						   SIPTAG_EVENT_STR(etmp),
@@ -4008,8 +4007,8 @@
 			}
 
 			attach_private(session, profile, tech_pvt, username);
-			switch_core_session_read_lock(session);
-			switch_set_flag(tech_pvt, TFLAG_RWLOCK);
+			//switch_core_session_read_lock(session);
+			//switch_set_flag(tech_pvt, TFLAG_RWLOCK);
 			channel = switch_core_session_get_channel(session);
 			switch_channel_set_variable(channel, "endpoint_disposition", "INBOUND CALL");
 			set_chat_hash(tech_pvt, sip);

Modified: freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/Makefile
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/Makefile	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/Makefile	Sun Dec 10 16:11:00 2006
@@ -1,9 +1,8 @@
-LDFLAGS += -lxmlrpc -lxmlrpc_abyss -lxmlrpc_server -lxmlrpc_server_abyss -lxmlrpc_xmlparse -lcurl
+LDFLAGS += -lxmlrpc -lxmlrpc_abyss -lxmlrpc_server -lxmlrpc_server_abyss -lxmlrpc_xmlparse
 
 all:	depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
 
 depends:
-	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install curl-7.15.2.tar.gz --prefix=$(PREFIX)
 	MAKE=$(MAKE) $(BASE)/build/buildlib.sh $(BASE) install xmlrpc-c-1.03.14.tgz --prefix=$(PREFIX) --disable-cplusplus --disable-wininet-client --disable-libwww-client
 
 

Modified: freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	(original)
+++ freeswitch/branches/knhor/trunk/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	Sun Dec 10 16:11:00 2006
@@ -37,104 +37,9 @@
 #include <xmlrpc-c/abyss.h>
 #include <xmlrpc-c/server.h>
 #include <xmlrpc-c/server_abyss.h>
-#include <curl/curl.h>
 
-
-
 static const char modname[] = "mod_xml_rpc";
 
-
-
-static struct {
-	uint16_t port;
-	uint8_t running;
-	char *url;
-	char *bindings;
-	char *realm;
-	char *user;
-	char *pass;
-} globals;
-
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_url, globals.url);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_bindings, globals.bindings);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass);
-
-struct config_data {
-	char *name;
-	int fd;
-};
-
-static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
-{
-	register unsigned int realsize = (unsigned int)(size * nmemb);
-	struct config_data *config_data = data;
-
-	write(config_data->fd, ptr, realsize);
-	return realsize;
-}
-
-
-static switch_xml_t xml_url_fetch(char *section,
-								  char *tag_name,
-								  char *key_name,
-								  char *key_value,
-								  char *params)
-{
-	char filename[1024] = "";
-	CURL *curl_handle = NULL;
-	struct config_data config_data;
-	switch_xml_t xml = NULL;
-    char *data = NULL;
-
-    if (!(data = switch_mprintf("section=%s&tag_name=%s&key_name=%s&key_value=%s%s%s\n", 
-                                section,
-                                tag_name ? tag_name : "",
-                                key_name ? key_name : "",
-                                key_value ? key_value : "",
-                                params ? "&" : "", params ? params : ""))) {
-
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-        return NULL;
-    }
-
-	srand((unsigned int)(time(NULL) + strlen(globals.url)));
-	snprintf(filename, sizeof(filename), "%s%04x.tmp", SWITCH_GLOBAL_dirs.temp_dir, (rand() & 0xffff));
-	curl_handle = curl_easy_init();
-	if (!strncasecmp(globals.url, "https", 5)) {
-		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
-		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
-	}
-		
-	config_data.name = filename;
-	if ((config_data.fd = open(filename, O_CREAT | O_RDWR | O_TRUNC)) > -1) {
-        curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
-        curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, data);
-		curl_easy_setopt(curl_handle, CURLOPT_URL, globals.url);
-		curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
-		curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)&config_data);
-		curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
-		curl_easy_perform(curl_handle);
-		curl_easy_cleanup(curl_handle);
-		close(config_data.fd);
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error!\n");
-	}
-
-    switch_safe_free(data);
-
-	if (!(xml = switch_xml_parse_file(filename))) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
-	}
-
-	unlink(filename);
-	
-	return xml;
-}
-
-
-
 static switch_loadable_module_interface_t xml_rpc_module_interface = {
 	/*.module_name */ modname,
 	/*.endpoint_interface */ NULL,
@@ -148,6 +53,18 @@
 	/*.directory_interface */ NULL
 };
 
+static struct {
+	uint16_t port;
+	uint8_t running;
+	char *realm;
+	char *user;
+	char *pass;
+} globals;
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_realm, globals.realm);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_user, globals.user);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_pass, globals.pass);
+
 static switch_status_t do_config(void) 
 {
 	char *cf = "xml_rpc.conf";
@@ -171,10 +88,6 @@
 				user = val;
 			} else if (!strcasecmp(var, "auth-pass")) {
 				pass = val;
-			} else if (!strcasecmp(var, "gateway-url")) {
-				char *bindings = (char *) switch_xml_attr_soft(param, "bindings");
-				set_global_bindings(bindings);
-				set_global_url(val);
 			} else if (!strcasecmp(var, "http-port")) {
 				globals.port = (uint16_t)atoi(val);
 			}
@@ -191,7 +104,7 @@
 	}
 	switch_xml_free(xml);
 
-	return globals.url ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -202,13 +115,8 @@
 
 	memset(&globals, 0, sizeof(globals));
 
-	if (do_config() == SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding XML Fetch Function [%s] [%s]\n", globals.url, globals.bindings ? globals.bindings : "all");
-		switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(globals.bindings));
-	}
+    do_config();
 
-	curl_global_init(CURL_GLOBAL_ALL);
-
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -353,7 +261,6 @@
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void)
 {
 	globals.running = 0;
-	curl_global_cleanup();
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/knhor/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/branches/knhor/trunk/src/switch_ivr.c	(original)
+++ freeswitch/branches/knhor/trunk/src/switch_ivr.c	Sun Dec 10 16:11:00 2006
@@ -3287,9 +3287,18 @@
 				switch_channel_event_set_data(caller_channel, event);
 				switch_event_fire(&event);
 			}
+
+
 			if (switch_channel_get_state(caller_channel) != CS_EXECUTE && !switch_channel_test_flag(caller_channel, CF_TRANSFER)) {
 				switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_CLEARING);
 			}
+
+            if (switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(peer_channel, CF_TRANSFER)) {
+                switch_channel_hangup(peer_channel, SWITCH_CAUSE_NORMAL_CLEARING);
+            }
+            if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && switch_channel_test_flag(peer_channel, CF_TRANSFER)) {
+                switch_channel_hangup(caller_channel, SWITCH_CAUSE_NORMAL_CLEARING);
+            }
 
 			this_audio_thread->objs[0] = NULL;
 			this_audio_thread->objs[1] = NULL;



More information about the Freeswitch-svn mailing list