@jambonz/node-red-contrib-jambonz 2.3.11 → 2.4.2

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.
Files changed (60) hide show
  1. package/package.json +5 -5
  2. package/resources/editor.js +5 -3
  3. package/resources/icons/mustache.svg +1 -0
  4. package/src/nodes/{template.js → _template.js} +1 -1
  5. package/src/nodes/conference.html +11 -4
  6. package/src/nodes/conference.js +5 -7
  7. package/src/nodes/config.html +17 -17
  8. package/src/nodes/config.js +18 -18
  9. package/src/nodes/create_call.html +11 -4
  10. package/src/nodes/create_call.js +5 -5
  11. package/src/nodes/create_sms.html +11 -4
  12. package/src/nodes/create_sms.js +5 -5
  13. package/src/nodes/dequeue.html +11 -5
  14. package/src/nodes/dequeue.js +6 -6
  15. package/src/nodes/dial.html +25 -20
  16. package/src/nodes/dial.js +18 -19
  17. package/src/nodes/dialogflow.html +16 -10
  18. package/src/nodes/dialogflow.js +10 -11
  19. package/src/nodes/dtmf.html +8 -2
  20. package/src/nodes/dtmf.js +3 -3
  21. package/src/nodes/enqueue.html +10 -4
  22. package/src/nodes/enqueue.js +5 -7
  23. package/src/nodes/gather.html +17 -5
  24. package/src/nodes/gather.js +8 -8
  25. package/src/nodes/get_alerts.html +9 -3
  26. package/src/nodes/get_alerts.js +4 -4
  27. package/src/nodes/get_calls.html +10 -4
  28. package/src/nodes/get_calls.js +5 -10
  29. package/src/nodes/get_recent_calls.html +12 -5
  30. package/src/nodes/get_recent_calls.js +6 -6
  31. package/src/nodes/lcc.html +12 -5
  32. package/src/nodes/lcc.js +6 -6
  33. package/src/nodes/lex.html +25 -10
  34. package/src/nodes/lex.js +10 -11
  35. package/src/nodes/libs.js +36 -0
  36. package/src/nodes/listen.html +14 -7
  37. package/src/nodes/listen.js +12 -12
  38. package/src/nodes/message.html +10 -4
  39. package/src/nodes/message.js +5 -10
  40. package/src/nodes/pause.html +8 -1
  41. package/src/nodes/pause.js +2 -3
  42. package/src/nodes/play.html +9 -1
  43. package/src/nodes/play.js +2 -2
  44. package/src/nodes/rasa.html +10 -4
  45. package/src/nodes/rasa.js +5 -5
  46. package/src/nodes/redirect.html +7 -1
  47. package/src/nodes/redirect.js +2 -2
  48. package/src/nodes/say.html +1 -1
  49. package/src/nodes/say.js +2 -2
  50. package/src/nodes/sip-decline.html +8 -2
  51. package/src/nodes/sip-decline.js +3 -3
  52. package/src/nodes/sip-refer.html +11 -5
  53. package/src/nodes/sip-refer.js +6 -6
  54. package/src/nodes/sip-request.html +9 -3
  55. package/src/nodes/sip-request.js +4 -4
  56. package/src/nodes/tag.html +7 -1
  57. package/src/nodes/tag.js +2 -2
  58. package/src/nodes/userauth.html +11 -5
  59. package/src/nodes/userauth.js +6 -6
  60. /package/src/nodes/{template.html → _template.html} +0 -0
package/src/nodes/lcc.js CHANGED
@@ -1,5 +1,5 @@
1
1
  var crypto = require('crypto');
2
- var {v_resolve, doLCC} = require('./libs')
2
+ var {new_resolve, doLCC} = require('./libs')
3
3
 
