[Freeswitch-svn] [commit] r8138 - in freeswitch/trunk/src/mod: applications/mod_dptools languages/mod_spidermonkey

Freeswitch SVN anthm at freeswitch.org
Mon Apr 21 16:15:50 EDT 2008


Author: anthm
Date: Mon Apr 21 16:15:50 2008
New Revision: 8138

Modified:
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c

Log:
add hold/unhold dialplan apps

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Mon Apr 21 16:15:50 2008
@@ -1844,6 +1844,19 @@
 	return cause;
 }
 
+
+#define HOLD_SYNTAX "[<display message>]"
+SWITCH_STANDARD_APP(hold_function)
+{
+	switch_ivr_hold_uuid(switch_core_session_get_uuid(session), data);
+}
+
+#define UNHOLD_SYNTAX ""
+SWITCH_STANDARD_APP(unhold_function)
+{
+	switch_ivr_unhold_uuid(switch_core_session_get_uuid(session));
+}
+
 #define SPEAK_DESC "Speak text to a channel via the tts interface"
 #define DISPLACE_DESC "Displace audio from a file to the channels input"
 #define SESS_REC_DESC "Starts a background recording of the entire session"
@@ -1876,6 +1889,9 @@
 	SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
 	SWITCH_ADD_API(api_interface, "presence", "presence", presence_api_function, "<user> <rpid> <message>");
 	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number", SAF_SUPPORT_NOMEDIA);
+
+	SWITCH_ADD_APP(app_interface, "hold", "Send a hold message", "Send a hold message", hold_function, HOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "unhold", "Send a un-hold message", "Send a un-hold message", unhold_function, UNHOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "transfer", "Transfer a channel", TRANSFER_LONG_DESC, transfer_function, "<exten> [<dialplan> <context>]", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list", 
 				   "Check an ip against an ACL list", check_acl_function, "<ip> <acl | cidr>", SAF_SUPPORT_NOMEDIA);

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Mon Apr 21 16:15:50 2008
@@ -2281,14 +2281,10 @@
 	CURL *curl_handle = NULL;
 	struct config_data config_data;
 	int saveDepth = 0;
-	int32 disable_wait = 0;
 
 	if (argc > 1) {
 		url = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
-		if (argc > 2) {
-			JS_ValueToInt32(cx, argv[2], &disable_wait);
-		}
 
 		curl_handle = curl_easy_init();
 		if (!strncasecmp(url, "https", 5)) {
@@ -2305,13 +2301,9 @@
 		curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
 		curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-js/1.0");
 
-		if (disable_wait) {
-			saveDepth = JS_SuspendRequest(cx);
-			curl_easy_perform(curl_handle);
-			JS_ResumeRequest(cx, saveDepth);
-		} else {
-			curl_easy_perform(curl_handle);
-		}
+		saveDepth = JS_SuspendRequest(cx);
+		curl_easy_perform(curl_handle);
+		JS_ResumeRequest(cx, saveDepth);
 
 		curl_easy_cleanup(curl_handle);
 	} else {
@@ -2330,14 +2322,10 @@
 	CURL *curl_handle = NULL;
 	struct config_data config_data;
 	int saveDepth = 0;
-	int32 disable_wait = 0;
 
 	if (argc > 1) {
 		url = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		filename = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
-		if (argc > 2) {
-			JS_ValueToInt32(cx, argv[2], &disable_wait);
-		}
 
 		curl_global_init(CURL_GLOBAL_ALL);
 		curl_handle = curl_easy_init();
@@ -2355,13 +2343,9 @@
 			curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
 			curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-js/1.0");
 
-			if (disable_wait) {
-				saveDepth = JS_SuspendRequest(cx);
-				curl_easy_perform(curl_handle);
-				JS_ResumeRequest(cx, saveDepth);
-			} else {
-				curl_easy_perform(curl_handle);
-			}
+			saveDepth = JS_SuspendRequest(cx);
+			curl_easy_perform(curl_handle);
+			JS_ResumeRequest(cx, saveDepth);
 
 			curl_easy_cleanup(curl_handle);
 			close(config_data.fd);
@@ -2383,15 +2367,11 @@
 	int32 buffer_size = 65535;
 	CURLcode code = 0;
 	int saveDepth = 0;
-	int32 disable_wait = 0;
 
 	if (argc >= 1) {
 		url = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 		if (argc > 1) {
 			JS_ValueToInt32(cx, argv[1], &buffer_size);
-			if (argc > 2) {
-				JS_ValueToInt32(cx, argv[2], &disable_wait);
-			}
 		}
 
 		curl_global_init(CURL_GLOBAL_ALL);
@@ -2414,13 +2394,9 @@
 		curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
 		curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-js/1.0");
 
-		if (disable_wait) {
-			saveDepth = JS_SuspendRequest(cx);
-			code = curl_easy_perform(curl_handle);
-			JS_ResumeRequest(cx, saveDepth);
-		} else {
-			code = curl_easy_perform(curl_handle);
-		}
+		saveDepth = JS_SuspendRequest(cx);
+		code = curl_easy_perform(curl_handle);
+		JS_ResumeRequest(cx, saveDepth);
 
 		curl_easy_cleanup(curl_handle);
 



More information about the Freeswitch-svn mailing list