@jambonz/node-red-contrib-jambonz 2.3.0 → 2.3.1

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.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Node-RED nodes for jambonz",
5
5
  "keywords": [
6
6
  "node-red"
@@ -5,7 +5,7 @@ RED.nodes.registerType('dial',{
5
5
  color: '#bbabaa',
6
6
  defaults: {
7
7
  name: {value: ''},
8
- targets:{value:[{type: 'phone', dest: '', user: '', pass: '', varType: 'str', trunk: ''}]},
8
+ targets:{value:[{type: 'phone', dest: '', user: '', pass: '', varType: 'str', trunk: '', trunkType: 'str'}]},
9
9
  headers: {value: []},
10
10
  actionhook: {value: ''},
11
11
  actionhookType: {value: 'str'},
@@ -64,6 +64,10 @@ RED.nodes.registerType('dial',{
64
64
  types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
65
65
  typeField: $('#node-input-calleridType')
66
66
  });
67
+ $('#node-input-target-property-trunk').typedInput({
68
+ types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env'],
69
+ typeField: $('#node-input-target-property-trunk')
70
+ });
67
71
  $('#node-input-actionhook').typedInput({
68
72
  types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
69
73
  typeField: $('#node-input-actionhookType')
@@ -130,7 +134,9 @@ RED.nodes.registerType('dial',{
130
134
  dest: '',
131
135
  user: '',
132
136
  pass: '',
133
- varType: 'str'
137
+ varType: 'str',
138
+ trunk: '',
139
+ trunkType: 'str'
134
140
  };
135
141
  }
136
142
 
@@ -143,7 +149,7 @@ RED.nodes.registerType('dial',{
143
149
  var row2 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
144
150
  var row3 = $('<div/>',{style:"margin-top:8px;"}).appendTo(fragment);
145
151
  var row4 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
146
- var row5 = $('<div/>',{style:"margin-top:8px;"}).appendTo(fragment);
152
+ var row5 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
147
153
 
148
154
  var selectField = $('<select/>',{class:"node-input-target-type",style:"width:110px; margin-right:10px;"})
149
155
  .appendTo(row1);
@@ -177,12 +183,13 @@ RED.nodes.registerType('dial',{
177
183
  $('<label style="padding-top:8px; padding-right:20px">Trunk:</label>')
178
184
  .appendTo(row5);
179
185
 
180
- $('<input/>',{
186
+ var trunkName = $('<input/>',{
181
187
  class:"node-input-target-property-trunk",
182
188
  type:"text",
183
189
  placeholder: 'Specify the name of the trunk used for this outbound call'
184
190
  })
185
- .appendTo(row5);
191
+ .appendTo(row5)
192
+ .typedInput({types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env']});
186
193
 
187
194
  selectField.on('change', function() {
188
195
  var type = $(this).val();
@@ -231,7 +238,8 @@ RED.nodes.registerType('dial',{
231
238
 
232
239
  switch (target.type) {
233
240
  case 'phone':
234
- trunkfield.val(target.trunk);
241
+ trunkfield.typedInput('type', target.trunkType);
242
+ trunkfield.typedInput('value', target.trunk);
235
243
  case 'sip':
236
244
  userfield.val(target.user);
237
245
  passfield.val(target.pass);
@@ -321,7 +329,8 @@ RED.nodes.registerType('dial',{
321
329
  var dest = target.find('.node-input-target-property-name').typedInput('value');
322
330
  var user = target.find('.node-input-target-property-authuser').val();
323
331
  var pass = target.find('.node-input-target-property-authpassword').val();
324
- var trunk = target.find('.node-input-target-property-trunk').val();
332
+ var trunk = target.find('.node-input-target-property-trunk').typedInput('value');
333
+ var trunkType = target.find('.node-input-target-property-trunk').typedInput('type');
325
334
  if (!['phone', 'user', 'sip', 'teams'].includes(type) || 0 === dest.length) return;
326
335
 
327
336
  var t = {
@@ -333,6 +342,7 @@ RED.nodes.registerType('dial',{
333
342
  Object.assign(t, {user, pass});
334
343
  }
335
344
  if ('phone' === type && trunk.length > 0) {
345
+ t.trunkType = trunkType;
336
346
  t.trunk = trunk;
337
347
  }
338
348
  node.targets.push(t);
package/src/nodes/dial.js CHANGED
@@ -13,10 +13,12 @@ module.exports = function(RED) {
13
13
  var target = config.targets.map((t) => {
14
14
  const obj = Object.assign({}, t);
15
15
  var dest = v_resolve(obj.dest, obj.varType, this.context(), msg);
16
+ var trunk = v_resolve(obj.trunk, obj.trunkType, this.context(), msg);
16
17
  node.log(`dial: dest ${t.varType}:${t.dest} resolved to ${dest}`);
17
18
  switch (t.type) {
18
19
  case 'phone':
19
20
  obj.number = dest;
21
+ obj.trunk = trunk;
20
22
  break;
21
23
  case 'user':
22
24
  obj.name = dest;
@@ -37,6 +39,7 @@ module.exports = function(RED) {
37
39
  break;
38
40
  }
39
41
  delete obj.varType;
42
+ delete obj.trunkType;
40
43
  delete obj.dest;
41
44
  return obj;
42
45
  });
@@ -315,6 +315,10 @@
315
315
 
316
316
  <h3>Details</h3>
317
317
  The gather command is used to collect dtmf or speech input.
318
+
319
+ Within the text field you can use mustache syntax to insert properties of the msg, flow or global objects.
320
+ For example if you wanted to insert the value of msg.payload into the text you could put
321
+ <code>The payload is {{msg.payload}}</code>
318
322
  <h3>References</h3>
319
323
  <ul>
320
324
  <li><a href="https://docs.jambonz.org/jambonz/#gather">Jambonz gather reference</a></li>
package/src/nodes/libs.js CHANGED
@@ -71,7 +71,8 @@ exports.appendVerb = (msg, obj) => {
71
71
  }
72
72
  return '${' + b + '}';
73
73
  });
74
- return newString;
74
+ data = {'global' : glob, 'flow' : flow, 'msg' : msg}
75
+ return mustache.render(newString, data);
75
76
  }
76
77
 
77
78
 
@@ -109,6 +109,10 @@
109
109
  <h3>Details</h3>
110
110
  The say command is used to send synthesized speech to the remote party.
111
111
  The text provided may be either plain text or may use SSML tags.
112
+
113
+ Within the text field you can use mustache syntax to insert properties of the msg, flow or global objects.
114
+ For example if you wanted to insert the value of msg.payload into the text you could put
115
+ <code>The payload is {{msg.payload}}</code>
112
116
  <h3>References</h3>
113
117
  <ul>
114
118
  <li><a href="https://docs.jambonz.org/jambonz/#say">Jambonz say reference</a></li>