4
4
  module.exports = function(RED) {
5
5
  /** LCC */
@@ -13,7 +13,7 @@ function lcc(config) {
13
13
 
14
14
  const {accountSid, apiToken} = server.credentials;
15
15
  const url = server.url;
16
- const callSid = v_resolve(config.callSid, config.callSidType, this.context(), msg);
16
+ const callSid = 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);
@@ -45,11 +45,11 @@ function lcc(config) {
45
45
  opts.listen_status = 'resume';
46
46
  break;
47
47
  case 'redirect':
48
- opts.call_hook = {url: v_resolve(config.callHook, config.callHookType, this.context(), msg)};
48
+ opts.call_hook = {url: new_resolve(RED, config.callHook, config.callHookType, node, msg)};
49
49
  break;
50
50
  case 'hold_conf':
51
51
  opts.conf_hold_status = 'hold';
52
- opts.wait_hook = {url: v_resolve(config.waitHook, config.waitHookType, this.context(), msg)};
52
+ opts.wait_hook = {url: new_resolve(RED, config.waitHook, config.waitHookType, node, msg)};
53
53
  break;
54
54
  case 'unhold_conf':
55
55
  opts.conf_hold_status = 'unhold';
@@ -73,8 +73,8 @@ function lcc(config) {
73
73
  case 'start_call_recording':
74
74
  opts.record = {
75
75
  action: 'startCallRecording',
76
- siprecServerURL: v_resolve(config.siprecServerURL, config.siprecServerURLType, this.context(), msg),
77
- recordingID: v_resolve(config.recordingID, config.recordingIDType, this.context(), msg) || crypto.randomUUID()
76
+ siprecServerURL: new_resolve(RED, config.siprecServerURL, config.siprecServerURLType, node, msg),
77
+ recordingID: new_resolve(RED, config.recordingID, config.recordingIDType, node, msg) || crypto.randomUUID()
78
78
  };
79
79
  break;
80
80
  case 'stop_call_recording':
@@ -1,6 +1,12 @@
1
1
  <!-- Javascript -->
2
2
  <script src="resources/@jambonz/node-red-contrib-jambonz/editor.js"></script>
3
3
  <script type="text/javascript">
4
+ var mustacheType = {
5
+ value: 'mustache',
6
+ label: 'mustache',
7
+ hasvalue: true,
8
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
9
+ }
4
10
  RED.nodes.registerType('lex',{
5
11
  category: 'jambonz',
6
12
  color: '#bbabaa',
@@ -48,33 +54,42 @@
48
54
 
49
55
  prepareTtsControls(node);
50
56
 
57
+ $('#node-input-eventHook').typedInput({
58
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
59
+ typeField: $('#node-input-eventHookType')
60
+ });
61
+ $('#node-input-actionHook').typedInput({
62
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
63
+ typeField: $('#node-input-actionHookType')
64
+ });
65
+
51
66
  $('#node-input-bot').typedInput({
52
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
67
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
53
68
  typeField: $('#node-input-botType')
54
69
  });
55
70
  $('#node-input-alias').typedInput({
56
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
71
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
57
72
  typeField: $('#node-input-aliasType')
58
73
  });
59
74
  $('#node-input-locale').typedInput({
60
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
75
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
61
76
  typeField: $('#node-input-localeType')
62
77
  });
63
- $('#node-input-intent').typedInput({
64
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
65
- typeField: $('#node-input-intentType')
66
- });
67
78
  $('#node-input-inputTimeout').typedInput({
68
- types: ['num', 'msg', 'flow', 'global'],
79
+ types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
69
80
  typeField: $('#node-input-inputTimeoutType')
70
81
  });
82
+ $('#node-input-intent').typedInput({
83
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
84
+ typeField: $('#node-input-intentType')
85
+ });
71
86
  $('#node-input-slots').typedInput({
72
87
  typeField: $('#node-input-slotsType'),
73
- types: ['json', 'msg', 'flow', 'global']
88
+ types: ['json', 'msg', 'flow', 'global'],
74
89
  });
75
90
  $('#node-input-metadata').typedInput({
76
91
  typeField: $('#node-input-metadataType'),
77
- types: ['json', 'msg', 'flow', 'global']
92
+ types: ['json', 'msg', 'flow', 'global'],
78
93
  });
79
94
 
80
95
  var onPromptChanged = function () {
package/src/nodes/lex.js CHANGED
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  /** lex */
@@ -12,22 +12,21 @@ module.exports = function(RED) {
12
12
  accessKey = awsCreds.credentials.accessKey;
13
13
  secretAccessKey = awsCreds.credentials.secretAccessKey;
14
14
  }
15
- var botId = v_resolve(config.bot, config.botType, this.context(), msg);
16
- var botAlias = v_resolve(config.alias, config.aliasType, this.context(), msg);
17
- var locale = v_resolve(config.locale, config.localeType, this.context(), msg) || 'en_US';
18
- var val = v_resolve(config.inputTimeout, config.inputTimeoutType, this.context(), msg);
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.alais, 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);
19
21
  var timeout = /^\d+$/.test(val) ? parseInt(val) : 0;
20
- var eventHook = v_resolve(config.eventHook, config.eventHookType, this.context(), msg);
21
- var actionHook = v_resolve(config.actionHook, config.actionHookType, this.context(), msg);
22
- var metadata = v_resolve(config.metadata, config.metadataType, this.context(), msg);
23
22
  var slots, intentName;
24
-
25
23
  if (config.specifyIntent) {
26
- intentName = v_resolve(config.intent, config.intentType, this.context(), msg);
24
+ intentName = new_resolve(RED, config.intent, config.intentType, node, msg);
27
25
  if (intentName) {
28
- slots = v_resolve(config.slots, config.slotsType, this.context(), msg);
26
+ slots = new_resolve(RED, config.slots, config.slotsType, node, msg);
29
27
  }
30
28
  }
29
+ var metadata = new_resolve(RED, config.metadata, config.metadataType, node, msg);
31
30
 
32
31
  const obj = {
33
32
  verb: 'lex',
package/src/nodes/libs.js CHANGED
@@ -19,6 +19,7 @@ exports.appendVerb = (msg, obj) => {
19
19
 
20
20
  /**
21
21
  * resolve a value that may be either a string or a property of the msg, flow, or global context
22
+ * Redundant code now replaced with new_resolve, leaving for now just in case
22
23
  */
23
24
  exports.v_resolve= (val, valType, context, msg, asJson) => {
24
25
  if (!val || !valType) return val;
@@ -44,6 +45,40 @@ exports.appendVerb = (msg, obj) => {
44
45
  return mustache.render('{{' + val + '}}', data);
45
46
  }
46
47
 
48
+ exports.new_resolve = (RED, val, valtype, node, msg) => {
49
+ if (!val || !valtype) return val;
50
+ switch (valtype) {
51
+ case 'str':
52
+ case 'num':
53
+ case 'env':
54
+ case 'msg':
55
+ case 'flow':
56
+ case 'global':
57
+ case 'jsonata':
58
+ return RED.util.evaluateNodeProperty(val, valtype, node, msg);
59
+ case 'mustache':
60
+ let data = dataobject(node.context(), msg);
61
+ return mustache.render(val, data);
62
+ case 'json':
63
+ return JSON.parse(val);
64
+ }
65
+ }
66
+ function dataobject(context, msg){
67
+ data = msg;
68
+ data.global = {};
69
+ data.flow = {};
70
+ g_keys = context.global.keys();
71
+ f_keys = context.flow.keys();
72
+ for (k in g_keys){
73
+ data.global[g_keys[k]] = context.global.get(g_keys[k]);
74
+ };
75
+ for (k in f_keys){
76
+ data.flow[f_keys[k]] = context.flow.get(f_keys[k]);
77
+ };
78
+ return data
79
+ }
80
+
81
+
47
82
  exports.v_text_resolve = (node, val, context, msg) => {
48
83
  const flow = {};
49
84
  const glob = {};
@@ -98,3 +133,4 @@ exports.appendVerb = (msg, obj) => {
98
133
  });
99
134
  return post(`Accounts/${accountSid}/Messages`, opts);
100
135
  }
136
+
@@ -1,5 +1,12 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+ var mustacheType = {
4
+ value: 'mustache',
5
+ label: 'mustache',
6
+ hasvalue: true,
7
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
+ }
9
+
3
10
  RED.nodes.registerType('listen',{
4
11
  category: 'jambonz',
5
12
  color: '#bbabaa',
@@ -58,19 +65,19 @@ RED.nodes.registerType('listen',{
58
65
  oneditprepare: function() {
59
66
  var node = this;
60
67
  $('#node-input-actionhook').typedInput({
61
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
68
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
62
69
  typeField: $('#node-input-actionhookType')
63
70
  });
64
71
  $('#node-input-url').typedInput({
65
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
72
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
66
73
  typeField: $('#node-input-urlType')
67
74
  });
68
75
  $('#node-input-authuser').typedInput({
69
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
76
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
70
77
  typeField: $('#node-input-authuserType')
71
78
  });
72
79
  $('#node-input-authpassword').typedInput({
73
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
80
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
74
81
  typeField: $('#node-input-authpasswordType')
75
82
  });
76
83
  $('#node-input-metadata').typedInput({
@@ -78,15 +85,15 @@ RED.nodes.registerType('listen',{
78
85
  typeField: $('#node-input-metadataType')
79
86
  });
80
87
  $('#node-input-transcriptionhook').typedInput({
81
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
88
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
82
89
  typeField: $('#node-input-transcriptionhookType')
83
90
  });
84
91
  $('#node-input-transcriptionhints').typedInput({
85
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
92
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
86
93
  typeField: $('#node-input-transcriptionhintsType')
87
94
  });
88
95
  $('#node-input-recognizeraltlang').typedInput({
89
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
96
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
90
97
  typeField: $('#node-recognizeraltlangType')
91
98
  });
92
99
  $('#node-input-diarizationmin').typedInput({
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  function listen(config) {
@@ -7,8 +7,8 @@ module.exports = function(RED) {
7
7
  node.on('input', function(msg) {
8
8
  const obj = {
9
9
  verb: 'listen',
10
- url: v_resolve(config.url, config.urlType, this.context(), msg),
11
- actionHook: v_resolve(config.actionhook, config.actionhookType, this.context(), msg),
10
+ url: new_resolve(RED, config.url, config.urlType, node, msg),
11
+ actionHook: new_resolve(RED, config.actionhook, config.actionhookType, node, msg),
12
12
  finishOnKey: config.finishonkey,
13
13
  mixType: config.mixtype,
14
14
  playBeep: config.beep,
@@ -24,11 +24,11 @@ module.exports = function(RED) {
24
24
  diarization: config.diarization
25
25
  };
26
26
  if (recognizer.vendor === 'google') {
27
- var diarizationMin = v_resolve(config.diarizationmin, config.diarizationminType, this.context(), msg);
28
- var diarizationMax = v_resolve(config.diarizationmax, config.diarizationmaxType, this.context(), msg);
29
- var hints = v_resolve(config.transcriptionhints, config.transcriptionhintsType, this.context(), msg);
30
- var altlangs = v_resolve(config.recognizeraltlang, config.recognizeraltlangType, this.context(), msg);
31
- var naics = v_resolve(config.naics, config.naicsType, this.context(), msg);
27
+ var diarizationMin = new_resolve(RED, config.diarizationmin, config.diarizationminType, node, msg);
28
+ var diarizationMax = new_resolve(RED, config.diarizationmax, config.diarizationmaxType, node, msg);
29
+ var hints = new_resolve(RED, config.transcriptionhints, config.transcriptionhintsType, node, msg);
30
+ var altlangs = new_resolve(RED, config.recognizeraltlang, config.recognizeraltlangType, node, msg);
31
+ var naics = new_resolve(RED, config.naics, config.naicsType, node, msg);
32
32
  Object.assign(recognizer, {
33
33
  profanityFilter: config.profanityfilter,
34
34
  hints: hints.length > 0 ?
@@ -49,8 +49,8 @@ module.exports = function(RED) {
49
49
  }
50
50
  }
51
51
  else if (recognizer.vendor === 'aws') {
52
- var vocab = v_resolve(config.vocabularyname, config.vocabularynameType, this.context(), msg);
53
- var vocabFilter = v_resolve(config.vocabularyfiltername, config.vocabularynameType, this.context(), msg);
52
+ var vocab = new_resolve(RED, config.vocabularyname, config.vocabularynameType, node, msg);
53
+ var vocabFilter = new_resolve(RED, config.vocabularyfiltername, config.vocabularyfilternameType, node, msg);
54
54
  Object.assign(recognizer, {
55
55
  vocabularyName: vocab,
56
56
  vocabularyFilterName: vocabFilter,
@@ -58,7 +58,7 @@ module.exports = function(RED) {
58
58
  });
59
59
  }
60
60
  obj.transcribe = {
61
- transcriptionHook: v_resolve(config.transcriptionhook, config.transcriptionhookType, this.context(), msg),
61
+ transcriptionHook: new_resolve(RED, config.transcriptionhook, config.transcriptionhookType, node, msg),
62
62
  recognizer
63
63
  };
64
64
  }
@@ -66,7 +66,7 @@ module.exports = function(RED) {
66
66
  if (/^\d+$/.test(config.maxlength)) obj.maxLength = parseInt(config.maxLength);
67
67
  if (config.finishonkey.length) obj.finishOnKey = config.finishonkey;
68
68
 
69
- var data = v_resolve(config.metadata, config.metadataType, this.context(), msg, true);
69
+ var data = new_resolve(RED, config.metadata, config.metadataType, node, msg);
70
70
  if (data) obj.metadata = data;
71
71
 
72
72
  appendVerb(msg, obj);
@@ -1,5 +1,11 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+ var mustacheType = {
4
+ value: 'mustache',
5
+ label: 'mustache',
6
+ hasvalue: true,
7
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
+ }
3
9
  RED.nodes.registerType('message', {
4
10
  category: 'jambonz',
5
11
  color: '#bbabaa',
@@ -25,22 +31,22 @@
25
31
 
26
32
  $('#node-input-from').typedInput({
27
33
  default: $('#node-input-fromType').val(),
28
- types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
34
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
29
35
  typeField: $('#node-input-fromType')
30
36
  });
31
37
  $('#node-input-to').typedInput({
32
38
  default: $('#node-input-toType').val(),
33
- types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
39
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
34
40
  typeField: $('#node-input-toType')
35
41
  });
36
42
  $('#node-input-text').typedInput({
37
43
  default: $('#node-input-textType').val(),
38
- types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
44
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
39
45
  typeField: $('#node-input-textType')
40
46
  });
41
47
  $('#node-input-provider').typedInput({
42
48
  default: $('#node-input-providerType').val(),
43
- types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
49
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
44
50
  typeField: $('#node-input-providerType')
45
51
  });
46
52
  }
@@ -1,19 +1,14 @@
1
- var { appendVerb, v_resolve } = require("./libs");
1
+ var { appendVerb, new_resolve } = require("./libs");
2
2
 
3
3
  module.exports = function (RED) {
4
4
  function message(config) {
5
5
  RED.nodes.createNode(this, config);
6
6
  var node = this;
7
7
  node.on("input", function (msg, send, done) {
8
- var from = v_resolve(config.from, config.fromType, this.context(), msg);
9
- var to = v_resolve(config.to, config.toType, this.context(), msg);
10
- var text = v_resolve(config.text, config.textType, this.context(), msg);
11
- var provider = v_resolve(
12
- config.provider,
13
- config.providerType,
14
- this.context(),
15
- msg
16
- );
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);
17
12
  if ((!provider || 0 === provider.length) && msg.sms.provider) {
18
13
  provider = msg.sms.provider;
19
14
  }
@@ -1,5 +1,12 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+ var mustacheType = {
4
+ value: 'mustache',
5
+ label: 'mustache',
6
+ hasvalue: true,
7
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
+ }
9
+
3
10
  RED.nodes.registerType('pause',{
4
11
  category: 'jambonz',
5
12
  color: '#bbabaa',
@@ -15,7 +22,7 @@
15
22
  oneditprepare: function() {
16
23
  $('#node-input-len').typedInput({
17
24
  default: $('#node-input-lenType').val(),
18
- types: ['num','msg', 'flow', 'global', 'jsonata', 'env'],
25
+ types: ['num','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
19
26
  typeField: $('#node-input-lenType')
20
27
  });
21
28
  }
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  /** pause */
@@ -6,8 +6,7 @@ module.exports = function(RED) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
8
  node.on('input', function(msg) {
9
- var val = v_resolve(config.len, config.lenType, this.context(), msg);
10
- var length = /^\d+$/.test(val) ? parseInt(val) : parseFloat(val);
9
+ var length = new_resolve(RED, config.len, config.lenType, node, msg);
11
10
  appendVerb(msg, {
12
11
  verb: 'pause',
13
12
  length
@@ -1,5 +1,13 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+
4
+ var mustacheType = {
5
+ value: 'mustache',
6
+ label: 'mustache',
7
+ hasvalue: true,
8
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
9
+ }
10
+
3
11
  RED.nodes.registerType('play',{
4
12
  category: 'jambonz',
5
13
  color: '#bbabaa',
@@ -17,7 +25,7 @@ RED.nodes.registerType('play',{
17
25
  oneditprepare: function() {
18
26
  $('#node-input-url').typedInput({
19
27
  default: $('#node-input-urlType').val(),
20
- types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
28
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
21
29
  typeField: $('#node-input-urlType')
22
30
  });
23
31
  }
package/src/nodes/play.js CHANGED
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  function play(config) {
@@ -7,7 +7,7 @@ module.exports = function(RED) {
7
7
  node.on('input', function(msg) {
8
8
  appendVerb(msg, {
9
9
  verb: 'play',
10
- url: v_resolve(config.url, config.urlType, this.context(), msg),
10
+ url: new_resolve(RED, config.url, config.urlType, node, msg),
11
11
  earlyMedia: config.early,
12
12
  loop: config.loop
13
13
  });
@@ -1,5 +1,11 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+ var mustacheType = {
4
+ value: 'mustache',
5
+ label: 'mustache',
6
+ hasvalue: true,
7
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
+ }
3
9
  RED.nodes.registerType('rasa',{
4
10
  category: 'jambonz',
5
11
  color: '#bbabaa',
@@ -22,19 +28,19 @@
22
28
  oneditprepare: () => {
23
29
  var node = this;
24
30
  $('#node-input-url').typedInput({
25
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
31
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
26
32
  typeField: $('#node-input-urlType')
27
33
  });
28
34
  $('#node-input-prompt').typedInput({
29
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
35
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
30
36
  typeField: $('#node-input-promptType')
31
37
  });
32
38
  $('#node-input-eventHook').typedInput({
33
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
39
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
34
40
  typeField: $('#node-input-eventHookType')
35
41
  });
36
42
  $('#node-input-actionHook').typedInput({
37
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
43
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
38
44
  typeField: $('#node-input-actionHookType')
39
45
  });
40
46
  }
package/src/nodes/rasa.js CHANGED
@@ -1,4 +1,4 @@
1
- var {appendVerb} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  function rasa(config) {
@@ -6,10 +6,10 @@ module.exports = function(RED) {
6
6
  var node = this;
7
7
  node.on('input', function(msg) {
8
8
  obj = {verb: 'rasa'}
9
- obj.url = config.url
10
- config.prompt != '' ? obj.prompt = config.prompt : null
11
- config.eventHook != '' ? obj.eventHook = config.eventHook : null
12
- config.actionHook != '' ? obj.actionHook = config.actionHook : null
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);
13
13
  appendVerb(msg, obj);
14
14
  node.send(msg);
15
15
  });
@@ -1,5 +1,11 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+ var mustacheType = {
4
+ value: 'mustache',
5
+ label: 'mustache',
6
+ hasvalue: true,
7
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
+ }
3
9
  RED.nodes.registerType('redirect', {
4
10
  category: 'jambonz',
5
11
  color: '#bbabaa',
@@ -16,7 +22,7 @@
16
22
  },
17
23
  oneditprepare: function() {
18
24
  $('#node-input-hook').typedInput({
19
- types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
25
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
20
26
  typeField: $('#node-input-hookType')
21
27
  });
22
28
  }
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  /** redirect */
@@ -6,7 +6,7 @@ module.exports = function(RED) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
8
  node.on('input', function(msg, send, done) {
9
- var actionHook = v_resolve(config.hook, config.hookType, this.context(), msg);
9
+ var actionHook = new_resolve(RED, config.hook, config.hookType, node, msg);
10
10
  appendVerb(msg, {
11
11
  verb: 'redirect',
12
12
  actionHook
@@ -32,7 +32,7 @@
32
32
  <input type="text" id="node-input-name" placeholder="Name">
33
33
  </div>
34
34
  <div class="form-row">
35
- <label for="node-input-text"><i class="icon-tag"></i> Text</label>
35
+ <label for="node-input-text"><i class="icon-tag"></i> Text {{ }}</label>
36
36
  <textarea id="node-input-text" rows="4" placeholder="Text or SSML to speak" style="width:70%"></textarea>
37
37
  </div>
38
38
  <div class="form-row">
package/src/nodes/say.js CHANGED
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_text_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  /** say */
@@ -10,7 +10,7 @@ module.exports = function(RED) {
10
10
  var node = this;
11
11
 
12
12
  node.on('input', function(msg) {
13
- const text = v_text_resolve(node, this.text, this.context(), msg);
13
+ const text = new_resolve(RED, config.text, 'mustache', node, msg);
14
14
  var obj = {
15
15
  verb: 'say',
16
16
  text,
@@ -1,5 +1,11 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
+ var mustacheType = {
4
+ value: 'mustache',
5
+ label: 'mustache',
6
+ hasvalue: true,
7
+ icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
+ }
3
9
  RED.nodes.registerType('sip:decline',{
4
10
  category: 'jambonz',
5
11
  color: '#bbabaa',
@@ -17,12 +23,12 @@
17
23
  oneditprepare: function() {
18
24
  $('#node-input-status').typedInput({
19
25
  default: $('#node-input-statusType').val(),
20
- types: ['num','msg', 'flow', 'global'],
26
+ types: ['num','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
21
27
  typeField: $('#node-input-statusType')
22
28
  });
23
29
  $('#node-input-reason').typedInput({
24
30
  default: $('#node-input-reasonType').val(),
25
- types: ['str','msg', 'flow', 'global'],
31
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
26
32
  typeField: $('#node-input-reasonType')
27
33
  });
28
34
  }
@@ -1,4 +1,4 @@
1
- var {appendVerb, v_resolve} = require('./libs')
1
+ var {appendVerb, new_resolve} = require('./libs')
2
2
 
3
3
  module.exports = function(RED) {
4
4
  /** sip:decline */
@@ -6,8 +6,8 @@ module.exports = function(RED) {
6
6
  RED.nodes.createNode(this, config);
7
7
  var node = this;
8
8
  node.on('input', function(msg) {
9
- var status = v_resolve(config.status, config.statusType, this.context(), msg);
10
- var reason = v_resolve(config.reason, config.reasonType, this.context(), 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);
11
11
  appendVerb(msg, {
12
12
  verb: 'sip:decline',
13
13
  status: parseInt(status),