@jambonz/node-red-contrib-jambonz 2.4.25 → 2.4.27
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 +1 -1
- package/src/nodes/dial.html +56 -11
- package/src/nodes/dial.js +10 -12
- package/src/nodes/lcc.html +11 -5
- package/src/nodes/lcc.js +2 -1
- package/src/nodes/listen.js +2 -2
package/package.json
CHANGED
package/src/nodes/dial.html
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
color: '#bbabaa',
|
|
12
12
|
defaults: {
|
|
13
13
|
name: {value: ''},
|
|
14
|
-
targets: {value:[{type: 'phone', dest: '', user: '', pass: '', varType: 'str', trunk: '', trunkType: 'str'}]},
|
|
14
|
+
targets: { value: [{ type: 'phone', dest: '', user: '', pass: '', varType: 'str', trunk: '', trunkType: 'str', tenant: '', tenantType: 'str', vmail: false }] },
|
|
15
15
|
headers: {value: []},
|
|
16
16
|
actionhook: {value: ''},
|
|
17
17
|
actionhookType: {value: 'str'},
|
|
@@ -160,7 +160,10 @@
|
|
|
160
160
|
pass: '',
|
|
161
161
|
varType: 'str',
|
|
162
162
|
trunk: '',
|
|
163
|
-
trunkType: 'str'
|
|
163
|
+
trunkType: 'str',
|
|
164
|
+
tenant: '',
|
|
165
|
+
tenantType: 'str',
|
|
166
|
+
vmail: false
|
|
164
167
|
};
|
|
165
168
|
}
|
|
166
169
|
|
|
@@ -174,14 +177,16 @@
|
|
|
174
177
|
var row3 = $('<div/>',{style:"margin-top:8px;"}).appendTo(fragment);
|
|
175
178
|
var row4 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
176
179
|
var row5 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
180
|
+
var row6 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
181
|
+
var row7 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
177
182
|
|
|
178
183
|
var selectField = $('<select/>',{class:"node-input-target-type",style:"width:110px; margin-right:10px;"})
|
|
179
184
|
.appendTo(row1);
|
|
180
|
-
|
|
185
|
+
const selectOptions = ['phone', 'user', 'sip', 'teams'];
|
|
181
186
|
for (var i = 0; i < 4; i++) {
|
|
182
187
|
selectField.append($("<option></option>").val(selectOptions[i]).text(selectOptions[i]));
|
|
183
188
|
}
|
|
184
|
-
|
|
189
|
+
const propertyName = $('<input/>', {class:"node-input-target-property-name", type:"text"})
|
|
185
190
|
.appendTo(row1)
|
|
186
191
|
.typedInput({types: ['str', 'msg', 'flow', 'global','jsonata', 'env', mustacheType]});
|
|
187
192
|
|
|
@@ -207,14 +212,33 @@
|
|
|
207
212
|
$('<label style="padding-top:8px; padding-right:20px">Trunk:</label>')
|
|
208
213
|
.appendTo(row5);
|
|
209
214
|
|
|
210
|
-
|
|
211
|
-
class:"node-input-target-property-trunk",
|
|
212
|
-
type:"text",
|
|
215
|
+
$('<input/>',{
|
|
216
|
+
class: "node-input-target-property-trunk",
|
|
217
|
+
type: "text",
|
|
213
218
|
placeholder: 'Specify the name of the trunk used for this outbound call'
|
|
214
219
|
})
|
|
215
220
|
.appendTo(row5)
|
|
216
221
|
.typedInput({types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType]});
|
|
217
222
|
|
|
223
|
+
$('<label style="padding-top:8px; padding-right:20px">Tenant:</label>')
|
|
224
|
+
.appendTo(row6);
|
|
225
|
+
|
|
226
|
+
$('<input/>',{
|
|
227
|
+
class: "node-input-target-property-tenant",
|
|
228
|
+
type: "text",
|
|
229
|
+
placeholder: 'Specify the name of the tenant used for this outbound call'
|
|
230
|
+
})
|
|
231
|
+
.appendTo(row6)
|
|
232
|
+
.typedInput({types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType]});
|
|
233
|
+
|
|
234
|
+
$('<label style="padding-top:8px; padding-right:20px">Voicemail:</label>')
|
|
235
|
+
.appendTo(row7);
|
|
236
|
+
$('<input/>',{
|
|
237
|
+
class: "node-input-target-property-vmail",
|
|
238
|
+
type: "checkbox",
|
|
239
|
+
style: 'height: fit-content;'
|
|
240
|
+
})
|
|
241
|
+
.appendTo(row7);
|
|
218
242
|
selectField.on('change', function() {
|
|
219
243
|
var type = $(this).val();
|
|
220
244
|
console.log(`type changed to ${type}`);
|
|
@@ -243,11 +267,18 @@
|
|
|
243
267
|
row3.show();
|
|
244
268
|
}
|
|
245
269
|
|
|
246
|
-
if(type !== 'phone') {
|
|
270
|
+
if (type !== 'phone') {
|
|
247
271
|
row5.hide();
|
|
248
272
|
} else {
|
|
249
273
|
row5.show();
|
|
250
274
|
}
|
|
275
|
+
if (type !== 'teams') {
|
|
276
|
+
row6.hide();
|
|
277
|
+
row7.hide();
|
|
278
|
+
} else {
|
|
279
|
+
row6.show();
|
|
280
|
+
row7.show();
|
|
281
|
+
}
|
|
251
282
|
});
|
|
252
283
|
selectField.val(target.type);
|
|
253
284
|
propertyName.typedInput('value', target.dest);
|
|
@@ -257,7 +288,8 @@
|
|
|
257
288
|
var userfield = row2.find('.node-input-target-property-authuser');
|
|
258
289
|
var passfield = row3.find('.node-input-target-property-authpassword');
|
|
259
290
|
var trunkfield = row5.find('.node-input-target-property-trunk');
|
|
260
|
-
|
|
291
|
+
var tenantfield = row6.find('.node-input-target-property-tenant');
|
|
292
|
+
var vmailfield = row7.find('.node-input-target-property-vmail');
|
|
261
293
|
datafield.typedInput('type', target.varType);
|
|
262
294
|
|
|
263
295
|
switch (target.type) {
|
|
@@ -267,6 +299,10 @@
|
|
|
267
299
|
case 'sip':
|
|
268
300
|
userfield.val(target.user);
|
|
269
301
|
passfield.val(target.pass);
|
|
302
|
+
case 'teams':
|
|
303
|
+
tenantfield.typedInput('type', target.tenantType);
|
|
304
|
+
tenantfield.typedInput('value', target.tenant);
|
|
305
|
+
vmailfield.prop('checked', target.vmail);
|
|
270
306
|
default:
|
|
271
307
|
datafield.typedInput('value', target.dest);
|
|
272
308
|
break;
|
|
@@ -285,7 +321,10 @@
|
|
|
285
321
|
user: '',
|
|
286
322
|
pass: '',
|
|
287
323
|
trunk: '',
|
|
288
|
-
varType: 'str'
|
|
324
|
+
varType: 'str',
|
|
325
|
+
tenant: '',
|
|
326
|
+
tenantType: 'str',
|
|
327
|
+
vmail: false
|
|
289
328
|
}
|
|
290
329
|
this.targets = [target];
|
|
291
330
|
}
|
|
@@ -350,11 +389,14 @@
|
|
|
350
389
|
var target = $(this);
|
|
351
390
|
var type = target.find('.node-input-target-type').val();
|
|
352
391
|
var varType = target.find('.node-input-target-property-name').typedInput('type');
|
|
353
|
-
var dest
|
|
392
|
+
var dest = target.find('.node-input-target-property-name').typedInput('value');
|
|
354
393
|
var user = target.find('.node-input-target-property-authuser').val();
|
|
355
394
|
var pass = target.find('.node-input-target-property-authpassword').val();
|
|
356
395
|
var trunk = target.find('.node-input-target-property-trunk').typedInput('value');
|
|
357
396
|
var trunkType = target.find('.node-input-target-property-trunk').typedInput('type');
|
|
397
|
+
var tenant = target.find('.node-input-target-property-tenant').typedInput('value');
|
|
398
|
+
var tenantType = target.find('.node-input-target-property-tenant').typedInput('type');
|
|
399
|
+
var vmail = target.find('.node-input-target-property-vmail').prop("checked");
|
|
358
400
|
if (!['phone', 'user', 'sip', 'teams'].includes(type) || 0 === dest.length) return;
|
|
359
401
|
|
|
360
402
|
var t = {
|
|
@@ -362,6 +404,9 @@
|
|
|
362
404
|
varType,
|
|
363
405
|
dest
|
|
364
406
|
};
|
|
407
|
+
if ('teams' === type && (tenant || vmail)) {
|
|
408
|
+
Object.assign(t, {tenant, tenantType, vmail});
|
|
409
|
+
}
|
|
365
410
|
if ('sip' === type && user.length > 0 && pass.length > 0) {
|
|
366
411
|
Object.assign(t, {user, pass});
|
|
367
412
|
}
|
package/src/nodes/dial.js
CHANGED
|
@@ -3,14 +3,15 @@ var {appendVerb, new_resolve} = require('./libs')
|
|
|
3
3
|
module.exports = function(RED) {
|
|
4
4
|
function dial(config) {
|
|
5
5
|
RED.nodes.createNode(this, config);
|
|
6
|
-
|
|
6
|
+
const node = this;
|
|
7
7
|
|
|
8
8
|
node.on('input', async function(msg) {
|
|
9
9
|
node.log(`dial config: ${JSON.stringify(config)}, msg.call: ${JSON.stringify(msg.call)}`);
|
|
10
|
-
|
|
11
|
-
const obj =
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
const target = await Promise.all(config.targets.map(async (t) => {
|
|
11
|
+
const obj = {};
|
|
12
|
+
const dest = await new_resolve(RED, t.dest, t.varType, node, msg);
|
|
13
|
+
const trunk = await new_resolve(RED, t.trunk, t.trunkType, node, msg);
|
|
14
|
+
const tenant = t.tenant ? await new_resolve(RED, t.tenant, t.tenantType, node, msg) : '';
|
|
14
15
|
switch (t.type) {
|
|
15
16
|
case 'phone':
|
|
16
17
|
obj.number = dest;
|
|
@@ -27,19 +28,16 @@ module.exports = function(RED) {
|
|
|
27
28
|
password: t.pass
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
delete obj.user;
|
|
31
|
-
delete obj.pass;
|
|
32
31
|
break;
|
|
33
32
|
case 'teams':
|
|
34
33
|
obj.number = dest;
|
|
34
|
+
if (tenant) obj.tenant = tenant;
|
|
35
|
+
if (t.vmail) obj.vmail = t.vmail;
|
|
35
36
|
break;
|
|
36
37
|
}
|
|
37
|
-
delete obj.varType;
|
|
38
|
-
delete obj.trunkType;
|
|
39
|
-
delete obj.dest;
|
|
40
38
|
return obj;
|
|
41
39
|
}));
|
|
42
|
-
|
|
40
|
+
const data = {
|
|
43
41
|
verb: 'dial',
|
|
44
42
|
target,
|
|
45
43
|
answerOnBridge: config.answeronbridge,
|
|
@@ -63,7 +61,7 @@ module.exports = function(RED) {
|
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
// headers
|
|
66
|
-
|
|
64
|
+
const headers = {};
|
|
67
65
|
config.headers.forEach(function(h) {
|
|
68
66
|
if (h.h.length && h.v.length) headers[h.h] = h.v;
|
|
69
67
|
});
|
package/src/nodes/lcc.html
CHANGED
|
@@ -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
|
-
|
|
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: ['
|
|
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: ['
|
|
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
|
@@ -62,11 +62,12 @@ function lcc(config) {
|
|
|
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: {
|
|
68
69
|
verb: 'say',
|
|
69
|
-
text: config.text
|
|
70
|
+
text: await new_resolve(RED, config.text, 'mustache', node, msg),
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
if (['aws', 'google'].includes(config.vendor)) {
|
package/src/nodes/listen.js
CHANGED
|
@@ -74,7 +74,7 @@ module.exports = function(RED) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
if (/^\d+$/.test(config.timeout)) obj.timeout = parseInt(config.timeout);
|
|
77
|
-
if (/^\d+$/.test(config.maxlength)) obj.maxLength = parseInt(config.
|
|
77
|
+
if (/^\d+$/.test(config.maxlength)) obj.maxLength = parseInt(config.maxlength);
|
|
78
78
|
if (config.finishonkey.length) obj.finishOnKey = config.finishonkey;
|
|
79
79
|
|
|
80
80
|
var data = await new_resolve(RED, config.metadata, config.metadataType, node, msg);
|
|
@@ -85,4 +85,4 @@ module.exports = function(RED) {
|
|
|
85
85
|
});
|
|
86
86
|
}
|
|
87
87
|
RED.nodes.registerType('listen', listen);
|
|
88
|
-
}
|
|
88
|
+
}
|