@jambonz/node-red-contrib-jambonz 2.3.1 → 2.3.2
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 +4 -4
- package/src/nodes/auth.html +9 -16
- package/src/nodes/auth.js +2 -9
- package/src/nodes/conference.html +12 -15
- package/src/nodes/conference.js +0 -4
- package/src/nodes/config.js +0 -4
- package/src/nodes/create_call.html +7 -16
- package/src/nodes/create_call.js +2 -6
- package/src/nodes/create_sms.html +3 -15
- package/src/nodes/create_sms.js +0 -5
- package/src/nodes/dequeue.html +6 -8
- package/src/nodes/dequeue.js +0 -4
- package/src/nodes/dial.html +3 -8
- package/src/nodes/dial.js +0 -5
- package/src/nodes/dialogflow.html +3 -13
- package/src/nodes/dialogflow.js +0 -5
- package/src/nodes/dtmf.html +5 -11
- package/src/nodes/dtmf.js +0 -5
- package/src/nodes/enqueue.html +7 -14
- package/src/nodes/enqueue.js +0 -6
- package/src/nodes/gather.html +3 -8
- package/src/nodes/gather.js +0 -5
- package/src/nodes/get_alerts.html +5 -27
- package/src/nodes/get_alerts.js +14 -16
- package/src/nodes/get_calls.html +6 -28
- package/src/nodes/get_calls.js +36 -36
- package/src/nodes/get_recent_calls.html +25 -27
- package/src/nodes/get_recent_calls.js +21 -21
- package/src/nodes/hangup.html +5 -11
- package/src/nodes/hangup.js +2 -7
- package/src/nodes/lcc.html +12 -19
- package/src/nodes/lcc.js +0 -4
- package/src/nodes/leave.html +4 -5
- package/src/nodes/leave.js +0 -6
- package/src/nodes/lex.html +5 -3
- package/src/nodes/lex.js +0 -5
- package/src/nodes/listen.html +2 -3
- package/src/nodes/listen.js +0 -5
- package/src/nodes/message.html +5 -6
- package/src/nodes/message.js +30 -30
- package/src/nodes/pause.html +5 -8
- package/src/nodes/pause.js +0 -6
- package/src/nodes/play.html +7 -10
- package/src/nodes/play.js +0 -5
- package/src/nodes/rasa.html +5 -13
- package/src/nodes/rasa.js +1 -5
- package/src/nodes/redirect.html +4 -8
- package/src/nodes/redirect.js +0 -6
- package/src/nodes/s3-upload.html +0 -2
- package/src/nodes/s3-upload.js +1 -6
- package/src/nodes/say.html +5 -7
- package/src/nodes/say.js +0 -4
- package/src/nodes/sip-decline.html +5 -8
- package/src/nodes/sip-decline.js +0 -5
- package/src/nodes/sip-refer.html +4 -12
- package/src/nodes/sip-refer.js +1 -5
- package/src/nodes/sip-request.html +5 -11
- package/src/nodes/sip-request.js +1 -8
- package/src/nodes/tag.html +2 -4
- package/src/nodes/tag.js +0 -5
- package/src/nodes/template.html +7 -16
- package/src/nodes/userauth.html +47 -21
- package/src/nodes/userauth.js +18 -6
- package/src/nodes/webhooks.html +26 -29
- package/src/utils/http-helpers.js +5 -4
- package/src/utils/tts-utils.js +1 -0
package/src/nodes/enqueue.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
|
-
const bent = require('bent');
|
|
3
|
-
var mustache = require('mustache');
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
1
|
var {appendVerb, v_resolve} = require('./libs')
|
|
6
2
|
|
|
7
|
-
|
|
8
3
|
module.exports = function(RED) {
|
|
9
4
|
/** enqueue */
|
|
10
5
|
function enqueue(config) {
|
|
@@ -21,5 +16,4 @@ module.exports = function(RED) {
|
|
|
21
16
|
});
|
|
22
17
|
}
|
|
23
18
|
RED.nodes.registerType('enqueue', enqueue);
|
|
24
|
-
|
|
25
19
|
}
|
package/src/nodes/gather.html
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
<script type="text/javascript">
|
|
5
3
|
RED.nodes.registerType('gather',{
|
|
6
4
|
category: 'jambonz',
|
|
@@ -113,12 +111,9 @@
|
|
|
113
111
|
$('#node-input-prompttype').change(onSayPlayChanged);
|
|
114
112
|
}
|
|
115
113
|
});
|
|
116
|
-
|
|
117
114
|
</script>
|
|
118
115
|
|
|
119
|
-
|
|
120
116
|
<!-- HTML -->
|
|
121
|
-
|
|
122
117
|
<script type="text/html" data-template-name="gather">
|
|
123
118
|
<div class="form-row">
|
|
124
119
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
@@ -276,7 +271,7 @@
|
|
|
276
271
|
</div>
|
|
277
272
|
</div>
|
|
278
273
|
</fieldset>
|
|
279
|
-
|
|
274
|
+
</script>
|
|
280
275
|
|
|
281
276
|
<!-- Help Text -->
|
|
282
277
|
<script type="text/html" data-help-name="gather">
|
|
@@ -321,6 +316,6 @@
|
|
|
321
316
|
<code>The payload is {{msg.payload}}</code>
|
|
322
317
|
<h3>References</h3>
|
|
323
318
|
<ul>
|
|
324
|
-
<li><a href="https://
|
|
319
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/gather/">Jambonz gather reference</a></li>
|
|
325
320
|
</ul>
|
|
326
|
-
|
|
321
|
+
</script>
|
package/src/nodes/gather.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
|
-
const bent = require('bent');
|
|
3
|
-
var mustache = require('mustache');
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
1
|
var {appendVerb, v_resolve, v_text_resolve} = require('./libs')
|
|
6
2
|
|
|
7
|
-
|
|
8
3
|
module.exports = function(RED) {
|
|
9
4
|
/** gather */
|
|
10
5
|
function gather(config) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
<script type="text/javascript">
|
|
5
|
-
|
|
3
|
+
RED.nodes.registerType('get_alerts',{
|
|
6
4
|
category: 'jambonz',
|
|
7
5
|
color: '#aebfb9',
|
|
8
6
|
defaults: {
|
|
@@ -13,7 +11,7 @@
|
|
|
13
11
|
count:{value: 25},
|
|
14
12
|
countType:{value: 'num'},
|
|
15
13
|
days:{value: 7},
|
|
16
|
-
|
|
14
|
+
daysType:{value: 'num'}
|
|
17
15
|
},
|
|
18
16
|
inputs:1,
|
|
19
17
|
outputs:1,
|
|
@@ -36,13 +34,9 @@
|
|
|
36
34
|
});
|
|
37
35
|
}
|
|
38
36
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
37
|
</script>
|
|
42
38
|
|
|
43
|
-
|
|
44
39
|
<!-- HTML -->
|
|
45
|
-
|
|
46
40
|
<script type="text/html" data-template-name="get_alerts">
|
|
47
41
|
<div class="form-row">
|
|
48
42
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
@@ -67,28 +61,12 @@
|
|
|
67
61
|
<input type="text" id="node-input-days" >
|
|
68
62
|
<input type="hidden" id="node-input-daysType">
|
|
69
63
|
</div>
|
|
70
|
-
|
|
71
|
-
|
|
72
64
|
</script>
|
|
73
65
|
|
|
74
66
|
<!-- Help Text -->
|
|
75
|
-
|
|
76
67
|
<script type="text/html" data-help-name="get_alerts">
|
|
77
|
-
|
|
78
|
-
<h3>Properties</h3>
|
|
79
|
-
<p><code>XXXX</code> - TEXT</p>
|
|
80
|
-
|
|
81
|
-
<h3>Outputs</h3>
|
|
82
|
-
<dl class="message-properties">
|
|
83
|
-
<dt>payload<span class="property-type">object</span></dt>
|
|
84
|
-
<dd> <code>msg.payload</code> will contain ... </dd>
|
|
85
|
-
</dl>
|
|
86
|
-
|
|
87
|
-
<h3>Details</h3>
|
|
88
|
-
The listen verb establishes a connection to a websocket server and sends live audio for the current call.<h3>References</h3>
|
|
89
|
-
<ul>
|
|
90
|
-
<li><a href="https://docs.jambonz.org/jambonz/#listen">Jambonz listen reference</a></li>
|
|
91
|
-
</ul>
|
|
92
|
-
</script>
|
|
68
|
+
<p>Get alerts</p>
|
|
93
69
|
|
|
70
|
+
<h3>Details</h3>
|
|
71
|
+
Retrieve alerts for a specified account
|
|
94
72
|
</script>
|
package/src/nodes/get_alerts.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
1
|
const bent = require('bent');
|
|
3
|
-
var
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
|
-
var {appendVerb, v_resolve, v_text_resolve, doLCC, doCreateCall, doCreateMessage} = require('./libs')
|
|
2
|
+
var {v_resolve} = require('./libs');
|
|
6
3
|
|
|
7
4
|
module.exports = function(RED) {
|
|
8
5
|
function get_alerts(config) {
|
|
@@ -12,10 +9,11 @@ module.exports = function(RED) {
|
|
|
12
9
|
const {accountSid, apiToken} = server.credentials;
|
|
13
10
|
node.on('input', async(msg, send, done) => {
|
|
14
11
|
const data = {
|
|
15
|
-
page: config.page,
|
|
16
|
-
count
|
|
17
|
-
days
|
|
12
|
+
page: v_resolve(config.page, config.pageType, this.context(), msg),
|
|
13
|
+
count: v_resolve(config.count, config.countType, this.context(), msg),
|
|
14
|
+
days: v_resolve(config.days, config.daysType, this.context(), msg),
|
|
18
15
|
}
|
|
16
|
+
Object.keys(data).forEach((k) => data[k] == null || data[k] == '' && delete data[k]);
|
|
19
17
|
const params = new URLSearchParams(data).toString()
|
|
20
18
|
const req = bent(`${server.url}/v1/Accounts/${accountSid}/Alerts?${params}`, 'GET', 'json', {
|
|
21
19
|
'Authorization': `Bearer ${apiToken}`
|
|
@@ -28,20 +26,20 @@ module.exports = function(RED) {
|
|
|
28
26
|
msg.page = res.page
|
|
29
27
|
} catch (err) {
|
|
30
28
|
if (err.statusCode) {
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
node.error(`GetAlerts failed with ${err.statusCode}`);
|
|
30
|
+
msg.statusCode = err.statusCode;
|
|
33
31
|
}
|
|
34
32
|
else {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
node.error(`Error getting alerts ${JSON.stringify(err)}`);
|
|
34
|
+
if (done) done(err);
|
|
35
|
+
else node.error(err, msg);
|
|
36
|
+
send(msg);
|
|
37
|
+
return;
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
send(msg);
|
|
43
41
|
if (done) done();
|
|
44
42
|
});
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
}
|
|
44
|
+
RED.nodes.registerType('get_alerts', get_alerts);
|
|
47
45
|
}
|
package/src/nodes/get_calls.html
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
<script type="text/javascript">
|
|
5
|
-
|
|
3
|
+
RED.nodes.registerType('get_calls',{
|
|
6
4
|
category: 'jambonz',
|
|
7
5
|
color: '#aebfb9',
|
|
8
6
|
defaults: {
|
|
@@ -13,18 +11,11 @@
|
|
|
13
11
|
outputs:1,
|
|
14
12
|
icon: "font-awesome/fa-cubes",
|
|
15
13
|
paletteLabel: "Get - Calls",
|
|
16
|
-
label: function() { return this.name || 'Get Calls';}
|
|
17
|
-
oneditprepare: () => {
|
|
18
|
-
var node = this;
|
|
19
|
-
}
|
|
14
|
+
label: function() { return this.name || 'Get Calls';}
|
|
20
15
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
16
|
</script>
|
|
24
17
|
|
|
25
|
-
|
|
26
18
|
<!-- HTML -->
|
|
27
|
-
|
|
28
19
|
<script type="text/html" data-template-name="get_calls">
|
|
29
20
|
<div class="form-row">
|
|
30
21
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
@@ -37,23 +28,10 @@
|
|
|
37
28
|
</script>
|
|
38
29
|
|
|
39
30
|
<!-- Help Text -->
|
|
40
|
-
|
|
41
31
|
<script type="text/html" data-help-name="get_calls">
|
|
42
|
-
|
|
43
|
-
<h3>Properties</h3>
|
|
44
|
-
<p><code>XXXX</code> - TEXT</p>
|
|
45
|
-
|
|
46
|
-
<h3>Outputs</h3>
|
|
47
|
-
<dl class="message-properties">
|
|
48
|
-
<dt>payload<span class="property-type">object</span></dt>
|
|
49
|
-
<dd> <code>msg.payload</code> will contain ... </dd>
|
|
50
|
-
</dl>
|
|
51
|
-
|
|
52
|
-
<h3>Details</h3>
|
|
53
|
-
The listen verb establishes a connection to a websocket server and sends live audio for the current call.<h3>References</h3>
|
|
54
|
-
<ul>
|
|
55
|
-
<li><a href="https://docs.jambonz.org/jambonz/#listen">Jambonz listen reference</a></li>
|
|
56
|
-
</ul>
|
|
57
|
-
</script>
|
|
32
|
+
<p>Get calls</p>
|
|
58
33
|
|
|
34
|
+
<h3>Details</h3>
|
|
35
|
+
Retrieve info for a group of calls under an account.
|
|
36
|
+
Call detail are only kept in the system for 10 minutes by default.
|
|
59
37
|
</script>
|
package/src/nodes/get_calls.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
const bent = require('bent');
|
|
3
|
-
var mustache = require('mustache');
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
|
-
var {appendVerb, v_resolve, v_text_resolve, doLCC, doCreateCall, doCreateMessage} = require('./libs')
|
|
1
|
+
const bent = require("bent");
|
|
6
2
|
|
|
7
|
-
module.exports = function(RED) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
3
|
+
module.exports = function (RED) {
|
|
4
|
+
function get_calls(config) {
|
|
5
|
+
RED.nodes.createNode(this, config);
|
|
6
|
+
var node = this;
|
|
7
|
+
const server = RED.nodes.getNode(config.server);
|
|
8
|
+
const { accountSid, apiToken } = server.credentials;
|
|
9
|
+
node.on("input", async (msg, send, done) => {
|
|
10
|
+
const req = bent(
|
|
11
|
+
`${server.url}/v1/Accounts/${accountSid}/Calls`,
|
|
12
|
+
"GET",
|
|
13
|
+
"json",
|
|
14
|
+
{
|
|
15
|
+
Authorization: `Bearer ${apiToken}`,
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
try {
|
|
19
|
+
const res = await req();
|
|
20
|
+
msg.payload = res;
|
|
21
|
+
} catch (err) {
|
|
22
|
+
if (err.statusCode) {
|
|
23
|
+
node.error(`GetCalls failed with ${err.statusCode}`);
|
|
24
|
+
msg.statusCode = err.statusCode;
|
|
25
|
+
} else {
|
|
26
|
+
node.error(`Error getting calls ${JSON.stringify(err)}`);
|
|
27
|
+
if (done) done(err);
|
|
28
|
+
else node.error(err, msg);
|
|
29
|
+
send(msg);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
36
32
|
}
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
send(msg);
|
|
34
|
+
if (done) done();
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
RED.nodes.registerType("get_calls", get_calls);
|
|
38
|
+
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
<script type="text/javascript">
|
|
5
|
-
|
|
3
|
+
RED.nodes.registerType('get_recent_calls',{
|
|
6
4
|
category: 'jambonz',
|
|
7
5
|
color: '#aebfb9',
|
|
8
6
|
defaults: {
|
|
9
7
|
name: {value: ''},
|
|
10
8
|
server: {value: '', required: true, type: 'jambonz_auth'},
|
|
9
|
+
direction: {value: ''},
|
|
10
|
+
directionType:{value: 'str'},
|
|
11
|
+
trunk: {value: ''},
|
|
12
|
+
trunkType:{value: 'str'},
|
|
11
13
|
page:{value: 1},
|
|
12
14
|
pageType:{value: 'num'},
|
|
13
15
|
count:{value: 25},
|
|
14
16
|
countType:{value: 'num'},
|
|
15
17
|
days:{value: 7},
|
|
16
|
-
|
|
18
|
+
daysType:{value: 'num'}
|
|
17
19
|
},
|
|
18
20
|
inputs:1,
|
|
19
21
|
outputs:1,
|
|
@@ -21,7 +23,6 @@
|
|
|
21
23
|
paletteLabel: "Get - Recent Calls",
|
|
22
24
|
label: function() { return this.name || 'Get Recent Calls';},
|
|
23
25
|
oneditprepare: () => {
|
|
24
|
-
var node = this;
|
|
25
26
|
$('#node-input-page').typedInput({
|
|
26
27
|
types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
27
28
|
typeField: $('#node-input-pageType')
|
|
@@ -34,15 +35,19 @@
|
|
|
34
35
|
types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
35
36
|
typeField: $('#node-input-daysType')
|
|
36
37
|
});
|
|
38
|
+
$('#node-input-direction').typedInput({
|
|
39
|
+
types: ['str', 'msg', 'flow', 'global'],
|
|
40
|
+
typeField: $('#node-input-directionType')
|
|
41
|
+
});
|
|
42
|
+
$('#node-input-trunk').typedInput({
|
|
43
|
+
types: ['str', 'msg', 'flow', 'global'],
|
|
44
|
+
typeField: $('#node-input-trunkType')
|
|
45
|
+
});
|
|
37
46
|
}
|
|
38
47
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
48
|
</script>
|
|
42
49
|
|
|
43
|
-
|
|
44
50
|
<!-- HTML -->
|
|
45
|
-
|
|
46
51
|
<script type="text/html" data-template-name="get_recent_calls">
|
|
47
52
|
<div class="form-row">
|
|
48
53
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
@@ -52,6 +57,16 @@
|
|
|
52
57
|
<label for="node-input-server">Server</label>
|
|
53
58
|
<input type="text" id="node-input-server">
|
|
54
59
|
</div>
|
|
60
|
+
<div class="form-row">
|
|
61
|
+
<label for="node-input-direction">Direction</label>
|
|
62
|
+
<input type="text" id="node-input-direction" placeholder="inbound">
|
|
63
|
+
<input type="hidden" id="node-input-directionType">
|
|
64
|
+
</div>
|
|
65
|
+
<div class="form-row">
|
|
66
|
+
<label for="node-input-trunk">Trunk</label>
|
|
67
|
+
<input type="text" id="node-input-trunk" placeholder="trunk name">
|
|
68
|
+
<input type="hidden" id="node-input-trunkType">
|
|
69
|
+
</div>
|
|
55
70
|
<div class="form-row">
|
|
56
71
|
<label for="node-input-page">Page</label>
|
|
57
72
|
<input type="text" id="node-input-page" >
|
|
@@ -67,29 +82,12 @@
|
|
|
67
82
|
<input type="text" id="node-input-days" >
|
|
68
83
|
<input type="hidden" id="node-input-daysType">
|
|
69
84
|
</div>
|
|
70
|
-
|
|
71
|
-
|
|
72
85
|
</script>
|
|
73
86
|
|
|
74
87
|
<!-- Help Text -->
|
|
75
|
-
|
|
76
88
|
<script type="text/html" data-help-name="get_recent_calls">
|
|
77
|
-
|
|
78
|
-
<h3>Properties</h3>
|
|
79
|
-
<p><code>XXXX</code> - TEXT</p>
|
|
80
|
-
|
|
81
|
-
<h3>Outputs</h3>
|
|
82
|
-
<dl class="message-properties">
|
|
83
|
-
<dt>payload<span class="property-type">object</span></dt>
|
|
84
|
-
<dd> <code>msg.payload</code> will contain ... </dd>
|
|
85
|
-
</dl>
|
|
89
|
+
<p>Get recent call records</p>
|
|
86
90
|
|
|
87
91
|
<h3>Details</h3>
|
|
88
92
|
Call detail records are only kept in the system for 30 days. As there could be a large number of CDRs, this node allows you to query pages of data at a time.
|
|
89
|
-
|
|
90
|
-
<ul>
|
|
91
|
-
<li><a href="https://api.jambonz.org/#4e82bdc2-327b-40a5-9b52-f86357647b45">Jambonz Get Recent Calls reference</a></li>
|
|
92
|
-
</ul>
|
|
93
|
-
</script>
|
|
94
|
-
|
|
95
93
|
</script>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
1
|
const bent = require('bent');
|
|
3
|
-
var
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
|
-
var {appendVerb, v_resolve, v_text_resolve, doLCC, doCreateCall, doCreateMessage} = require('./libs')
|
|
2
|
+
var {v_resolve} = require('./libs');
|
|
6
3
|
|
|
7
4
|
module.exports = function(RED) {
|
|
8
5
|
function get_recent_calls(config) {
|
|
@@ -12,36 +9,39 @@ module.exports = function(RED) {
|
|
|
12
9
|
const {accountSid, apiToken} = server.credentials;
|
|
13
10
|
node.on('input', async(msg, send, done) => {
|
|
14
11
|
const data = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
direction: v_resolve(config.direction, config.directionType, this.context(), msg),
|
|
13
|
+
trunk: v_resolve(config.trunk, config.trunkType, this.context(), msg),
|
|
14
|
+
page: v_resolve(config.page, config.pageType, this.context(), msg),
|
|
15
|
+
count: v_resolve(config.count, config.countType, this.context(), msg),
|
|
16
|
+
days: v_resolve(config.days, config.daysType, this.context(), msg),
|
|
18
17
|
}
|
|
19
|
-
|
|
18
|
+
Object.keys(data).forEach((k) => data[k] == null || data[k] == '' && delete data[k]);
|
|
19
|
+
const params = new URLSearchParams(data).toString();
|
|
20
20
|
const req = bent(`${server.url}/v1/Accounts/${accountSid}/RecentCalls?${params}`, 'GET', 'json', {
|
|
21
21
|
'Authorization': `Bearer ${apiToken}`
|
|
22
22
|
});
|
|
23
23
|
try {
|
|
24
24
|
const res = await req();
|
|
25
|
-
msg.payload = res.data
|
|
26
|
-
msg.total = res.total
|
|
27
|
-
msg.page_size = res.page_size
|
|
28
|
-
msg.page = res.page
|
|
25
|
+
msg.payload = res.data;
|
|
26
|
+
msg.total = res.total;
|
|
27
|
+
msg.page_size = res.page_size;
|
|
28
|
+
msg.page = res.page;
|
|
29
29
|
} catch (err) {
|
|
30
30
|
if (err.statusCode) {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
node.error(`GetRecentCalls failed with ${err.statusCode}`);
|
|
32
|
+
msg.statusCode = err.statusCode;
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
node.error(`Error getting recent calls ${JSON.stringify(err)}`);
|
|
36
|
+
if (done) done(err);
|
|
37
|
+
else node.error(err, msg);
|
|
38
|
+
send(msg);
|
|
39
|
+
return;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
send(msg);
|
|
43
43
|
if (done) done();
|
|
44
44
|
});
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
}
|
|
46
|
+
RED.nodes.registerType('get_recent_calls', get_recent_calls);
|
|
47
47
|
}
|
package/src/nodes/hangup.html
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
|
-
|
|
3
|
-
|
|
4
2
|
<script type="text/javascript">
|
|
5
|
-
|
|
6
|
-
RED.nodes.registerType('hangup',{
|
|
3
|
+
RED.nodes.registerType('hangup',{
|
|
7
4
|
category: 'jambonz',
|
|
8
5
|
color: '#bbabaa',
|
|
9
6
|
defaults: {
|
|
@@ -14,18 +11,15 @@ RED.nodes.registerType('hangup',{
|
|
|
14
11
|
icon: "font-awesome/fa-cubes",
|
|
15
12
|
label: function() { return this.name || 'hangup';},
|
|
16
13
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
14
|
</script>
|
|
20
15
|
|
|
21
|
-
|
|
22
16
|
<!-- HTML -->
|
|
23
17
|
<script type="text/html" data-template-name="hangup">
|
|
24
18
|
<div class="form-row">
|
|
25
19
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
26
20
|
<input type="text" id="node-input-name" placeholder="Name">
|
|
27
21
|
</div>
|
|
28
|
-
|
|
22
|
+
</script>
|
|
29
23
|
|
|
30
24
|
<!-- Help Text -->
|
|
31
25
|
<script type="text/html" data-help-name="hangup">
|
|
@@ -33,14 +27,14 @@ RED.nodes.registerType('hangup',{
|
|
|
33
27
|
|
|
34
28
|
<h3>Outputs</h3>
|
|
35
29
|
<dl class="message-properties">
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
31
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>hangup</code> action appended </dd>
|
|
38
32
|
</dl>
|
|
39
33
|
|
|
40
34
|
<h3>Details</h3>
|
|
41
35
|
The hangup verb hangs up the current call.
|
|
42
36
|
<h3>References</h3>
|
|
43
37
|
<ul>
|
|
44
|
-
<li><a href="https://
|
|
38
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/hangup/">Jambonz hangup reference</a></li>
|
|
45
39
|
</ul>
|
|
46
40
|
</script>
|
package/src/nodes/hangup.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
|
-
const bent = require('bent');
|
|
3
|
-
var mustache = require('mustache');
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
1
|
var {appendVerb} = require('./libs')
|
|
6
2
|
|
|
7
|
-
|
|
8
3
|
module.exports = function(RED) {
|
|
9
4
|
function hangup(config) {
|
|
10
5
|
RED.nodes.createNode(this, config);
|
|
@@ -15,6 +10,6 @@ module.exports = function(RED) {
|
|
|
15
10
|
});
|
|
16
11
|
node.send(msg);
|
|
17
12
|
});
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
}
|
|
14
|
+
RED.nodes.registerType('hangup', hangup);
|
|
20
15
|
}
|
package/src/nodes/lcc.html
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('lcc',{
|
|
3
|
+
RED.nodes.registerType('lcc',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#aebfb9',
|
|
6
6
|
defaults: {
|
|
@@ -142,10 +142,8 @@ RED.nodes.registerType('lcc',{
|
|
|
142
142
|
voiceElem.change(onVoiceChanged);
|
|
143
143
|
}
|
|
144
144
|
});
|
|
145
|
-
|
|
146
145
|
</script>
|
|
147
146
|
|
|
148
|
-
|
|
149
147
|
<!-- HTML -->
|
|
150
148
|
<script type="text/html" data-template-name="lcc">
|
|
151
149
|
<div class="form-row">
|
|
@@ -220,37 +218,32 @@ RED.nodes.registerType('lcc',{
|
|
|
220
218
|
<input type="hidden" id="node-input-waitHookType">
|
|
221
219
|
</div>
|
|
222
220
|
</div>
|
|
223
|
-
|
|
221
|
+
</script>
|
|
224
222
|
|
|
225
223
|
<!-- Help Text -->
|
|
226
|
-
|
|
227
224
|
<script type="text/html" data-help-name="lcc">
|
|
228
225
|
<p>Perform Live Call Control</p>
|
|
229
226
|
<h3>Properties</h3>
|
|
230
227
|
<p><code>Server</code> -
|
|
231
|
-
|
|
228
|
+
jambonz server to connect to</p>
|
|
232
229
|
<p><code>CallSid</code> -
|
|
233
|
-
|
|
230
|
+
Call identifier</p>
|
|
234
231
|
<p><code>Action</code> -
|
|
235
|
-
|
|
232
|
+
Action to perform on the call</p>
|
|
236
233
|
<p><code>Text</code> -
|
|
237
|
-
|
|
234
|
+
Text to speak, only if action is 'whisper'</p>
|
|
238
235
|
<p><code>Vendor</code> -
|
|
239
|
-
|
|
236
|
+
TTS vendor to use for whisper</p>
|
|
240
237
|
<p><code>Language</code> -
|
|
241
|
-
|
|
238
|
+
TTS language to use for whisper</p>
|
|
242
239
|
<p><code>Voice</code> -
|
|
243
|
-
|
|
244
|
-
|
|
240
|
+
TTS voice to use for whisper</p>
|
|
245
241
|
|
|
246
242
|
<h3>Details</h3>
|
|
247
243
|
The lcc command is used to perform live call control on a call in progress.
|
|
248
244
|
The call can be terminated, the caller can be muted or unmuted, or the live
|
|
249
|
-
audio feed that is being sent via a <a href="https://
|
|
245
|
+
audio feed that is being sent via a <a href="https://www.jambonz.org/docs/webhooks/listen/">listen</a> verb can be paused or resumed.
|
|
250
246
|
<br/><br/>
|
|
251
|
-
A common use case is to use dtmf captures in a <a href="https://
|
|
247
|
+
A common use case is to use dtmf captures in a <a href="https://www.jambonz.org/docs/webhooks/dial/">dial</a> verb to call a webhook
|
|
252
248
|
that then uses lcc to modify the state of the call.
|
|
253
|
-
|
|
254
|
-
<ul>
|
|
255
|
-
<li><a href="https://docs.jambonz.org/rest/#updating-a-call">Jambonz reference</a></li>
|
|
256
|
-
</script>
|
|
249
|
+
</script>
|
package/src/nodes/lcc.js
CHANGED
package/src/nodes/leave.html
CHANGED
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
});
|
|
14
14
|
</script>
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
<!-- HTML -->
|
|
18
17
|
<script type="text/html" data-template-name="leave">
|
|
19
18
|
<div class="form-row">
|
|
@@ -28,13 +27,13 @@
|
|
|
28
27
|
|
|
29
28
|
<h3>Outputs</h3>
|
|
30
29
|
<dl class="message-properties">
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
31
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>leave</code> action appended </dd>
|
|
33
32
|
</dl>
|
|
34
33
|
|
|
35
34
|
<h3>Details</h3>
|
|
36
35
|
The leave verb transfers a call out of a queue. The call then returns to the flow of execution following the enqueue verb that parked the call, or the document returned by that verbs actionHook property, if provided.<h3>References</h3>
|
|
37
36
|
<ul>
|
|
38
|
-
<li><a href="https://
|
|
37
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/leave/">Jambonz leave reference</a></li>
|
|
39
38
|
</ul>
|
|
40
|
-
|
|
39
|
+
</script>
|