@jambonz/node-red-contrib-jambonz 2.3.9 → 2.3.11
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/dequeue.html +12 -0
- package/src/nodes/dequeue.js +3 -1
- package/src/nodes/enqueue.html +13 -0
- package/src/nodes/enqueue.js +3 -0
- package/src/utils/http-helpers.js +10 -5
package/package.json
CHANGED
package/src/nodes/dequeue.html
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
name: {value: ''},
|
|
8
8
|
queue: {required: true, value: ''},
|
|
9
9
|
queueType: {value: 'str'},
|
|
10
|
+
callSid: {value: ''},
|
|
11
|
+
callSidType: {value: 'str'},
|
|
10
12
|
actionHook: {},
|
|
11
13
|
actionHookType: {value: 'str'},
|
|
12
14
|
confirmHook: {},
|
|
@@ -26,6 +28,10 @@
|
|
|
26
28
|
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
27
29
|
typeField: $('#node-input-queueType')
|
|
28
30
|
});
|
|
31
|
+
$('#node-input-callSid').typedInput({
|
|
32
|
+
types: ['str', 'msg', 'flow', 'global'],
|
|
33
|
+
typeField: $('#node-input-callSidType')
|
|
34
|
+
});
|
|
29
35
|
$('#node-input-actionHook').typedInput({
|
|
30
36
|
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
31
37
|
typeField: $('#node-input-actionHookType')
|
|
@@ -53,6 +59,11 @@
|
|
|
53
59
|
<input type="text" id="node-input-queue" placeholder="name of queue to remove caller from">
|
|
54
60
|
<input type="hidden" id="node-input-queueType">
|
|
55
61
|
</div>
|
|
62
|
+
<div class="form-row">
|
|
63
|
+
<label for="node-input-callSid">Call Sid</label>
|
|
64
|
+
<input type="text" id="node-input-callSid" placeholder="sid of the call">
|
|
65
|
+
<input type="hidden" id="node-input-callSidType">
|
|
66
|
+
</div>
|
|
56
67
|
<div class="form-row">
|
|
57
68
|
<label for="node-input-beep">Play beep on connecting</label>
|
|
58
69
|
<input type="checkbox" id="node-input-beep">
|
|
@@ -79,6 +90,7 @@
|
|
|
79
90
|
<p>removes the a call from the front of a queue and bridges that call to the current caller.</p>
|
|
80
91
|
<h3>Properties</h3>
|
|
81
92
|
<p><code>Queue name</code> - Name of the queue.</p>
|
|
93
|
+
<p><code>Call Sid</code> - An optional parameter to specify which call to dequeue.</p>
|
|
82
94
|
<p><code>Play beep on connecting</code> - Play a beep tone to this caller only just prior to connecting the queued call.</p>
|
|
83
95
|
<p><code>Action hook</code> - A webhook invoke when call ends.</p>
|
|
84
96
|
<p><code>Confirm hook</code> - A webhook for an application to run on the callee's end before the call is bridged.</p>
|
package/src/nodes/dequeue.js
CHANGED
|
@@ -6,13 +6,15 @@ module.exports = function(RED) {
|
|
|
6
6
|
RED.nodes.createNode(this, config);
|
|
7
7
|
var node = this;
|
|
8
8
|
node.on('input', function(msg, send, done) {
|
|
9
|
+
const timeout = v_resolve(config.timeout, config.timeoutType, this.context(), msg);
|
|
9
10
|
appendVerb(msg, {
|
|
10
11
|
verb: 'dequeue',
|
|
11
12
|
name: v_resolve(config.queue, config.queueType, this.context(), msg),
|
|
13
|
+
callSid: v_resolve(config.callSid, config.callSidType, this.context(), msg),
|
|
12
14
|
beep: config.beep,
|
|
13
15
|
actionHook: v_resolve(config.actionHook, config.actionHookType, this.context(), msg),
|
|
14
16
|
confirmHook: v_resolve(config.confirmHook, config.confirmHookType, this.context(), msg),
|
|
15
|
-
timeout:
|
|
17
|
+
timeout: (/^\d+$/.test(timeout)) ? parseInt(timeout) : null,
|
|
16
18
|
});
|
|
17
19
|
node.send(msg);
|
|
18
20
|
});
|
package/src/nodes/enqueue.html
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
name: {value: ''},
|
|
8
8
|
queue: {required: true, value: ''},
|
|
9
9
|
queueType: {value: 'str'},
|
|
10
|
+
priority: {value: 999},
|
|
11
|
+
priorityType: {value: 'num'},
|
|
10
12
|
actionHook: {},
|
|
11
13
|
actionHookType: {value: 'str'},
|
|
12
14
|
waitHook: {},
|
|
@@ -23,6 +25,10 @@
|
|
|
23
25
|
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
24
26
|
typeField: $('#node-input-queueType')
|
|
25
27
|
});
|
|
28
|
+
$('#node-input-priority').typedInput({
|
|
29
|
+
types: ['num', 'msg', 'flow', 'global'],
|
|
30
|
+
typeField: $('#node-input-priorityType')
|
|
31
|
+
});
|
|
26
32
|
$('#node-input-actionHook').typedInput({
|
|
27
33
|
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
28
34
|
typeField: $('#node-input-actionHookType')
|
|
@@ -46,6 +52,11 @@
|
|
|
46
52
|
<input type="text" id="node-input-queue" placeholder="name of queue">
|
|
47
53
|
<input type="hidden" id="node-input-queueType">
|
|
48
54
|
</div>
|
|
55
|
+
<div class="form-row">
|
|
56
|
+
<label for="node-input-priority">Priority</label>
|
|
57
|
+
<input type="text" id="node-input-priority" placeholder="caller priority">
|
|
58
|
+
<input type="hidden" id="node-input-priorityType">
|
|
59
|
+
</div>
|
|
49
60
|
<div class="form-row">
|
|
50
61
|
<label for="node-input-actionHook">Action hook</label>
|
|
51
62
|
<input type="text" id="node-input-actionHook" placeholder="webhook url">
|
|
@@ -64,6 +75,8 @@
|
|
|
64
75
|
<h3>Properties</h3>
|
|
65
76
|
<p><code>Queue name</code> -
|
|
66
77
|
The name of the queue</p>
|
|
78
|
+
<p><code>Priority</code> -
|
|
79
|
+
The priority for which the call will be added to the queue. Must be a non-negative value and defaults to 999 (low-priority) if not set.</p>
|
|
67
80
|
<p><code>Action hook</code> -
|
|
68
81
|
A webhook invoke when operation completes.</p>
|
|
69
82
|
<p><code>Wait hook</code> -
|
package/src/nodes/enqueue.js
CHANGED
|
@@ -6,9 +6,12 @@ module.exports = function(RED) {
|
|
|
6
6
|
RED.nodes.createNode(this, config);
|
|
7
7
|
var node = this;
|
|
8
8
|
node.on('input', function(msg, send, done) {
|
|
9
|
+
const priorityValue = v_resolve(config.priority, config.priorityType, this.context(), msg);
|
|
10
|
+
|
|
9
11
|
appendVerb(msg, {
|
|
10
12
|
verb: 'enqueue',
|
|
11
13
|
name: v_resolve(config.queue, config.queueType, this.context(), msg),
|
|
14
|
+
priority: (/^\d+$/.test(priorityValue)) ? parseInt(priorityValue) : null,
|
|
12
15
|
actionHook: v_resolve(config.actionHook, config.actionHookType, this.context(), msg),
|
|
13
16
|
waitHook: v_resolve(config.waitHook, config.waitHookType, this.context(), msg)
|
|
14
17
|
});
|
|
@@ -53,17 +53,22 @@ module.exports = function(RED) {
|
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
RED.httpAdmin.get('/_jambonz/applications/:serverId', (req, res) => {
|
|
56
|
-
|
|
56
|
+
const conn = RED.nodes.getNode(req.params.serverId);
|
|
57
57
|
if (conn && conn.credentials) {
|
|
58
|
-
const {apiToken} = conn.credentials;
|
|
59
|
-
const url = conn
|
|
58
|
+
const { apiToken } = conn.credentials;
|
|
59
|
+
const { url } = conn;
|
|
60
60
|
const getApps = bent(`${url}/v1/Applications`, 'GET', 'json', 200, {
|
|
61
61
|
'Authorization': `Bearer ${apiToken}`
|
|
62
62
|
});
|
|
63
63
|
getApps()
|
|
64
|
-
.then(
|
|
65
|
-
|
|
64
|
+
.then((apps) => {
|
|
65
|
+
res.send(apps);
|
|
66
66
|
})
|
|
67
|
+
.catch((error) => {
|
|
68
|
+
res.status(500).send(error.message);
|
|
69
|
+
});
|
|
70
|
+
} else {
|
|
71
|
+
res.status(404);
|
|
67
72
|
}
|
|
68
73
|
});
|
|
69
74
|
};
|