@jambonz/node-red-contrib-jambonz 2.4.6 → 2.4.8

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.6",
3
+ "version": "2.4.8",
4
4
  "description": "Node-RED nodes for jambonz platform",
5
5
  "keywords": [
6
6
  "node-red"
@@ -1,29 +1,33 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
- var mustacheType = {
3
+ var mustacheType = {
4
4
  value: 'mustache',
5
5
  label: 'mustache',
6
6
  hasvalue: true,
7
7
  icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
8
8
  }
9
- RED.nodes.registerType('dial',{
9
+ RED.nodes.registerType('dial', {
10
10
  category: 'jambonz',
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'}]},
15
15
  headers: {value: []},
16
16
  actionhook: {value: ''},
17
17
  actionhookType: {value: 'str'},
18
18
  answeronbridge: {value: false},
19
19
  callerid: {value: ''},
20
20
  calleridType: {value: ''},
21
+ callername: {value: ''},
22
+ callernameType: {value: ''},
21
23
  confirmhook: {value: ''},
22
24
  confirmhookType: {value: 'str'},
23
25
  dialmusic: {value: ''},
24
26
  dialmusicType: {value: 'str'},
25
27
  dtmfcapture: {value: ''},
26
28
  dtmfcaptureType: {value: 'str'},
29
+ referhook: {value: ''},
30
+ referhookType: {value: 'str'},
27
31
  dtmfhook: {value: ''},
28
32
  dtmfhookType: {value: 'str'},
29
33
  timelimit: {validate:RED.validators.regex(/^\d*$/) },
@@ -70,6 +74,10 @@
70
74
  types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
71
75
  typeField: $('#node-input-calleridType')
72
76
  });
77
+ $('#node-input-callername').typedInput({
78
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
79
+ typeField: $('#node-input-callernameType')
80
+ });
73
81
  $('#node-input-target-property-trunk').typedInput({
74
82
  types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
75
83
  typeField: $('#node-input-target-property-trunk')
@@ -90,6 +98,10 @@
90
98
  types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
91
99
  typeField: $('#node-input-dtmfcaptureType')
92
100
  });
101
+ $('#node-input-referhook').typedInput({
102
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
103
+ typeField: $('#node-input-referhookType')
104
+ });
93
105
  $('#node-input-dtmfhook').typedInput({
94
106
  types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env', mustacheType],
95
107
  typeField: $('#node-input-dtmfhookType')
@@ -382,7 +394,7 @@
382
394
  <input type="text" id="node-input-name" placeholder="Name">
383
395
  </div>
384
396
  <div class="form-row" style="margin-bottom:0;">
385
- <label><i class="fa fa-list"></i><span>Dial Targets</span></label>
397
+ <label><i class="fa fa-list"></i> <span>Dial Targets</span></label>
386
398
  </div>
387
399
  <div class="form-row node-input-target-container-row">
388
400
  <ol id="node-input-target-container"></ol>
@@ -398,9 +410,14 @@
398
410
  </div>
399
411
  <div class="form-row">
400
412
  <label for="node-input-callerid">Caller ID</label>
401
- <input type="text" id="node-input-callerid" placeholder="Caller ID to place on outbound call">
413
+ <input type="text" id="node-input-callerid" placeholder="caller id to place on outbound call">
402
414
  <input type="hidden" id="node-input-calleridType">
403
415
  </div>
416
+ <div class="form-row">
417
+ <label for="node-input-callername">Caller name</label>
418
+ <input type="text" id="node-input-callername" placeholder="caller name to place on outbound call">
419
+ <input type="hidden" id="node-input-callernameType">
420
+ </div>
404
421
  <div class="form-row">
405
422
  <label for="node-input-confirmhook">Confirm hook</label>
406
423
  <input type="text" id="node-input-confirmhook" placeholder="webhook to run on called party after answer">
@@ -416,6 +433,11 @@
416
433
  <input type="text" id="node-input-dtmfcapture" placeholder="comma-separated list of dtmf captures">
417
434
  <input type="hidden" id="node-input-dtmfcaptureType">
418
435
  </div>
436
+ <div class="form-row">
437
+ <label for="node-input-referhook">Refer hook</label>
438
+ <input type="text" id="node-input-referhook" placeholder="webhook to call when sip refer is received">
439
+ <input type="hidden" id="node-input-referhookType">
440
+ </div>
419
441
  <div class="form-row">
420
442
  <label for="node-input-dtmfhook">Dtmf hook</label>
421
443
  <input type="text" id="node-input-dtmfhook" placeholder="webhook to call when dtmf is captured">
package/src/nodes/dial.js CHANGED
@@ -46,9 +46,11 @@ module.exports = function(RED) {
46
46
  timeLimit: config.timelimit ? parseInt(config.timelimit) : null,
47
47
  timeout: config.timeout ? parseInt(config.timeout) : null,
48
48
  callerId: new_resolve(RED, config.callerid, config.calleridType, node, msg),
49
+ callerName: new_resolve(RED, config.callername, config.callernameType, node, msg),
49
50
  actionHook: new_resolve(RED, config.actionhook, config.actionhookType, node, msg),
50
51
  confirmHook: new_resolve(RED, config.confirmhook, config.confirmhookType, node, msg),
51
52
  dialMusic: new_resolve(RED, config.dialmusic, config.dialmusicType, node, msg),
53
+ referHook: new_resolve(RED, config.referhook, config.referhookType, node, msg),
52
54
  dtmfHook: new_resolve(RED, config.dtmfhook, config.dtmfhookType, node, msg),
53
55
  };
54
56
 
@@ -1,12 +1,11 @@
1
1
  <!-- Javascript -->
2
2
  <script type="text/javascript">
3
3
  var mustacheType = {
4
- value: 'mustache',
5
- label: 'mustache',
6
- hasvalue: true,
7
- icon: 'resources/@jambonz/node-red-contrib-jambonz/icons/mustache.svg'
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' };