@jambonz/node-red-contrib-jambonz 2.4.24 → 2.4.26

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.24",
3
+ "version": "2.4.26",
4
4
  "description": "Node-RED nodes for jambonz platform",
5
5
  "keywords": [
6
6
  "node-red"
@@ -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,
@@ -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,23 +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
88
  }
89
89
 
90
90
  if (config.onHold) {
91
- config.onHoldMusic != '' ? obj.onHoldMusic = new_resolve(RED, config.onHoldMusic, config.onHoldMusicType, node, msg) : null;
91
+ config.onHoldMusic != '' ? obj.onHoldMusic = await new_resolve(RED, config.onHoldMusic, config.onHoldMusicType, node, msg) : null;
92
92
  }
93
93
 
94
94
  if (config.boostAudioSignal) {
95
- config.boostAudioSignal != '' ? obj.boostAudioSignal = new_resolve(RED, config.boostAudioSignalLevel, config.boostAudioSignalLevelType, node, msg) : null;
95
+ config.boostAudioSignal != '' ? obj.boostAudioSignal = await new_resolve(RED, config.boostAudioSignalLevel, config.boostAudioSignalLevelType, node, msg) : null;
96
96
  }
97
97
  appendVerb(msg, obj);
98
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
  });
package/src/nodes/dub.js CHANGED
@@ -6,13 +6,13 @@ module.exports = function(RED) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
8
 
