@tiledesk/tiledesk-tybot-connector 0.2.61-rc1 → 0.2.62-rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -5,8 +5,11 @@
5
5
  available on:
6
6
  ▶️ https://www.npmjs.com/package/@tiledesk/tiledesk-tybot-connector
7
7
 
8
+ # v0.2.62-rc1
9
+ - Added VXML actions (speech_form, play_prompt)
8
10
 
9
- # v0.2.61 (next-release)
11
+ # v0.2.61
12
+ - fixed WebRequestv2 timeout
10
13
 
11
14
  # v0.2.61-rc1
12
15
  - Added VXML actions (dmtf_menu, dtmf_form, blind_transfer)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.61-rc1",
3
+ "version": "0.2.62-rc1",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -312,6 +312,20 @@ class DirectivesChatbotPlug {
312
312
  this.process(next_dir);
313
313
  });
314
314
  }
315
+ else if (directive_name === Directives.SPEECH_FORM) {
316
+ // console.log("...DirReply");
317
+ new DirReply(context).execute(directive, async () => {
318
+ let next_dir = await this.nextDirective(this.directives);
319
+ this.process(next_dir);
320
+ });
321
+ }
322
+ else if (directive_name === Directives.PLAY_PROMPT) {
323
+ // console.log("...DirReply");
324
+ new DirReply(context).execute(directive, async () => {
325
+ let next_dir = await this.nextDirective(this.directives);
326
+ this.process(next_dir);
327
+ });
328
+ }
315
329
  else if (directive_name === Directives.RANDOM_REPLY) {
316
330
  // console.log("...DirRandomReply");
317
331
  new DirRandomReply(context).execute(directive, async () => {
@@ -75,8 +75,8 @@ class DirCaptureUserReply {
75
75
  // console.log("(DirCaptureUserReply) lockIntent");
76
76
  await this.chatbot.lockAction(this.requestId, actionId);
77
77
  // console.log("(DirCaptureUserReply) lockAction");
78
- let _lockedAction = await this.chatbot.currentLockedAction(this.requestId);
79
- let _lockedIntent = await this.chatbot.currentLockedIntent(this.requestId);
78
+ // let _lockedAction = await this.chatbot.currentLockedAction(this.requestId);
79
+ // let _lockedIntent = await this.chatbot.currentLockedIntent(this.requestId);
80
80
  // console.log("(DirCaptureUserReply) _lockedAction", _lockedAction)
81
81
  // console.log("(DirCaptureUserReply) _lockedIntent", _lockedIntent)
82
82
  callback();
@@ -81,7 +81,7 @@ class DirWebRequestV2 {
81
81
  }
82
82
 
83
83
  let timeout = this.#webrequest_timeout(action, 20000, 1, 300000);
84
-
84
+ console.log("final timeout", timeout);
85
85
  if (this.log) {console.log("webRequest URL", url);}
86
86
  const HTTPREQUEST = {
87
87
  url: url,
@@ -212,7 +212,7 @@ class DirWebRequestV2 {
212
212
  method: options.method,
213
213
  params: options.params,
214
214
  headers: options.headers,
215
- timeout: 20000
215
+ timeout: options.timeout
216
216
  }
217
217
  if (options.json !== null) {
218
218
  axios_options.data = options.json
@@ -309,11 +309,23 @@ class DirWebRequestV2 {
309
309
 
310
310
  #webrequest_timeout(action, default_timeout, min, max) {
311
311
  let timeout = default_timeout;
312
- if (action.settings && action.settings.timeout) {
313
- if (action.settings.timeout && typeof action.settings.timeout === "number" && action.settings.timeout > min && action.settings.timeout < max) {
314
- timeout = Math.round(action.timeout)
312
+ if (!action.settings) {
313
+ return timeout;
314
+ }
315
+ // console.log("default timeout:", timeout);
316
+ // console.log("action.settings:", action.settings);
317
+ // console.log("action.settings.timeout:", action.settings.timeout);
318
+ // console.log("typeof action.settings.timeout:", typeof action.settings.timeout);
319
+ // console.log("action.settings.timeout > min", action.settings.timeout > min)
320
+ // console.log("action.settings.timeout < max", action.settings.timeout < max)
321
+
322
+ if (action.settings.timeout) {
323
+ if ((typeof action.settings.timeout === "number") && action.settings.timeout > min && action.settings.timeout < max) {
324
+ timeout = Math.round(action.settings.timeout)
325
+ // console.log("new timeout:", timeout);
315
326
  }
316
327
  }
328
+ // console.log("returning timeout:", timeout);
317
329
  return timeout
318
330
  }
319
331
 
@@ -43,6 +43,8 @@ class Directives {
43
43
  static DTMF_FORM = 'dtmf_form';
44
44
  static DTMF_MENU = 'dtmf_menu';
45
45
  static BLIND_TRANSFER = 'blind_transfer';
46
+ static SPEECH_FORM = 'speech_form';
47
+ static PLAY_PROMPT = 'play_prompt';
46
48
 
47
49
  // static WHEN_ONLINE_MOVE_TO_AGENT = "whenonlinemovetoagent"; // DEPRECATED?
48
50
  // static WHEN_OFFLINE_HOURS = "whenofflinehours"; // DEPRECATED // adds a message on top of the original message when offline hours opts: --replace