]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add hold/unhold dialplan apps
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 21 Apr 2008 20:15:50 +0000 (20:15 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 21 Apr 2008 20:15:50 +0000 (20:15 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8138 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_dptools/mod_dptools.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c

index 6f6b6b262dd53363aa6b6d47f907ab4cef2078c6..c7fac0936969f9d5e82d776950523523c113b667 100644 (file)
@@ -1844,6 +1844,19 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
        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_MODULE_LOAD_FUNCTION(mod_dptools_load)
        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);
index 278951bd7df41bde5566afc7317833c11089abea..1fe29942f24c46598ad1d074369ba260a76291b4 100644 (file)
@@ -2281,14 +2281,10 @@ static JSBool js_fetchurl_hash(JSContext * cx, JSObject * obj, uintN argc, jsval
        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 @@ static JSBool js_fetchurl_hash(JSContext * cx, JSObject * obj, uintN argc, jsval
                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 @@ static JSBool js_fetchurl_file(JSContext * cx, JSObject * obj, uintN argc, jsval
        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 @@ static JSBool js_fetchurl_file(JSContext * cx, JSObject * obj, uintN argc, jsval
                        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 @@ static JSBool js_fetchurl(JSContext * cx, JSObject * obj, uintN argc, jsval * ar
        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 @@ static JSBool js_fetchurl(JSContext * cx, JSObject * obj, uintN argc, jsval * ar
                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);