@jambonz/node-red-contrib-jambonz 2.4.23 → 2.4.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/node-red-contrib-jambonz",
3
- "version": "2.4.23",
3
+ "version": "2.4.25",
4
4
  "description": "Node-RED nodes for jambonz platform",
5
5
  "keywords": [
6
6
  "node-red"
@@ -48,25 +48,27 @@
48
48
  "get_alerts": "src/nodes/get_alerts.js",
49
49
  "get_call": "src/nodes/get_call.js",
50
50
  "get_calls": "src/nodes/get_calls.js",
51
- "get_recent_calls": "src/nodes/get_recent_calls.js"
51
+ "get_recent_calls": "src/nodes/get_recent_calls.js",
52
+ "answer": "src/nodes/answer.js",
53
+ "dub": "src/nodes/dub.js"
52
54
  }
53
55
  },
54
56
  "author": "Dave Horton",
55
57
  "license": "MIT",
56
58
  "dependencies": {
57
- "aws-sdk": "^2.1405.0",
59
+ "aws-sdk": "^2.1665.0",
58
60
  "body-parser": "^1.20.2",
59
61
  "cookie-parser": "^1.4.6",
60
62
  "cors": "^2.8.5",
61
63
  "hash-sum": "^2.0.0",
62
64
  "is-utf8": "^0.2.1",
63
65
  "media-typer": "^1.1.0",
64
- "multer": "^1.4.4",
66
+ "multer": "^1.4.5-lts.1",
65
67
  "mustache": "^4.2.0",
66
68
  "on-headers": "^1.0.2",
67
69
  "raw-body": "^2.5.2",
68
70
  "s3-upload-stream": "^1.0.7",
69
- "undici": "^5.26.4",
70
- "ws": "^8.13.0"
71
+ "undici": "^5.28.4",
72
+ "ws": "^8.18.0"
71
73
  }
72
74
  }
