@jambonz/node-red-contrib-jambonz 2.4.7 → 2.4.9
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/gather.html +16 -2
- package/src/nodes/gather.js +4 -1
- package/src/nodes/lcc.html +68 -5
- package/src/nodes/lcc.js +10 -0
package/package.json
CHANGED
package/src/nodes/gather.html
CHANGED
|
@@ -12,12 +12,15 @@
|
|
|
12
12
|
defaults: {
|
|
13
13
|
name: {value: ''},
|
|
14
14
|
actionhook: {value: ''},
|
|
15
|
-
|
|
15
|
+
actionhookType: {val: 'str'},
|
|
16
16
|
finishonkey: {value: ''},
|
|
17
17
|
dtmfinput: {value: 0},
|
|
18
18
|
speechinput: {value: 1},
|
|
19
19
|
numdigits: {value: ''},
|
|
20
20
|
timeout: {value: ''},
|
|
21
|
+
bargein: {value: true},
|
|
22
|
+
dtmfbargein: {value: true},
|
|
23
|
+
listenduringprompt: {value: true},
|
|
21
24
|
prompttype: {value: 'say'},
|
|
22
25
|
playurl: {value: ''},
|
|
23
26
|
playurlType: {value: 'str'},
|
|
@@ -203,6 +206,10 @@
|
|
|
203
206
|
<input type="checkbox" id="node-input-dtmfinput">
|
|
204
207
|
</div>
|
|
205
208
|
<div id="dtmf-input-container">
|
|
209
|
+
<div class="form-row">
|
|
210
|
+
<label for="node-input-dtmfbargein">Allow DTMF bargein</label>
|
|
211
|
+
<input type="checkbox" id="node-input-dtmfbargein">
|
|
212
|
+
</div>
|
|
206
213
|
<div class="form-row">
|
|
207
214
|
<label for="node-input-finishonkey"><i class="icon-tag"></i> Finish key</label>
|
|
208
215
|
<input type="text" id="node-input-finishonkey" placeholder="dtmf key to signal end of input">
|
|
@@ -224,6 +231,14 @@
|
|
|
224
231
|
<input type="checkbox" id="node-input-speechinput">
|
|
225
232
|
</div>
|
|
226
233
|
<div id="speech-input-container">
|
|
234
|
+
<div class="form-row">
|
|
235
|
+
<label for="node-input-bargein">Allow Speech bargein</label>
|
|
236
|
+
<input type="checkbox" id="node-input-bargein">
|
|
237
|
+
</div>
|
|
238
|
+
<div class="form-row">
|
|
239
|
+
<label for="node-input-listenduringprompt">Listen during prompt</label>
|
|
240
|
+
<input type="checkbox" id="node-input-listenduringprompt">
|
|
241
|
+
</div>
|
|
227
242
|
<div class="form-row">
|
|
228
243
|
<label for="node-input-transcriptionvendor">Vendor</label>
|
|
229
244
|
<select id="node-input-transcriptionvendor">
|
|
@@ -234,7 +249,6 @@
|
|
|
234
249
|
<option value="microsoft">microsoft</option>
|
|
235
250
|
<option value="ibm">ibm</option>
|
|
236
251
|
<option value="nuance">nuance</option>
|
|
237
|
-
|
|
238
252
|
</select>
|
|
239
253
|
</div>
|
|
240
254
|
<div class="form-row">
|
package/src/nodes/gather.js
CHANGED
|
@@ -11,7 +11,7 @@ module.exports = function(RED) {
|
|
|
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.
|
|
14
|
+
if (config.actionhook) obj.actionHook = new_resolve(RED, config.actionhook, config.actionhookType, node, msg)
|
|
15
15
|
|
|
16
16
|
// input
|
|
17
17
|
if (config.speechinput) {
|
|
@@ -45,12 +45,15 @@ module.exports = function(RED) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
obj.recognizer = recognizer;
|
|
48
|
+
if (config.bargein) obj.bargein = config.bargein;
|
|
49
|
+
if (config.listenduringprompt) obj.listenDuringPrompt = config.listenduringprompt;
|
|
48
50
|
}
|
|
49
51
|
if (config.dtmfinput) {
|
|
50
52
|
obj.input.push('digits');
|
|
51
53
|
if (config.finishonkey && config.finishonkey.length) obj.finishOnKey = config.finishonkey;
|
|
52
54
|
if (/^\d+$/.test(config.numdigits)) obj.numDigits = parseInt(config.numdigits);
|
|
53
55
|
if (/^\d+$/.test(config.timeout)) obj.timeout = parseInt(config.timeout);
|
|
56
|
+
if (config.dtmfbargein) obj.dtmfBargein = config.dtmfbargein;
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
// prompt
|
package/src/nodes/lcc.html
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
3
|
var mustacheType = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
value: 'mustache',
|
|
5
|
+
label: 'mustache',
|
|
6
|
+
hasvalue: true,
|
|
7
|
+
icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
RED.nodes.registerType('lcc',{
|
|
11
10
|
category: 'jambonz',
|
|
12
11
|
color: '#aebfb9',
|
|
@@ -38,6 +37,7 @@
|
|
|
38
37
|
return action !== 'start_call_recording' || v.length > 0;
|
|
39
38
|
}},
|
|
40
39
|
siprecServerURLType: {value: 'str'},
|
|
40
|
+
siprecHeaders: {value: []},
|
|
41
41
|
recordingID: {value: ''},
|
|
42
42
|
recordingIDType: {value: 'str'},
|
|
43
43
|
},
|
|
@@ -166,6 +166,61 @@
|
|
|
166
166
|
vendorElem.change(onVendorChanged);
|
|
167
167
|
langElem.change(onLangChanged);
|
|
168
168
|
voiceElem.change(onVoiceChanged);
|
|
169
|
+
|
|
170
|
+
$('#node-input-siprecHeaders-container').css('min-height','120px').css('min-width','450px').editableList({
|
|
171
|
+
addItem: function(container, i, opt) {
|
|
172
|
+
var header = opt;
|
|
173
|
+
if (!header.hasOwnProperty('h')) {
|
|
174
|
+
header = {h: '', v: ''};
|
|
175
|
+
}
|
|
176
|
+
container.css({
|
|
177
|
+
overflow: 'hidden',
|
|
178
|
+
whiteSpace: 'nowrap'
|
|
179
|
+
});
|
|
180
|
+
let fragment = document.createDocumentFragment();
|
|
181
|
+
var row1 = $('<div/>',{style:"display:flex;"}).appendTo(fragment);
|
|
182
|
+
$('<input/>', {
|
|
183
|
+
class:"node-input-header-property-name",
|
|
184
|
+
type:"text",
|
|
185
|
+
placeholder: 'SIP Header'
|
|
186
|
+
})
|
|
187
|
+
.appendTo(row1);
|
|
188
|
+
$('<input/>', {
|
|
189
|
+
class:"node-input-value-property-name",
|
|
190
|
+
type:"text",
|
|
191
|
+
placeholder: 'value'
|
|
192
|
+
})
|
|
193
|
+
.appendTo(row1);
|
|
194
|
+
row1.find('.node-input-header-property-name').val(header.h);
|
|
195
|
+
row1.find('.node-input-value-property-name').val(header.v);
|
|
196
|
+
container[0].appendChild(fragment);
|
|
197
|
+
},
|
|
198
|
+
removable: true
|
|
199
|
+
});
|
|
200
|
+
if (!this.siprecHeaders) {
|
|
201
|
+
var header = {
|
|
202
|
+
h: '',
|
|
203
|
+
v: '',
|
|
204
|
+
};
|
|
205
|
+
this.siprecHeaders = [header];
|
|
206
|
+
}
|
|
207
|
+
for (var i=0; i < this.siprecHeaders.length; i++) {
|
|
208
|
+
var header = this.siprecHeaders[i];
|
|
209
|
+
$("#node-input-siprecHeaders-container").editableList('addItem', header);
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
oneditsave: function () {
|
|
213
|
+
var node = this;
|
|
214
|
+
var headers = [];
|
|
215
|
+
$("#node-input-siprecHeaders-container").editableList('items').each(function(i) {
|
|
216
|
+
var header = $(this);
|
|
217
|
+
var h = header.find(".node-input-header-property-name").val();
|
|
218
|
+
var v = header.find(".node-input-value-property-name").val();
|
|
219
|
+
var obj = {};
|
|
220
|
+
obj[h] = v;
|
|
221
|
+
headers.push({h, v});
|
|
222
|
+
});
|
|
223
|
+
node.siprecHeaders = headers;
|
|
169
224
|
}
|
|
170
225
|
});
|
|
171
226
|
</script>
|
|
@@ -259,6 +314,14 @@
|
|
|
259
314
|
<input type="text" id="node-input-recordingID" placeholder="545362a9-4cb3-4a55-85b8-b33ca83a6517">
|
|
260
315
|
<input type="hidden" id="node-input-recordingIDType">
|
|
261
316
|
</div>
|
|
317
|
+
<fieldset>
|
|
318
|
+
<div class="form-row" style="margin-bottom:0;">
|
|
319
|
+
<label style="width:100%"><i class="fa fa-list"></i> <span>Add custom SIPREC headers</span></label>
|
|
320
|
+
</div>
|
|
321
|
+
<div class="form-row node-input-siprecHeaders-container-row">
|
|
322
|
+
<ol id="node-input-siprecHeaders-container"></ol>
|
|
323
|
+
</div>
|
|
324
|
+
</fieldset>
|
|
262
325
|
</div>
|
|
263
326
|
</script>
|
|
264
327
|
|
package/src/nodes/lcc.js
CHANGED
|
@@ -76,6 +76,16 @@ function lcc(config) {
|
|
|
76
76
|
siprecServerURL: new_resolve(RED, config.siprecServerURL, config.siprecServerURLType, node, msg),
|
|
77
77
|
recordingID: new_resolve(RED, config.recordingID, config.recordingIDType, node, msg) || crypto.randomUUID()
|
|
78
78
|
};
|
|
79
|
+
// SIPREC headers
|
|
80
|
+
if (config.siprecHeaders) {
|
|
81
|
+
var headers = {};
|
|
82
|
+
config.siprecHeaders.forEach(function(h) {
|
|
83
|
+
if (h.h.length && h.v.length) headers[h.h] = h.v;
|
|
84
|
+
});
|
|
85
|
+
if (Object.keys(headers).length) {
|
|
86
|
+
Object.assign(opts.record, {headers});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
79
89
|
break;
|
|
80
90
|
case 'stop_call_recording':
|
|
81
91
|
opts.record = { action: 'stopCallRecording' };
|