9
- node.on('input', function(msg) {
9
+ node.on('input', async function(msg) {
10
10
  var obj = {
11
11
  verb: 'dub',
12
12
  action: config.action,
13
- track: new_resolve(RED, config.track, config.trackType, node, msg),
14
- play: new_resolve(RED, config.play, config.playType, node, msg),
15
- say: new_resolve(RED, config.say, config.sayType, node, msg),
13
+ track: await new_resolve(RED, config.track, config.trackType, node, msg),
14
+ play: await new_resolve(RED, config.play, config.playType, node, msg),
15
+ say: await new_resolve(RED, config.say, config.sayType, node, msg),
16
16
  loop: config.loop,
17
17
  gain: config.gain
18
18
  };
@@ -5,13 +5,13 @@ module.exports = function(RED) {
5
5
  function enqueue(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg, send, done) {
8
+ node.on('input', async function(msg, send, done) {
9
9
  appendVerb(msg, {
10
10
  verb: 'enqueue',
11
- name: new_resolve(RED, config.queue, config.queueType, node, msg),
12
- priority: new_resolve(RED, config.priority, config.priorityType, node, msg),
13
- actionHook: new_resolve(RED, config.actionHook, config.actionHookType, node, msg),
14
- waitHook: new_resolve(RED, config.waitHook, config.waitHookType, node, msg)
11
+ name: await new_resolve(RED, config.queue, config.queueType, node, msg),
12
+ priority: await new_resolve(RED, config.priority, config.priorityType, node, msg),
13
+ actionHook: await new_resolve(RED, config.actionHook, config.actionHookType, node, msg),
14
+ waitHook: await new_resolve(RED, config.waitHook, config.waitHookType, node, msg)
15
15
  });
16
16
  node.send(msg);
17
17
  });
@@ -5,14 +5,14 @@ module.exports = function(RED) {
5
5
  function gather(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg) {
8
+ node.on('input', async function(msg) {
9
9
 
10
10
  // simple properties
11
11
  node.log(`config: ${JSON.stringify(config)}`);
12
12
 
13
13
  var obj = {verb: 'gather', input: []};
14
- if (config.actionhook) obj.actionHook = new_resolve(RED, config.actionhook, config.actionhookType, node, msg)
15
- if (config.partialresulthook) obj.partialResultHook = new_resolve(RED, config.partialresulthook, config.partialresulthookType, node, msg)
14
+ if (config.actionhook) obj.actionHook = await new_resolve(RED, config.actionhook, config.actionhookType, node, msg)
15
+ if (config.partialresulthook) obj.partialResultHook = await new_resolve(RED, config.partialresulthook, config.partialresulthookType, node, msg)
16
16
 
17
17
  // input
18
18
  if (config.speechinput) {
@@ -22,9 +22,9 @@ module.exports = function(RED) {
22
22
  language: config.recognizerlang
23
23
  };
24
24
  if (recognizer.vendor === 'google') {
25
- var hints = new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg);
26
- var altlangs = new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg);
27
- var naics = new_resolve(RED, config.naics, config.naicsType, node, msg);
25
+ var hints = await new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg);
26
+ var altlangs = await new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg);
27
+ var naics = await new_resolve(RED, config.naics, config.naicsType, node, msg);
28
28
  Object.assign(recognizer, {
29
29
  profanityFilter: config.profanityfilter,
30
30
  hints: hints.length > 0 ?
@@ -37,8 +37,8 @@ module.exports = function(RED) {
37
37
  }
38
38
  }
39
39
  else if (recognizer.vendor === 'aws') {
40
- var vocab = new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
41
- var vocabFilter = new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
40
+ var vocab = await new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
41
+ var vocabFilter = await new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
42
42
  Object.assign(recognizer, {
43
43
  vocabularyName: vocab,
44
44
  vocabularyFilterName: vocabFilter,
@@ -74,7 +74,7 @@ module.exports = function(RED) {
74
74
  });
75
75
  }
76
76
  }
77
- else obj.play = {url: new_resolve(RED, config.playurl, config.playurlType, node, msg)};
77
+ else obj.play = {url: await new_resolve(RED, config.playurl, config.playurlType, node, msg)};
78
78
 
79
79
  node.log(`gather: ${JSON.stringify(obj)}`);
80
80
 
@@ -7,11 +7,11 @@ module.exports = function(RED) {
7
7
  var node = this;
8
8
  const server = RED.nodes.getNode(config.server);
9
9
  const {accountSid, apiToken} = server.credentials;
10
- node.on('input', async(msg, send, done) => {
10
+ node.on('input', async (msg, send, done) => {
11
11
  const data = {
12
- page: new_resolve(RED, config.page, config.pageType, node, msg),
13
- count: new_resolve(RED, config.count, config.countType, node, msg),
14
- days: new_resolve(RED, config.days, config.daysType, node, msg),
12
+ page: await new_resolve(RED, config.page, config.pageType, node, msg),
13
+ count: await new_resolve(RED, config.count, config.countType, node, msg),
14
+ days: await new_resolve(RED, config.days, config.daysType, node, msg),
15
15
  }
16
16
  Object.keys(data).forEach((k) => data[k] == null || data[k] == '' && delete data[k]);
17
17
  const params = new URLSearchParams(data).toString()
@@ -8,7 +8,7 @@ module.exports = function (RED) {
8
8
  const server = RED.nodes.getNode(config.server);
9
9
  const { accountSid, apiToken } = server.credentials;
10
10
  node.on("input", async (msg, send, done) => {
11
- const callSid = new_resolve(RED, config.callSid, config.callSidType, node, msg);
11
+ const callSid = await new_resolve(RED, config.callSid, config.callSidType, node, msg);
12
12
  if (!callSid) {
13
13
  if (done) done(new Error('CallSid empty'));
14
14
  else node.error(new Error('CallSid empty'), msg);
@@ -9,10 +9,10 @@ module.exports = function (RED) {
9
9
  const { accountSid, apiToken } = server.credentials;
10
10
  node.on("input", async (msg, send, done) => {
11
11
  const data = {
12
- direction: new_resolve(RED, config.direction, config.directionType, node, msg),
13
- from: new_resolve(RED, config.from, config.fromType, node, msg),
14
- to: new_resolve(RED, config.to, config.toType, node, msg),
15
- callStatus: new_resolve(RED, config.callStatus, config.callStatusType, node, msg),
12
+ direction: await new_resolve(RED, config.direction, config.directionType, node, msg),
13
+ from: await new_resolve(RED, config.from, config.fromType, node, msg),
14
+ to: await new_resolve(RED, config.to, config.toType, node, msg),
15
+ callStatus: await new_resolve(RED, config.callStatus, config.callStatusType, node, msg),
16
16
  };
17
17
  Object.keys(data).forEach(
18
18
  (k) => data[k] == null || (data[k] == '' && delete data[k])
@@ -7,13 +7,13 @@ module.exports = function(RED) {
7
7
  var node = this;
8
8
  const server = RED.nodes.getNode(config.server);
9
9
  const {accountSid, apiToken} = server.credentials;
10
- node.on('input', async(msg, send, done) => {
10
+ node.on('input', async (msg, send, done) => {
11
11
  const data = {
12
- direction: new_resolve(RED, config.direction, config.directionType, node, msg),
13
- trunk: new_resolve(RED, config.trunk, config.trunkType, node, msg),
14
- page: new_resolve(RED, config.page, config.pageType, node, msg),
15
- count: new_resolve(RED, config.count, config.countType, node, msg),
16
- days: new_resolve(RED, config.days, config.daysType, node, msg),
12
+ direction: await new_resolve(RED, config.direction, config.directionType, node, msg),
13
+ trunk: await new_resolve(RED, config.trunk, config.trunkType, node, msg),
14
+ page: await new_resolve(RED, config.page, config.pageType, node, msg),
15
+ count: await new_resolve(RED, config.count, config.countType, node, msg),
16
+ days: await new_resolve(RED, config.days, config.daysType, node, msg),
17
17
  }
18
18
  Object.keys(data).forEach((k) => data[k] == null || data[k] == '' && delete data[k]);
19
19
  const params = new URLSearchParams(data).toString();
@@ -4,7 +4,7 @@ module.exports = function(RED) {
4
4
  function hangup(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
  var data = {
9
9
  verb: 'hangup'
10
10
  };
@@ -60,10 +60,16 @@
60
60
  return action !== 'send_dtmf' || v.length > 0;
61
61
  }},
62
62
  dtmfDigitType: {value: 'str'},
63
- dtmfDuration: {value: ''},
63
+ dtmfDuration: {value: '', validate: function(v) {
64
+ const action = $('#node-input-action').val();
65
+ return action !== 'send_dtmf' || v.length > 0;
66
+ }},
64
67
  dtmfDurationType: {value: 'str'},
65
- tag: {value: ''},
66
- tagType: {value: 'str'},
68
+ tag: {value: '{}', validate: function(v) {
69
+ const action = $('#node-input-action').val();
70
+ return action !== 'tag' || v.length > 0;
71
+ }},
72
+ tagType: {value: 'json'},
67
73
  },
68
74
  inputs:1,
69
75
  outputs:1,
@@ -118,7 +124,7 @@
118
124
  });
119
125
  $('#node-input-sipRequestHeaders').typedInput({
120
126
  default: $('#node-input-sipRequestHeadersType').val(),
121
- types: ['json','msg', 'flow', 'global'],
127
+ types: ['msg', 'flow', 'global', 'json', 'jsonata'],
122
128
  typeField: $('#node-input-sipRequestHeadersType')
123
129
  });
124
130
  $('#node-input-siprecServerURL').typedInput({
@@ -143,7 +149,7 @@
143
149
  });
144
150
  $('#node-input-tag').typedInput({
145
151
  default: $('#node-input-tagType').val(),
146
- types: ['json', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
152
+ types: ['msg', 'flow', 'global', 'json', 'jsonata', 'env', mustacheType],
147
153
  typeField: $('#node-input-tagType')
148
154
  });
149
155
 
package/src/nodes/lcc.js CHANGED
@@ -8,12 +8,12 @@ function lcc(config) {
8
8
  var node = this;
9
9
  const server = RED.nodes.getNode(config.server);
10
10
 
11
- node.on('input', async(msg, send, done) => {
11
+ node.on('input', async (msg, send, done) => {
12
12
  send = send || function() { node.send.apply(node, arguments);};
13
13
 
14
14
  const {accountSid, apiToken} = server.credentials;
15
15
  const url = server.url;
16
- const callSid = new_resolve(RED, config.callSid, config.callSidType, node, msg);
16
+ const callSid = await new_resolve(RED, config.callSid, config.callSidType, node, msg);
17
17
  if (!url || !accountSid || !apiToken || !callSid) {
18
18
  node.log(`invalid / missing credentials or callSid, skipping LCC node: ${JSON.stringify(server.credentials)}`);
19
19
  send(msg);
@@ -51,17 +51,18 @@ function lcc(config) {
51
51
  opts.transcribe_status = 'resume';
52
52
  break;
53
53
  case 'redirect':
54
- opts.call_hook = {url: new_resolve(RED, config.callHook, config.callHookType, node, msg)};
54
+ opts.call_hook = {url: await new_resolve(RED, config.callHook, config.callHookType, node, msg)};
55
55
  if (config.childCallHook) {
56
- opts.child_call_hook = {url: new_resolve(RED, config.childCallHook, config.childCallHookType, node, msg)};
56
+ opts.child_call_hook = {url: await new_resolve(RED, config.childCallHook, config.childCallHookType, node, msg)};
57
57
  }
58
58
  break;
59
59
  case 'hold_conf':
60
60
  opts.conf_hold_status = 'hold';
61
- opts.wait_hook = {url: new_resolve(RED, config.waitHook, config.waitHookType, node, msg)};
61
+ opts.wait_hook = {url: await new_resolve(RED, config.waitHook, config.waitHookType, node, msg)};
62
62
  break;
63
63
  case 'unhold_conf':
64
64
  opts.conf_hold_status = 'unhold';
65
+ break;
65
66
  case 'whisper':
66
67
  Object.assign(opts, {
67
68
  whisper: {
@@ -82,16 +83,16 @@ function lcc(config) {
82
83
  case 'sip_request':
83
84
  opts.sip_request = {
84
85
  method: config.sipRequestMethod,
85
- content_type: new_resolve(RED, config.sipRequestContentType, config.sipRequestContentTypeType, node, msg),
86
- content: new_resolve(RED, config.sipRequestBody, config.sipRequestBodyType, node, msg),
87
- headers: new_resolve(RED, config.sipRequestHeaders, config.sipRequestHeadersType, node, msg) || {}
86
+ content_type: await new_resolve(RED, config.sipRequestContentType, config.sipRequestContentTypeType, node, msg),
87
+ content: await new_resolve(RED, config.sipRequestBody, config.sipRequestBodyType, node, msg),
88
+ headers: await new_resolve(RED, config.sipRequestHeaders, config.sipRequestHeadersType, node, msg) || {}
88
89
  };
89
90
  break;
90
91
  case 'start_call_recording':
91
92
  opts.record = {
92
93
  action: 'startCallRecording',
93
- siprecServerURL: new_resolve(RED, config.siprecServerURL, config.siprecServerURLType, node, msg),
94
- recordingID: new_resolve(RED, config.recordingID, config.recordingIDType, node, msg) || crypto.randomUUID()
94
+ siprecServerURL: await new_resolve(RED, config.siprecServerURL, config.siprecServerURLType, node, msg),
95
+ recordingID: await new_resolve(RED, config.recordingID, config.recordingIDType, node, msg) || crypto.randomUUID()
95
96
  };
96
97
  // SIPREC headers
97
98
  if (config.siprecHeaders) {
@@ -115,12 +116,12 @@ function lcc(config) {
115
116
  break;
116
117
  case 'send_dtmf':
117
118
  opts.dtmf = {
118
- digit: new_resolve(RED, config.dtmfDigit, config.dtmfDigitType, node, msg),
119
- duration: new_resolve(RED, config.dtmfDuration, config.dtmfDurationType, node, msg) || '250'
119
+ digit: await new_resolve(RED, config.dtmfDigit, config.dtmfDigitType, node, msg),
120
+ duration: await new_resolve(RED, config.dtmfDuration, config.dtmfDurationType, node, msg) || '250'
120
121
  };
121
122
  break;
122
123
  case 'tag':
123
- opts.tag = new_resolve(RED, config.tag, config.tagType, node, msg);
124
+ opts.tag = await new_resolve(RED, config.tag, config.tagType, node, msg);
124
125
  break;
125
126
  default:
126
127
  node.log(`invalid action: ${config.action}`);
package/src/nodes/lex.js CHANGED
@@ -6,27 +6,27 @@ module.exports = function(RED) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
8
  const awsCreds = RED.nodes.getNode(config.aws);
9
- node.on('input', function(msg) {
9
+ node.on('input', async function(msg) {
10
10
  let accessKey, secretAccessKey;
11
11
  if (awsCreds && awsCreds.credentials) {
12
12
  accessKey = awsCreds.credentials.accessKey;
13
13
  secretAccessKey = awsCreds.credentials.secretAccessKey;
14
14
  }
15
- var eventHook = new_resolve(RED, config.eventHook, config.eventHookType, node, msg);
16
- var actionHook = new_resolve(RED, config.actionHook, config.actionHookType, node, msg);
17
- var botId = new_resolve(RED, config.bot, config.botType, node, msg);
18
- var botAlias = new_resolve(RED, config.alias, config.aliasType, node, msg);
19
- var locale = new_resolve(RED, config.locale, config.localeType, node, msg) || 'en_US';
20
- var val = new_resolve(RED, config.inputTimeout, config.inputTimeoutType, node, msg);
15
+ var eventHook = await new_resolve(RED, config.eventHook, config.eventHookType, node, msg);
16
+ var actionHook = await new_resolve(RED, config.actionHook, config.actionHookType, node, msg);
17
+ var botId = await new_resolve(RED, config.bot, config.botType, node, msg);
18
+ var botAlias = await new_resolve(RED, config.alias, config.aliasType, node, msg);
19
+ var locale = await new_resolve(RED, config.locale, config.localeType, node, msg) || 'en_US';
20
+ var val = await new_resolve(RED, config.inputTimeout, config.inputTimeoutType, node, msg);
21
21
  var timeout = /^\d+$/.test(val) ? parseInt(val) : 0;
22
22
  var slots, intentName;
23
23
  if (config.specifyIntent) {
24
- intentName = new_resolve(RED, config.intent, config.intentType, node, msg);
24
+ intentName = await new_resolve(RED, config.intent, config.intentType, node, msg);
25
25
  if (intentName) {
26
- slots = new_resolve(RED, config.slots, config.slotsType, node, msg);
26
+ slots = await new_resolve(RED, config.slots, config.slotsType, node, msg);
27
27
  }
28
28
  }
29
- var metadata = new_resolve(RED, config.metadata, config.metadataType, node, msg);
29
+ var metadata = await new_resolve(RED, config.metadata, config.metadataType, node, msg);
30
30
 
31
31
  const obj = {
32
32
  verb: 'lex',
package/src/nodes/libs.js CHANGED
@@ -45,7 +45,7 @@ exports.appendVerb = (msg, obj) => {
45
45
  return mustache.render('{{' + val + '}}', data);
46
46
  }
47
47
 
48
- exports.new_resolve = (RED, val, valtype, node, msg) => {
48
+ exports.new_resolve = async (RED, val, valtype, node, msg) => {
49
49
  if (!val || !valtype) return val;
50
50
  switch (valtype) {
51
51
  case 'str':
@@ -56,7 +56,12 @@ exports.appendVerb = (msg, obj) => {
56
56
  case 'flow':
57
57
  case 'global':
58
58
  case 'jsonata':
59
- return RED.util.evaluateNodeProperty(val, valtype, node, msg);
59
+ try {
60
+ return await asyncEvaluateNodeProperty(RED, val, valtype, node, msg);
61
+ } catch (e) {
62
+ node.error(`Error evaluating ${valtype} property: ${e.message}`);
63
+ return null;
64
+ }
60
65
  case 'mustache':
61
66
  let data = dataobject(node.context(), msg);
62
67
  return mustache.render(val, data);
@@ -64,6 +69,19 @@ exports.appendVerb = (msg, obj) => {
64
69
  return JSON.parse(val);
65
70
  }
66
71
  }
72
+
73
+ function asyncEvaluateNodeProperty(RED, value, type, node, msg) {
74
+ return new Promise(function (resolve, reject) {
75
+ RED.util.evaluateNodeProperty(value, type, node, msg, function (e, r) {
76
+ if (e) {
77
+ reject(e);
78
+ } else {
79
+ resolve(r);
80
+ }
81
+ });
82
+ });
83
+ }
84
+
67
85
  function dataobject(context, msg){
68
86
  let data = Object.assign({}, msg);
69
87
  data.global = {};
@@ -4,11 +4,11 @@ module.exports = function(RED) {
4
4
  function listen(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
  const obj = {
9
9
  verb: 'listen',
10
- url: new_resolve(RED, config.url, config.urlType, node, msg),
11
- actionHook: new_resolve(RED, config.actionhook, config.actionhookType, node, msg),
10
+ url: await new_resolve(RED, config.url, config.urlType, node, msg),
11
+ actionHook: await new_resolve(RED, config.actionhook, config.actionhookType, node, msg),
12
12
  finishOnKey: config.finishonkey,
13
13
  mixType: config.mixtype,
14
14
  playBeep: config.beep,
@@ -17,8 +17,8 @@ module.exports = function(RED) {
17
17
  sampleRate: config.sampleRate,
18
18
  };
19
19
 
20
- const authUser = new_resolve(RED, config.authuser, config.authuserType, node, msg);
21
- const authPass = new_resolve(RED, config.authpass, config.authpassType, node, msg);
20
+ const authUser = await new_resolve(RED, config.authuser, config.authuserType, node, msg);
21
+ const authPass = await new_resolve(RED, config.authpass, config.authpassType, node, msg);
22
22
  if (authUser && authPass) {
23
23
  obj.wsAuth = {
24
24
  username: authUser,
@@ -35,11 +35,11 @@ module.exports = function(RED) {
35
35
  diarization: config.diarization
36
36
  };
37
37
  if (recognizer.vendor === 'google') {
38
- var diarizationMin = new_resolve(RED, config.diarizationmin, config.diarizationminType, node, msg);
39
- var diarizationMax = new_resolve(RED, config.diarizationmax, config.diarizationmaxType, node, msg);
40
- var hints = new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg);
41
- var altlangs = new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg);
42
- var naics = new_resolve(RED, config.naics, config.naicsType, node, msg);
38
+ var diarizationMin = await new_resolve(RED, config.diarizationmin, config.diarizationminType, node, msg);
39
+ var diarizationMax = await new_resolve(RED, config.diarizationmax, config.diarizationmaxType, node, msg);
40
+ var hints = await new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg);
41
+ var altlangs = await new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg);
42
+ var naics = await new_resolve(RED, config.naics, config.naicsType, node, msg);
43
43
  Object.assign(recognizer, {
44
44
  profanityFilter: config.profanityfilter,
45
45
  hints: hints.length > 0 ?
@@ -60,8 +60,8 @@ module.exports = function(RED) {
60
60
  }
61
61
  }
62
62
  else if (recognizer.vendor === 'aws') {
63
- var vocab = new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
64
- var vocabFilter = new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
63
+ var vocab = await new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
64
+ var vocabFilter = await new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
65
65
  Object.assign(recognizer, {
66
66
  vocabularyName: vocab,
67
67
  vocabularyFilterName: vocabFilter,
@@ -69,7 +69,7 @@ module.exports = function(RED) {
69
69
  });
70
70
  }
71
71
  obj.transcribe = {
72
- transcriptionHook: new_resolve(RED, config.transcriptionhook, config.transcriptionhookType, node, msg),
72
+ transcriptionHook: await new_resolve(RED, config.transcriptionhook, config.transcriptionhookType, node, msg),
73
73
  recognizer
74
74
  };
75
75
  }
@@ -77,7 +77,7 @@ module.exports = function(RED) {
77
77
  if (/^\d+$/.test(config.maxlength)) obj.maxLength = parseInt(config.maxLength);
78
78
  if (config.finishonkey.length) obj.finishOnKey = config.finishonkey;
79
79
 
80
- var data = new_resolve(RED, config.metadata, config.metadataType, node, msg);
80
+ var data = await new_resolve(RED, config.metadata, config.metadataType, node, msg);
81
81
  if (data) obj.metadata = data;
82
82
 
83
83
  appendVerb(msg, obj);
@@ -4,11 +4,11 @@ module.exports = function (RED) {
4
4
  function message(config) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
- node.on("input", function (msg, send, done) {
8
- var from = new_resolve(RED, config.from, config.fromType, node, msg);
9
- var to =new_resolve(RED, config.to, config.toType, node, msg);
10
- var text = new_resolve(RED, config.text, config.textType, node, msg);
11
- var provider = new_resolve(RED, config.provider, config.providerType, node, msg);
7
+ node.on("input", async function(msg, send, done) {
8
+ var from = await new_resolve(RED, config.from, config.fromType, node, msg);
9
+ var to = await new_resolve(RED, config.to, config.toType, node, msg);
10
+ var text = await new_resolve(RED, config.text, config.textType, node, msg);
11
+ var provider = await new_resolve(RED, config.provider, config.providerType, node, msg);
12
12
  if ((!provider || 0 === provider.length) && msg.sms.provider) {
13
13
  provider = msg.sms.provider;
14
14
  }
@@ -5,8 +5,8 @@ module.exports = function(RED) {
5
5
  function pause(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg) {
9
- var length = new_resolve(RED, config.len, config.lenType, node, msg);
8
+ node.on('input', async function(msg) {
9
+ var length = await new_resolve(RED, config.len, config.lenType, node, msg);
10
10
  appendVerb(msg, {
11
11
  verb: 'pause',
12
12
  length
package/src/nodes/play.js CHANGED
@@ -4,15 +4,15 @@ module.exports = function(RED) {
4
4
  function play(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: 'play',
10
- url: new_resolve(RED, config.url, config.urlType, node, msg),
10
+ url: await new_resolve(RED, config.url, config.urlType, node, msg),
11
11
  earlyMedia: config.early,
12
12
  loop: config.loop,
13
- timeoutSecs: config.timeout ? new_resolve(RED, config.timeout, config.timeoutType, node, msg) : null,
14
- seekOffset: config.offset ? new_resolve(RED, config.offset, config.offsetType, node, msg) : null,
15
- actionHook: config.hook ? new_resolve(RED, config.hook, config.hookType, node, msg) : null
13
+ timeoutSecs: config.timeout ? await new_resolve(RED, config.timeout, config.timeoutType, node, msg) : null,
14
+ seekOffset: config.offset ? await new_resolve(RED, config.offset, config.offsetType, node, msg) : null,
15
+ actionHook: config.hook ? await new_resolve(RED, config.hook, config.hookType, node, msg) : null
16
16
  });
17
17
  node.send(msg);
18
18
  });
package/src/nodes/rasa.js CHANGED
@@ -4,12 +4,12 @@ module.exports = function(RED) {
4
4
  function rasa(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: 'rasa'}
9
- obj.url = new_resolve(RED, config.url, config.urlType, node, msg);
10
- obj.prompt = new_resolve(RED, config.prompt, config.promptType, node, msg);
11
- obj.eventHook = new_resolve(RED, config.eventHook, config.eventHookType, node, msg);
12
- obj.actionHook = new_resolve(RED, config.actionHook, config.actionHookType, node, msg);
9
+ obj.url = await new_resolve(RED, config.url, config.urlType, node, msg);
10
+ obj.prompt = await new_resolve(RED, config.prompt, config.promptType, node, msg);
11
+ obj.eventHook = await new_resolve(RED, config.eventHook, config.eventHookType, node, msg);
12
+ obj.actionHook = await new_resolve(RED, config.actionHook, config.actionHookType, node, msg);
13
13
  appendVerb(msg, obj);
14
14
  node.send(msg);
15
15
  });
@@ -5,8 +5,8 @@ module.exports = function(RED) {
5
5
  function redirect(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg, send, done) {
9
- var actionHook = new_resolve(RED, config.hook, config.hookType, node, msg);
8
+ node.on('input', async function(msg, send, done) {
9
+ var actionHook = await new_resolve(RED, config.hook, config.hookType, node, msg);
10
10
  appendVerb(msg, {
11
11
  verb: 'redirect',
12
12
  actionHook
package/src/nodes/say.js CHANGED
@@ -9,8 +9,8 @@ module.exports = function(RED) {
9
9
  this.loop = config.loop;
10
10
  var node = this;
11
11
 
12
- node.on('input', function(msg) {
13
- const text = new_resolve(RED, config.text, 'mustache', node, msg);
12
+ node.on('input', async function(msg) {
13
+ const text = await new_resolve(RED, config.text, 'mustache', node, msg);
14
14
  var obj = {
15
15
  verb: 'say',
16
16
  text,
@@ -5,15 +5,15 @@ module.exports = function(RED) {
5
5
  function sip_decline(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg) {
9
- var status = new_resolve(RED, config.status, config.statusType, node, msg);
10
- var reason = new_resolve(RED, config.reason, config.reasonType, node, msg);
8
+ node.on('input', async function(msg) {
9
+ var status = await new_resolve(RED, config.status, config.statusType, node, msg);
10
+ var reason = await new_resolve(RED, config.reason, config.reasonType, node, msg);
11
11
  var obj = {
12
12
  verb: 'sip:decline',
13
13
  status: parseInt(status),
14
14
  reason
15
15
  }
16
- config.headers ? obj.headers = new_resolve(RED, config.headers, config.headersType, node, msg) : null
16
+ config.headers ? obj.headers = await new_resolve(RED, config.headers, config.headersType, node, msg) : null
17
17
  if (typeof obj.headers == 'string'){
18
18
  obj.headers = JSON.parse(obj.headers)
19
19
  }
@@ -4,7 +4,7 @@ module.exports = function(RED) {
4
4
  function sip_refer(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
  Object.keys(config).forEach(function(key, index) {
9
9
  if (config[key] == ''){
10
10
  config[key] = false
@@ -12,15 +12,15 @@ module.exports = function(RED) {
12
12
  });
13
13
  obj = {
14
14
  verb: 'sip:refer',
15
- referTo: new_resolve(RED, config.referTo, config.referToType, node, msg)
15
+ referTo: await new_resolve(RED, config.referTo, config.referToType, node, msg)
16
16
  }
17
- config.headers ? obj.headers = new_resolve(RED, config.headers, config.headersType, node, msg) : null
17
+ config.headers ? obj.headers = await new_resolve(RED, config.headers, config.headersType, node, msg) : null
18
18
  if (typeof obj.headers == 'string'){
19
19
  obj.headers = JSON.parse(obj.headers)
20
20
  }
21
- config.referredBy ? obj.referredBy = new_resolve(RED, config.referredBy, config.referredByType, node, msg) : null
22
- config.actionHook ? obj.actionHook = new_resolve(RED, config.actionHook, config.actionHookType, node, msg) : null
23
- config.eventHook ? obj.eventHook = new_resolve(RED, config.eventHook, config.eventHookType, node, msg) : null
21
+ config.referredBy ? obj.referredBy = await new_resolve(RED, config.referredBy, config.referredByType, node, msg) : null
22
+ config.actionHook ? obj.actionHook = await new_resolve(RED, config.actionHook, config.actionHookType, node, msg) : null
23
+ config.eventHook ? obj.eventHook = await new_resolve(RED, config.eventHook, config.eventHookType, node, msg) : null
24
24
  appendVerb(msg, obj)
25
25
  node.send(msg);
26
26
  });
@@ -5,7 +5,7 @@ module.exports = function(RED) {
5
5
  function sip_request(config) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
- node.on('input', function(msg) {
8
+ node.on('input', async function(msg) {
9
9
  obj = {
10
10
  verb: 'sip:request',
11
11
  method: config.method
@@ -15,12 +15,12 @@ module.exports = function(RED) {
15
15
  config[key] = false
16
16
  };
17
17
  });
18
- config.headers ? obj.headers = new_resolve(RED, config.headers, config.headersType, node, msg) : null
18
+ config.headers ? obj.headers = await new_resolve(RED, config.headers, config.headersType, node, msg) : null
19
19
  if (typeof obj.headers == 'string'){
20
20
  obj.headers = JSON.parse(obj.headers)
21
21
  }
22
- config.body ? obj.body = new_resolve(RED, config.body, config.bodyType, node, msg) : null
23
- config.actionHook ? obj.actionHook = new_resolve(RED, config.actionHook, config.actionHookType, node, msg) : null
22
+ config.body ? obj.body = await new_resolve(RED, config.body, config.bodyType, node, msg) : null
23
+ config.actionHook ? obj.actionHook = await new_resolve(RED, config.actionHook, config.actionHookType, node, msg) : null
24
24
  appendVerb(msg, obj)
25
25
  node.send(msg);
26
26
  });
package/src/nodes/tag.js CHANGED
@@ -4,8 +4,8 @@ module.exports = function(RED) {
4
4
  function tag(config) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
- node.on('input', function(msg) {
8
- var data = new_resolve(RED, config.data, config.dataType, node, msg);
7
+ node.on('input', async function(msg) {
8
+ var data = await new_resolve(RED, config.data, config.dataType, node, msg);
9
9
  if (typeof(data) != 'object'){
10
10
  data = JSON.parse(data)
11
11
  }
@@ -6,17 +6,17 @@ module.exports = function(RED) {
6
6
  function userauth(config) {
7
7
  RED.nodes.createNode(this, config);
8
8
  var node = this;
9
- node.on('input', function(msg) {
9
+ node.on('input', async function(msg) {
10
10
  var attemptedAuthentication = false;
11
11
  var auth = msg.authRequest;
12
12
  var authResponse = {};
13
13
  var ha1_string;
14
14
  if (config.ha1 && config.ha1.length) {
15
- ha1_string = new_resolve(RED, config.ha1, config.ha1Type, node, msg),
15
+ ha1_string = await new_resolve(RED, config.ha1, config.ha1Type, node, msg),
16
16
  attemptedAuthentication = true;
17
17
  }
18
18
  else if (config.password && config.password.length) {
19
- var password = new_resolve(RED, config.password, config.passwordType, node, msg);
19
+ var password = await new_resolve(RED, config.password, config.passwordType, node, msg);
20
20
  var ha1 = createHash('md5');
21
21
  ha1.update([auth.username, auth.realm, password].join(':'));
22
22
  ha1_string = ha1.digest('hex');
@@ -51,15 +51,15 @@ module.exports = function(RED) {
51
51
  if (calculated === auth.response) {
52
52
  let grantedExpires = auth.expires;
53
53
  if (config.expires && config.expires.length) {
54
- const expires = new_resolve(RED, config.expires, config.expiresType, node, msg);
54
+ const expires = await new_resolve(RED, config.expires, config.expiresType, node, msg);
55
55
  if (auth.expires && expires != null) {
56
56
  grantedExpires = Math.min(auth.expires, expires);
57
57
  }
58
58
  }
59
- const application = new_resolve(RED, config.application, config.applicationType, node, msg);
60
- const directUser = new_resolve(RED, config.directUser, config.directUserType, node, msg);
61
- const directApp = new_resolve(RED, config.directApp, config.directAppType, node, msg);
62
- const directQueue = new_resolve(RED, config.directQueue, config.directQueueType, node, msg);
59
+ const application = await new_resolve(RED, config.application, config.applicationType, node, msg);
60
+ const directUser = await new_resolve(RED, config.directUser, config.directUserType, node, msg);
61
+ const directApp = await new_resolve(RED, config.directApp, config.directAppType, node, msg);
62
+ const directQueue = await new_resolve(RED, config.directQueue, config.directQueueType, node, msg);
63
63
  Object.assign(authResponse, {
64
64
  status: 'ok',
65
65
  expires: grantedExpires != null ? grantedExpires : null,