@jambonz/node-red-contrib-jambonz 2.3.7 → 2.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/node-red-contrib-jambonz",
3
- "version": "2.3.7",
3
+ "version": "2.3.9",
4
4
  "description": "Node-RED nodes for jambonz platform",
5
5
  "keywords": [
6
6
  "node-red"
@@ -48,7 +48,7 @@ module.exports = function(RED) {
48
48
  }
49
49
  if (config.dtmfinput) {
50
50
  obj.input.push('digits');
51
- if (config.finishonkey && config.finishonkey.length) obj.finishOnKey = obj.finishonkey;
51
+ if (config.finishonkey && config.finishonkey.length) obj.finishOnKey = config.finishonkey;
52
52
  if (/^\d+$/.test(config.numdigits)) obj.numDigits = parseInt(config.numdigits);
53
53
  if (/^\d+$/.test(config.timeout)) obj.timeout = parseInt(config.timeout);
54
54
  }
@@ -26,10 +26,18 @@
26
26
  return action !== 'hold_conf' || v.length > 0;
27
27
  }},
28
28
  waitHookType: {value: 'str'},
29
+ siprecServerURL: {value: '', validate: function(v) {
30
+ const action = $('#node-input-action').val();
31
+ return action !== 'start_call_recording' || v.length > 0;
32
+ }},
33
+ siprecServerURLType: {value: 'str'},
34
+ recordingID: {value: ''},
35
+ recordingIDType: {value: 'str'},
29
36
  },
30
37
  inputs:1,
31
38
  outputs:1,
32
39
  icon: "font-awesome/fa-cubes",
40
+ paletteLabel: "Live Call Control",
33
41
  label: function() {
34
42
  return this.name || (this.action ? `LCC - ${this.action}` : 'LCC');
35
43
  },
@@ -42,8 +50,7 @@
42
50
  var sayDiv = $('#say-options');
43
51
  var redirectDiv = $('#redirect-options');
44
52
  var waitHookDiv = $('#wait-options');
45
- sayDiv.hide();
46
- waitHookDiv.hide();
53
+ var recordDiv = $('#record-options');
47
54
 
48
55
  $('#node-input-callSid').typedInput({
49
56
  default: $('#node-input-callSidType').val(),
@@ -60,15 +67,27 @@
60
67
  types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
61
68
  typeField: $('#node-input-waitHookType')
62
69
  });
70
+ $('#node-input-siprecServerURL').typedInput({
71
+ default: $('#node-input-siprecServerURLType').val(),
72
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
73
+ typeField: $('#node-input-siprecServerURLType')
74
+ });
75
+ $('#node-input-recordingID').typedInput({
76
+ default: $('#node-input-recordingIDType').val(),
77
+ types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
78
+ typeField: $('#node-input-recordingIDType')
79
+ });
63
80
 
64
81
  var onActionChanged = function () {
65
- node.action = actionElem.find(':selected').val();
66
- if ('whisper' === node.action) sayDiv.show();
82
+ var selectedAction = actionElem.find(':selected').val();
83
+ if ('whisper' === selectedAction) sayDiv.show();
67
84
  else sayDiv.hide();
68
- if ('redirect' === node.action) redirectDiv.show();
85
+ if ('redirect' === selectedAction) redirectDiv.show();
69
86
  else redirectDiv.hide();
70
- if ('hold_conf' === node.action) waitHookDiv.show();
87
+ if ('hold_conf' === selectedAction) waitHookDiv.show();
71
88
  else waitHookDiv.hide();
89
+ if ('start_call_recording' === selectedAction) recordDiv.show();
90
+ else recordDiv.hide();
72
91
  }
73
92
 
74
93
  var onVendorChanged = function() {
@@ -146,7 +165,7 @@
146
165
 
147
166
  <!-- HTML -->
148
167
  <script type="text/html" data-template-name="lcc">
149
- <div class="form-row">
168
+ <div class="form-row">
150
169
  <label for="node-input-name"><i class="icon-tag"></i> Name</label>
151
170
  <input type="text" id="node-input-name" placeholder="Name">
152
171
  </div>
@@ -173,6 +192,10 @@
173
192
  <option value="resume">resume listen audio feed</option>
174
193
  <option value="redirect">redirect call</option>
175
194
  <option value="whisper">whisper</option>
195
+ <option value="start_call_recording">start call recording</option>
196
+ <option value="stop_call_recording">stop call recording</option>
197
+ <option value="pause_call_recording">pause call recording</option>
198
+ <option value="resume_call_recording">resume call recording</option>
176
199
  </select>
177
200
  </div>
178
201
  <div id="say-options">
@@ -216,6 +239,18 @@
216
239
  <label for="node-input-waitHook">Wait webhook</label>
217
240
  <input type="text" id="node-input-waitHook" placeholder="/path">
218
241
  <input type="hidden" id="node-input-waitHookType">
242
+ </div>
243
+ </div>
244
+ <div id="record-options">
245
+ <div class="form-row">
246
+ <label for="node-input-siprecServerURL">SIPREC URI</label>
247
+ <input type="text" id="node-input-siprecServerURL" placeholder="sip:srs@recording.example.com">
248
+ <input type="hidden" id="node-input-siprecServerURLType">
249
+ </div>
250
+ <div class="form-row">
251
+ <label for="node-input-recordingID">Recording ID</label>
252
+ <input type="text" id="node-input-recordingID" placeholder="545362a9-4cb3-4a55-85b8-b33ca83a6517">
253
+ <input type="hidden" id="node-input-recordingIDType">
219
254
  </div>
220
255
  </div>
221
256
  </script>
package/src/nodes/lcc.js CHANGED
@@ -1,3 +1,4 @@
1
+ var crypto = require('crypto');
1
2
  var {v_resolve, doLCC} = require('./libs')
2
3
 
3
4
  module.exports = function(RED) {
@@ -44,7 +45,6 @@ function lcc(config) {
44
45
  opts.listen_status = 'resume';
45
46
  break;
46
47
  case 'redirect':
47
- node.log(`LCC redirect callHook ${config.callHook} callHookType: ${config.callHookType}`);
48
48
  opts.call_hook = {url: v_resolve(config.callHook, config.callHookType, this.context(), msg)};
49
49
  break;
50
50
  case 'hold_conf':
@@ -70,6 +70,22 @@ function lcc(config) {
70
70
  });
71
71
  }
72
72
  break;
73
+ case 'start_call_recording':
74
+ opts.record = {
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()
78
+ };
79
+ break;
80
+ case 'stop_call_recording':
81
+ opts.record = { action: 'stopCallRecording' };
82
+ break;
83
+ case 'pause_call_recording':
84
+ opts.record = { action: 'pauseCallRecording' };
85
+ break;
86
+ case 'resume_call_recording':
87
+ opts.record = { action: 'resumeCallRecording' };
88
+ break;
73
89
  default:
74
90
  node.log(`invalid action: ${config.action}`);
75
91
  send(msg);
package/src/nodes/libs.js CHANGED
@@ -81,7 +81,7 @@ exports.appendVerb = (msg, obj) => {
81
81
  'Authorization': `Bearer ${apiToken}`
82
82
  });
83
83
  const url = `Accounts/${accountSid}/Calls/${callSid}`;
84
- node.log(`invoking LCC with callSid ${callSid} at ${baseUrl}/v1/${url}`);
84
+ node.log(`invoking LCC with payload ${JSON.stringify(opts)} at ${baseUrl}/v1/${url}`);
85
85
  return post(url, opts);
86
86
  }
87
87