提交 33a69e53 authored 作者: Anthony Minessale's avatar Anthony Minessale

add hold/unhold dialplan apps

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8138 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 e57c5e31
......@@ -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);
......
......@@ -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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论