@@ -0,0 +1,35 @@
1
+ <!-- Javascript -->
2
+ <script type="text/javascript">
3
+ RED.nodes.registerType('answer',{
4
+ category: 'jambonz',
5
+ color: '#bbabaa',
6
+ defaults: {
7
+ name: {value: ''},
8
+ },
9
+ inputs: 1,
10
+ outputs: 1,
11
+ icon: "font-awesome/fa-cubes",
12
+ label: function() { return this.name || 'answer';},
13
+ });
14
+ </script>
15
+
16
+ <!-- HTML -->
17
+ <script type="text/html" data-template-name="answer">
18
+ <div class="form-row">
19
+ <label for="node-input-name"><i class="icon-tag"></i> Name</label>
20
+ <input type="text" id="node-input-name" placeholder="Name">
21
+ </div>
22
+ </script>
23
+
24
+ <!-- Help Text -->
25
+ <script type="text/html" data-help-name="answer">
26
+ <p>Answer the call</p>
27
+
28
+ <h3>Details</h3>
29
+ This is rarely used, as the call is typically answered automatically when required by the app,
30
+ but it can be useful to force an answer before a pause in some cases.
31
+ <h3>References</h3>
32
+ <ul>
33
+ <li><a href="https://www.jambonz.org/docs/webhooks/answer/">Jambonz answer reference</a></li>
34
+ </ul>
35
+ </script>
@@ -0,0 +1,16 @@
1
+ var {appendVerb} = require('./libs')
2
+
3
+ module.exports = function(RED) {
4
+ function answer(config) {
5
+ RED.nodes.createNode(this, config);
6
+ var node = this;
7
+ node.on('input', function(msg) {
8
+ var data = {
9
+ verb: 'answer'
10
+ };
11
+ appendVerb(msg, data);
12
+ node.send(msg);
13
+ });
14
+ }
15
+ RED.nodes.registerType('answer', answer);
16
+ }
@@ -5,17 +5,17 @@ module.exports = function(RED) {
5
5
  function conference(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg) {
9
- var statusHook = new_resolve(RED, config.statusHook, config.statusHookType, node, msg);
8
+ node.on('input', async function(msg) {
9
+ var statusHook = await new_resolve(RED, config.statusHook, config.statusHookType, node, msg);
10
10
  appendVerb(msg, {
11
11
  verb: 'conference',
12
- name: new_resolve(RED, config.conference, config.conferenceType, node, msg),
13
- enterHook: new_resolve(RED, config.enterHook, config.enterHookType, node, msg),
14
- waitHook: new_resolve(RED, config.waitHook, config.waitHookType, node, msg),
15
- actionHook: new_resolve(RED, config.actionHook, config.actionHookType, node, msg),
12
+ name: await new_resolve(RED, config.conference, config.conferenceType, node, msg),
13
+ enterHook: await new_resolve(RED, config.enterHook, config.enterHookType, node, msg),
14
+ waitHook: await new_resolve(RED, config.waitHook, config.waitHookType, node, msg),
15
+ actionHook: await new_resolve(RED, config.actionHook, config.actionHookType, node, msg),
16
16
  statusHook,
17
17
  ...(statusHook && { statusEvents: ['start', 'end', 'join', 'leave'] }),
18
- maxParticipants: new_resolve(RED, config.maxParticipants, config.maxParticipantsType, node, msg),
18
+ maxParticipants: await new_resolve(RED, config.maxParticipants, config.maxParticipantsType, node, msg),
19
19
  beep: config.beep,
20
20
  startConferenceOnEnter: config.startConferenceOnEnter,
21
21
  endConferenceOnExit: config.endConferenceOnExit,
@@ -83,6 +83,14 @@
83
83
  sipRequest: { value: false },
84
84
  sipRequestWithinDialogHook: { value: "" },
85
85
  sipRequestWithinDialogHookType: { value: "str" },
86
+
87
+ onHold: { value: false },
88
+ onHoldMusic: { value: "" },
89
+ onHoldMusicType: { value: "str" },
90
+
91
+ boostAudioSignal: { value: false },
92
+ boostAudioSignalLevel: { value: "" },
93
+ boostAudioSignalLevelType: { value: "str" },
86
94
  },
87
95
  inputs: 1,
88
96
  outputs: 1,
@@ -263,6 +271,32 @@
263
271
  }
264
272
  });
265
273
 
274
+ $("#node-input-onHoldMusic").typedInput({
275
+ types: ["str", "msg", "flow", "global", "jsonata", "env", mustacheType],
276
+ typeField: $("#node-input-onHoldMusicType"),
277
+ });
278
+ $("#node-input-onHold").change(function () {
279
+ const doSipRequest = $("#node-input-onHold:checked").val();
280
+ if (doSipRequest) {
281
+ $("#onHold-options").show();
282
+ } else {
283
+ $("#onHold-options").hide();
284
+ }
285
+ });
286
+
287
+ $("#node-input-boostAudioSignalLevel").typedInput({
288
+ types: ["str", "msg", "flow", "global", "jsonata", "env", mustacheType],
289
+ typeField: $("#node-input-boostAudioSignalLevelType"),
290
+ });
291
+ $("#node-input-boostAudioSignal").change(function () {
292
+ const doSipRequest = $("#node-input-boostAudioSignal:checked").val();
293
+ if (doSipRequest) {
294
+ $("#boostAudioSignal-options").show();
295
+ } else {
296
+ $("#boostAudioSignal-options").hide();
297
+ }
298
+ });
299
+
266
300
  $("#node-input-listenRequest").change(function () {
267
301
  const doListen = $("#node-input-listenRequest:checked").val();
268
302
  if (doListen) {
@@ -569,6 +603,32 @@
569
603
  <input type="hidden" id="node-input-sipRequestWithinDialogHookType">
570
604
  </div>
571
605
  </div>
606
+
607
+ <legend>On Hold Music</legend>
608
+ <div class="form-row">
609
+ <label for="node-input-onHold">Modify On Hold Music</label>
610
+ <input type="checkbox" id="node-input-onHold">
611
+ </div>
612
+ <div id="onHold-options">
613
+ <div class="form-row">
614
+ <label for="node-input-onHoldMusic">Url</label>
615
+ <input type="text" id="node-input-onHoldMusic">
616
+ <input type="hidden" id="node-input-onHoldMusicType">
617
+ </div>
618
+ </div>
619
+
620
+ <legend>Boost Audio Signal</legend>
621
+ <div class="form-row">
622
+ <label for="node-input-boostAudioSignal">Boost Audio</label>
623
+ <input type="checkbox" id="node-input-boostAudioSignal">
624
+ </div>
625
+ <div id="boostAudioSignal-options">
626
+ <div class="form-row">
627
+ <label for="node-input-boostAudioSignalLevel">Level</label>
628
+ <input type="text" id="node-input-boostAudioSignalLevel">
629
+ <input type="hidden" id="node-input-boostAudioSignalLevelType">
630
+ </div>
631
+ </div>
572
632
  </fieldset>
573
633
  </script>
574
634
 
@@ -4,7 +4,7 @@ module.exports = function(RED) {
4
4
  function cfg(config) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
- node.on('input', function(msg) {
7
+ node.on('input', async function(msg) {
8
8
  obj = { verb: 'config' }
9
9
  if (config.tts){
10
10
  Object.assign(obj, {
@@ -23,9 +23,9 @@ module.exports = function(RED) {
23
23
  }
24
24
  })
25
25
  if (config.transcriptionvendor == 'google'){
26
- obj.recognizer.hints = new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg)
27
- obj.recognizer.altLanguages = [new_resolve(RED, config.altLanguages, config.altLanguagesType, node, msg)]
28
- obj.recognizer.naicsCode = new_resolve(RED, config.naics, config.naicsType, node, msg)
26
+ obj.recognizer.hints = await new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg)
27
+ obj.recognizer.altLanguages = [await new_resolve(RED, config.altLanguages, config.altLanguagesType, node, msg)]
28
+ obj.recognizer.naicsCode = await new_resolve(RED, config.naics, config.naicsType, node, msg)
29
29
  }
30
30
  if (config.transcriptionvendor == 'aws'){
31
31
  obj.recognizer.vocabularyName = config.vocabularyname
@@ -37,36 +37,36 @@ module.exports = function(RED) {
37
37
  if (config.bargeIn){
38
38
  obj.bargeIn = {}
39
39
  config.bargeIn_enable != '' ? obj.bargeIn.enable = config.bargeIn_enable : null
40
- config.bargeIn_actionHook != '' ? obj.bargeIn.actionHook = new_resolve(RED, config.bargeIn_actionHook, config.bargeIn_actionHookType, node, msg) : null
40
+ config.bargeIn_actionHook != '' ? obj.bargeIn.actionHook = await new_resolve(RED, config.bargeIn_actionHook, config.bargeIn_actionHookType, node, msg) : null
41
41
  config.bargeIn_input != '' ? obj.bargeIn.input = config.bargeIn_input.split(',') : null
42
- config.bargeIn_finishOnKey != '' ? obj.bargeIn.finishOnKey = new_resolve(RED, config.bargeIn_finishOnKey, config.bargeIn_finishOnKeyType, node, msg) : null
43
- config.bargeIn_numDigits != '' ? obj.bargeIn.numDigits = new_resolve(RED, config.bargeIn_numDigits, config.bargeIn_numDigitsType, node, msg) : null
44
- config.bargeIn_minDigits != '' ? obj.bargeIn.minDigits = new_resolve(RED, config.bargeIn_minDigits, config.bargeIn_minDigitsType, node, msg) : null
45
- config.bargeIn_maxDigits != '' ? obj.bargeIn.maxDigits = new_resolve(RED, config.bargeIn_maxDigits, config.bargeIn_maxDigitsType, node, msg) : null
46
- config.bargeIn_interDigitTimeout != '' ? obj.bargeIn.interDigitTimeout = new_resolve(RED, config.bargeIn_interDigitTimeout, config.bargeIn_interDigitTimeoutType, node, msg) : null
42
+ config.bargeIn_finishOnKey != '' ? obj.bargeIn.finishOnKey = await new_resolve(RED, config.bargeIn_finishOnKey, config.bargeIn_finishOnKeyType, node, msg) : null
43
+ config.bargeIn_numDigits != '' ? obj.bargeIn.numDigits = await new_resolve(RED, config.bargeIn_numDigits, config.bargeIn_numDigitsType, node, msg) : null
44
+ config.bargeIn_minDigits != '' ? obj.bargeIn.minDigits = await new_resolve(RED, config.bargeIn_minDigits, config.bargeIn_minDigitsType, node, msg) : null
45
+ config.bargeIn_maxDigits != '' ? obj.bargeIn.maxDigits = await new_resolve(RED, config.bargeIn_maxDigits, config.bargeIn_maxDigitsType, node, msg) : null
46
+ config.bargeIn_interDigitTimeout != '' ? obj.bargeIn.interDigitTimeout = await new_resolve(RED, config.bargeIn_interDigitTimeout, config.bargeIn_interDigitTimeoutType, node, msg) : null
47
47
  }
48
48
 
49
49
  if (config.amd){
50
50
  obj.amd = {timers : {}}
51
- config.amd_actionHook != '' ? obj.amd.actionHook = new_resolve(RED, config.amd_actionHook, config.amd_actionHookType, node, msg) : null
52
- config.amd_thresholdWordCount != '' ? obj.amd.thresholdWordCount = new_resolve(RED, config.amd_thresholdWordCount, config.amd_thresholdWordCountType, node, msg) : null
53
- config.amd_timers_noSpeechTimeoutMs != '' ? obj.amd.timers.noSpeechTimeoutMs = new_resolve(RED, config.amd_timers_noSpeechTimeoutMs, config.amd_timers_noSpeechTimeoutMsType, node, msg) : null
54
- config.amd_timers_decisionTimeoutMs != '' ? obj.amd.timers.decisionTimeoutMs = new_resolve(RED, config.amd_timers_decisionTimeoutMs, config.amd_timers_decisionTimeoutMsType, node, msg) : null
55
- config.amd_timers_toneTimeoutMs != '' ? obj.amd.timers.toneTimeoutMs = new_resolve(RED, config.amd_timers_toneTimeoutMs, config.amd_timers_toneTimeoutMsType, node, msg) : null
56
- config.amd_timers_greetingCompletionTimeoutMs != '' ? obj.amd.timers.greetingCompletionTimeoutMs = new_resolve(RED, config.amd_timers_greetingCompletionTimeoutMs, config.amd_timers_greetingCompletionTimeoutMsType, node, msg) : null
51
+ config.amd_actionHook != '' ? obj.amd.actionHook = await new_resolve(RED, config.amd_actionHook, config.amd_actionHookType, node, msg) : null
52
+ config.amd_thresholdWordCount != '' ? obj.amd.thresholdWordCount = await new_resolve(RED, config.amd_thresholdWordCount, config.amd_thresholdWordCountType, node, msg) : null
53
+ config.amd_timers_noSpeechTimeoutMs != '' ? obj.amd.timers.noSpeechTimeoutMs = await new_resolve(RED, config.amd_timers_noSpeechTimeoutMs, config.amd_timers_noSpeechTimeoutMsType, node, msg) : null
54
+ config.amd_timers_decisionTimeoutMs != '' ? obj.amd.timers.decisionTimeoutMs = await new_resolve(RED, config.amd_timers_decisionTimeoutMs, config.amd_timers_decisionTimeoutMsType, node, msg) : null
55
+ config.amd_timers_toneTimeoutMs != '' ? obj.amd.timers.toneTimeoutMs = await new_resolve(RED, config.amd_timers_toneTimeoutMs, config.amd_timers_toneTimeoutMsType, node, msg) : null
56
+ config.amd_timers_greetingCompletionTimeoutMs != '' ? obj.amd.timers.greetingCompletionTimeoutMs = await new_resolve(RED, config.amd_timers_greetingCompletionTimeoutMs, config.amd_timers_greetingCompletionTimeoutMsType, node, msg) : null
57
57
  }
58
58
 
59
59
  if (config.record){
60
60
  obj.record = {}
61
61
  config.record_action != '' ? obj.record.action = config.record_action : null //TODO if multiple, split into array
62
- config.record_siprecServerURL != '' ? obj.record.siprecServerURL = new_resolve(RED, config.record_siprecServerURL, config.record_siprecServerURLType, node, msg) : null
63
- config.record_recordingID != '' ? obj.record.recordingID = new_resolve(RED, config.record_recordingID, config.record_recordingIDType, node, msg) : null
62
+ config.record_siprecServerURL != '' ? obj.record.siprecServerURL = await new_resolve(RED, config.record_siprecServerURL, config.record_siprecServerURLType, node, msg) : null
63
+ config.record_recordingID != '' ? obj.record.recordingID = await new_resolve(RED, config.record_recordingID, config.record_recordingIDType, node, msg) : null
64
64
  }
65
65
 
66
66
  if (config.listenRequest) {
67
67
  obj.listen = {}
68
- const authUser = new_resolve(RED, config.listenAuthUser, config.listenAuthUserType, node, msg);
69
- const authPass = new_resolve(RED, config.listenAuthPass, config.listenAuthPassType, node, msg);
68
+ const authUser = await new_resolve(RED, config.listenAuthUser, config.listenAuthUserType, node, msg);
69
+ const authPass = await new_resolve(RED, config.listenAuthPass, config.listenAuthPassType, node, msg);
70
70
  if (authUser && authPass) {
71
71
  obj.listen.wsAuth = {
72
72
  username: authUser,
@@ -76,15 +76,23 @@ module.exports = function(RED) {
76
76
  obj.listen.enable = config.listenEnabled;
77
77
  obj.listen.sampleRate = +config.listenSampleRate;
78
78
  obj.listen.mixType = config.listenMixType;
79
- config.url != '' ? obj.listen.url = new_resolve(RED, config.listenUrl, config.listenUrlType, node, msg) : null;
80
- config.listenMetadata != '' ? obj.listen.metadata = new_resolve(RED, config.listenMetadata, config.listenMetadataType, node, msg) : null;
79
+ config.url != '' ? obj.listen.url = await new_resolve(RED, config.listenUrl, config.listenUrlType, node, msg) : null;
80
+ config.listenMetadata != '' ? obj.listen.metadata = await new_resolve(RED, config.listenMetadata, config.listenMetadataType, node, msg) : null;
81
81
  if (!Object.keys(obj.listen.metadata).length) {
82
82
  delete obj.listen.metadata;
83
83
  }
84
84
  }
85
85
 
86
86
  if (config.sipRequest) {
87
- config.sipRequestWithinDialogHook != '' ? obj.sipRequestWithinDialogHook = new_resolve(RED, config.sipRequestWithinDialogHook, config.sipRequestWithinDialogHookType, node, msg) : null;
87
+ config.sipRequestWithinDialogHook != '' ? obj.sipRequestWithinDialogHook = await new_resolve(RED, config.sipRequestWithinDialogHook, config.sipRequestWithinDialogHookType, node, msg) : null;
88
+ }
89
+
90
+ if (config.onHold) {
91
+ config.onHoldMusic != '' ? obj.onHoldMusic = await new_resolve(RED, config.onHoldMusic, config.onHoldMusicType, node, msg) : null;
92
+ }
93
+
94
+ if (config.boostAudioSignal) {
95
+ config.boostAudioSignal != '' ? obj.boostAudioSignal = await new_resolve(RED, config.boostAudioSignalLevel, config.boostAudioSignalLevelType, node, msg) : null;
88
96
  }
89
97
  appendVerb(msg, obj);
90
98
  node.send(msg);
@@ -7,7 +7,7 @@ module.exports = function(RED) {
7
7
  var node = this;
8
8
  const server = RED.nodes.getNode(config.server);
9
9
 
10
- node.on('input', async(msg, send, done) => {
10
+ node.on('input', async (msg, send, done) => {
11
11
  send = send || function() { node.send.apply(node, arguments);};
12
12
 
13
13
  const {accountSid, apiToken} = server.credentials;
@@ -19,9 +19,9 @@ module.exports = function(RED) {
19
19
  return;
20
20
  }
21
21
 
22
- var from = new_resolve(RED, config.from, config.fromType, node, msg);
23
- var to = new_resolve(RED, config.to, config.toType, node, msg);
24
- var tag = new_resolve(RED, config.tag, config.tagType, node, msg);
22
+ var from = await new_resolve(RED, config.from, config.fromType, node, msg);
23
+ var to = await new_resolve(RED, config.to, config.toType, node, msg);
24
+ var tag = await new_resolve(RED, config.tag, config.tagType, node, msg);
25
25
 
26
26
  const opts = {
27
27
  from,
@@ -40,7 +40,7 @@ module.exports = function(RED) {
40
40
  }
41
41
 
42
42
  if (config.callername) {
43
- opts.callerName = new_resolve(RED, config.callername, config.callernameType, node, msg);
43
+ opts.callerName = await new_resolve(RED, config.callername, config.callernameType, node, msg);
44
44
  }
45
45
 
46
46
  switch (config.mode) {
@@ -49,11 +49,11 @@ module.exports = function(RED) {
49
49
  break
50
50
  case 'url':
51
51
  opts.call_hook = {
52
- url: new_resolve(RED, config.call_hook_url, config.call_hook_urlType, node, msg),
52
+ url: await new_resolve(RED, config.call_hook_url, config.call_hook_urlType, node, msg),
53
53
  method: config.call_hook_method
54
54
  };
55
55
  opts.call_status_hook = {
56
- url: new_resolve(RED, config.call_status_url, config.call_status_urlType, node, msg),
56
+ url: await new_resolve(RED, config.call_status_url, config.call_status_urlType, node, msg),
57
57
  method: config.call_status_method
58
58
  };
59
59
  opts.speech_synthesis_vendor = config.vendor;
@@ -72,7 +72,7 @@ module.exports = function(RED) {
72
72
  switch (config.dest) {
73
73
  case 'phone':
74
74
  if (config.trunk) {
75
- var trunk = new_resolve(RED, config.trunk, config.trunkType, node, msg);
75
+ var trunk = await new_resolve(RED, config.trunk, config.trunkType, node, msg);
76
76
  opts.to.trunk = trunk;
77
77
  }
78
78
  opts.to.number = to;
@@ -7,7 +7,7 @@ function create_sms(config) {
7
7
  var node = this;
8
8
  const server = RED.nodes.getNode(config.server);
9
9
 
10
- node.on('input', async(msg, send, done) => {
10
+ node.on('input', async (msg, send, done) => {
11
11
  send = send || function() { node.send.apply(node, arguments);};
12
12
 
13
13
  const {accountSid, apiToken} = server.credentials;
@@ -19,10 +19,10 @@ function create_sms(config) {
19
19
  return;
20
20
  }
21
21
 
22
- var from = new_resolve(RED, config.from, config.fromType, node, msg)
23
- var to = new_resolve(RED, config.to, config.toType, node, msg)
24
- var text = new_resolve(RED, config.text, config.textType, node, msg);
25
- var provider = new_resolve(RED, config.provider, config.providerType, node, msg)
22
+ var from = await new_resolve(RED, config.from, config.fromType, node, msg)
23
+ var to = await new_resolve(RED, config.to, config.toType, node, msg)
24
+ var text = await new_resolve(RED, config.text, config.textType, node, msg);
25
+ var provider = await new_resolve(RED, config.provider, config.providerType, node, msg)
26
26
 
27
27
  const opts = {
28
28
  from,
@@ -5,15 +5,15 @@ module.exports = function(RED) {
5
5
  function dequeue(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg, send, done) {
9
- const timeout = new_resolve(RED, config.timeout, config.timeoutType, node, msg);
8
+ node.on('input', async function(msg, send, done) {
9
+ const timeout = await new_resolve(RED, config.timeout, config.timeoutType, node, msg);
10
10
  appendVerb(msg, {
11
11
  verb: 'dequeue',
12
- name: new_resolve(RED, config.queue, config.queueType, node, msg),
13
- callSid: new_resolve(RED, config.callSid, config.callSidType, node, msg),
12
+ name: await new_resolve(RED, config.queue, config.queueType, node, msg),
13
+ callSid: await new_resolve(RED, config.callSid, config.callSidType, node, msg),
14
14
  beep: config.beep,
15
- actionHook: new_resolve(RED, config.actionHook, config.actionHookType, node, msg),
16
- confirmHook: new_resolve(RED, config.confirmHook, config.confirmHookType, node, msg),
15
+ actionHook: await new_resolve(RED, config.actionHook, config.actionHookType, node, msg),
16
+ confirmHook: await new_resolve(RED, config.confirmHook, config.confirmHookType, node, msg),
17
17
  timeout: (/^\d+$/.test(timeout)) ? parseInt(timeout) : null,
18
18
  });
19
19
  node.send(msg);
package/src/nodes/dial.js CHANGED
@@ -5,12 +5,12 @@ module.exports = function(RED) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
7
 
8
- node.on('input', function(msg) {
8
+ node.on('input', async function(msg) {
9
9
  node.log(`dial config: ${JSON.stringify(config)}, msg.call: ${JSON.stringify(msg.call)}`);
10
- var target = config.targets.map((t) => {
10
+ var target = await Promise.all(config.targets.map(async (t) => {
11
11
  const obj = Object.assign({}, t);
12
- var dest = new_resolve(RED, obj.dest, obj.varType, node, msg)
13
- var trunk = new_resolve(RED, obj.trunk, obj.trunkType, node, msg)
12
+ var dest = await new_resolve(RED, obj.dest, obj.varType, node, msg);
13
+ var trunk = await new_resolve(RED, obj.trunk, obj.trunkType, node, msg);
14
14
  switch (t.type) {
15
15
  case 'phone':
16
16
  obj.number = dest;
@@ -38,20 +38,20 @@ module.exports = function(RED) {
38
38
  delete obj.trunkType;
39
39
  delete obj.dest;
40
40
  return obj;
41
- });
41
+ }));
42
42
  var data = {
43
43
  verb: 'dial',
44
44
  target,
45
45
  answerOnBridge: config.answeronbridge,
46
46
  timeLimit: config.timelimit ? parseInt(config.timelimit) : null,
47
47
  timeout: config.timeout ? parseInt(config.timeout) : null,
48
- callerId: new_resolve(RED, config.callerid, config.calleridType, node, msg),
49
- callerName: new_resolve(RED, config.callername, config.callernameType, node, msg),
50
- actionHook: new_resolve(RED, config.actionhook, config.actionhookType, node, msg),
51
- confirmHook: new_resolve(RED, config.confirmhook, config.confirmhookType, node, msg),
52
- dialMusic: new_resolve(RED, config.dialmusic, config.dialmusicType, node, msg),
53
- referHook: new_resolve(RED, config.referhook, config.referhookType, node, msg),
54
- dtmfHook: new_resolve(RED, config.dtmfhook, config.dtmfhookType, node, msg),
48
+ callerId: await new_resolve(RED, config.callerid, config.calleridType, node, msg),
49
+ callerName: await new_resolve(RED, config.callername, config.callernameType, node, msg),
50
+ actionHook: await new_resolve(RED, config.actionhook, config.actionhookType, node, msg),
51
+ confirmHook: await new_resolve(RED, config.confirmhook, config.confirmhookType, node, msg),
52
+ dialMusic: await new_resolve(RED, config.dialmusic, config.dialmusicType, node, msg),
53
+ referHook: await new_resolve(RED, config.referhook, config.referhookType, node, msg),
54
+ dtmfHook: await new_resolve(RED, config.dtmfhook, config.dtmfhookType, node, msg),
55
55
  };
56
56
 
57
57
  if (config.hasOwnProperty('anchormedia')) {
@@ -59,7 +59,7 @@ module.exports = function(RED) {
59
59
  }
60
60
 
61
61
  if (config.onholdhook) {
62
- data.onHoldHook = new_resolve(RED, config.onholdhook, config.onholdhookType, node, msg);
62
+ data.onHoldHook = await new_resolve(RED, config.onholdhook, config.onholdhookType, node, msg);
63
63
  }
64
64
 
65
65
  // headers
@@ -72,7 +72,7 @@ module.exports = function(RED) {
72
72
  // nested listen
73
73
  if (config.listenurl && config.listenurl.length > 0) {
74
74
  data.listen = {
75
- url: new_resolve(RED, config.listenurl, config.listenurlType, node, msg),
75
+ url: await new_resolve(RED, config.listenurl, config.listenurlType, node, msg),
76
76
  mixType: 'stereo'
77
77
  };
78
78
  }
@@ -87,11 +87,11 @@ module.exports = function(RED) {
87
87
  diarization: config.diarization
88
88
  };
89
89
  if (recognizer.vendor === 'google') {
90
- var diarizationMin = new_resolve(RED, config.diarizationmin, config.diarizationminType, node, msg);
91
- var diarizationMax = new_resolve(RED, config.diarizationmax, config.diarizationmaxType, node, msg)
92
- var hints = new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg)
93
- var altlangs = new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg)
94
- var naics = new_resolve(RED, config.naics, config.naicsType, node, msg)
90
+ var diarizationMin = await new_resolve(RED, config.diarizationmin, config.diarizationminType, node, msg);
91
+ var diarizationMax = await new_resolve(RED, config.diarizationmax, config.diarizationmaxType, node, msg)
92
+ var hints = await new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg)
93
+ var altlangs = await new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg)
94
+ var naics = await new_resolve(RED, config.naics, config.naicsType, node, msg)
95
95
  Object.assign(recognizer, {
96
96
  profanityFilter: config.profanityfilter,
97
97
  hints: hints.length > 0 ?
@@ -112,8 +112,8 @@ module.exports = function(RED) {
112
112
  }
113
113
  }
114
114
  else if (recognizer.vendor === 'aws') {
115
- var vocab = new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
116
- var vocabFilter = new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
115
+ var vocab = await new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
116
+ var vocabFilter = await new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
117
117
  Object.assign(recognizer, {
118
118
  vocabularyName: vocab,
119
119
  vocabularyFilterName: vocabFilter,
@@ -121,12 +121,12 @@ module.exports = function(RED) {
121
121
  });
122
122
  }
123
123
  data.transcribe = {
124
- transcriptionHook: new_resolve(RED, config.transcriptionhook, config.transcriptionhookType, node, msg),
124
+ transcriptionHook: await new_resolve(RED, config.transcriptionhook, config.transcriptionhookType, node, msg),
125
125
  recognizer
126
126
  };
127
127
  }
128
128
  // dtmf capture
129
- const dtmfCapture = new_resolve(RED, config.dtmfcapture, config.dtmfcaptureType, node, msg);
129
+ const dtmfCapture = await new_resolve(RED, config.dtmfcapture, config.dtmfcaptureType, node, msg);
130
130
  if (dtmfCapture && dtmfCapture.length) {
131
131
  data.dtmfCapture = dtmfCapture.split(',').map((i) => i.trim());
132
132
  }
@@ -4,22 +4,22 @@ module.exports = function(RED) {
4
4
  function dialogflow(config) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
- node.on('input', function(msg) {
8
- var val = new_resolve(RED, config.inputTimeout, config.inputTimeoutType, node, msg);
7
+ node.on('input', async function(msg) {
8
+ var val = await new_resolve(RED, config.inputTimeout, config.inputTimeoutType, node, msg);
9
9
  var timeout = /^\d+$/.test(val) ? parseInt(val) : 0;
10
- var eventHook = new_resolve(RED, config.eventHook, config.eventHookType, node, msg);
11
- var actionHook = new_resolve(RED, config.actionHook, config.actionHookType, node, msg);
12
- var welcomeEvent = new_resolve(RED, config.welcomeEvent, config.welcomeEventType, node, msg);
13
- var environment = new_resolve(RED, config.environment, config.environmentType, node, msg);
10
+ var eventHook = await new_resolve(RED, config.eventHook, config.eventHookType, node, msg);
11
+ var actionHook = await new_resolve(RED, config.actionHook, config.actionHookType, node, msg);
12
+ var welcomeEvent = await new_resolve(RED, config.welcomeEvent, config.welcomeEventType, node, msg);
13
+ var environment = await new_resolve(RED, config.environment, config.environmentType, node, msg);
14
14
  var welcomeEventParams;
15
15
  if (welcomeEvent && welcomeEvent.length > 0) {
16
- welcomeEventParams = new_resolve(RED, config.welcomeEventParams, config.welcomeEventParamsType, node, msg);
16
+ welcomeEventParams = await new_resolve(RED, config.welcomeEventParams, config.welcomeEventParamsType, node, msg);
17
17
  }
18
- var noInputEvent = new_resolve(RED, config.noinputEvent, config.noinputEventType, node, msg);
18
+ var noInputEvent = await new_resolve(RED, config.noinputEvent, config.noinputEventType, node, msg);
19
19
  const obj = {
20
20
  verb: 'dialogflow',
21
- credentials: new_resolve(RED, config.serviceAccountCredentials, config.serviceAccountCredentialsType, node, msg),
22
- project: new_resolve(RED, config.project, config.projectType, node, msg),
21
+ credentials: await new_resolve(RED, config.serviceAccountCredentials, config.serviceAccountCredentialsType, node, msg),
22
+ project: await new_resolve(RED, config.project, config.projectType, node, msg),
23
23
  lang: config.recognizerlang,
24
24
  bargein: config.bargein
25
25
  };
package/src/nodes/dtmf.js CHANGED
@@ -4,11 +4,11 @@ module.exports = function(RED) {
4
4
  function dtmf(config) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
- node.on('input', function(msg) {
7
+ node.on('input', async function(msg) {
8
8
  appendVerb(msg, {
9
9
  verb: 'dtmf',
10
- dtmf: new_resolve(RED, config.dtmf, config.dtmfType, node, msg),
11
- duration: new_resolve(RED, config.duration, config.durationType, node, msg),
10
+ dtmf: await new_resolve(RED, config.dtmf, config.dtmfType, node, msg),
11
+ duration: await new_resolve(RED, config.duration, config.durationType, node, msg),
12
12
  });
13
13
  node.send(msg);
14
14
  });