@jambonz/node-red-contrib-jambonz 2.3.0 → 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 +20 -15
- package/src/nodes/dial.js +3 -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 +7 -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/libs.js +2 -1
- 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 +9 -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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jambonz/node-red-contrib-jambonz",
|
|
3
|
-
"version": "2.3.
|
|
4
|
-
"description": "Node-RED nodes for jambonz",
|
|
3
|
+
"version": "2.3.2",
|
|
4
|
+
"description": "Node-RED nodes for jambonz platform",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-red"
|
|
7
7
|
],
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"author": "Dave Horton",
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"aws-sdk": "^2.
|
|
56
|
+
"aws-sdk": "^2.1302.0",
|
|
57
57
|
"bent": "^7.3.12",
|
|
58
58
|
"body-parser": "^1.20.1",
|
|
59
59
|
"cookie-parser": "^1.4.6",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"on-headers": "^1.0.2",
|
|
67
67
|
"raw-body": "^2.5.1",
|
|
68
68
|
"s3-upload-stream": "^1.0.7",
|
|
69
|
-
"ws": "^8.
|
|
69
|
+
"ws": "^8.12.1"
|
|
70
70
|
}
|
|
71
71
|
}
|
package/src/nodes/auth.html
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
|
|
4
3
|
RED.nodes.registerType('jambonz_auth',{
|
|
5
4
|
category: 'config',
|
|
6
5
|
defaults: {
|
|
@@ -20,13 +19,16 @@
|
|
|
20
19
|
{value: 'https://api.jambonz.us', label : 'jambonz.us', hasValue: false},
|
|
21
20
|
{value: 'https://api.jambonz.xyz', label : 'jambonz.xyz', hasValue: false}],
|
|
22
21
|
typeField: $('#node-config-input-urlType')
|
|
23
|
-
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
oneditsave: function() {
|
|
25
|
+
const baseUrl = $('#node-config-input-url').val();
|
|
26
|
+
if (baseUrl.endsWith('/')) {
|
|
27
|
+
$('#node-config-input-url').val(baseUrl.slice(0, -1));
|
|
28
|
+
}
|
|
24
29
|
}
|
|
25
30
|
});
|
|
26
31
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
32
|
RED.nodes.registerType('aws_auth',{
|
|
31
33
|
category: 'config',
|
|
32
34
|
credentials: {
|
|
@@ -43,12 +45,9 @@
|
|
|
43
45
|
});
|
|
44
46
|
</script>
|
|
45
47
|
|
|
46
|
-
|
|
47
48
|
<!-- HTML -->
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
<!-- aws auth -->
|
|
50
|
+
<!-- aws auth -->
|
|
52
51
|
<script type="text/html" data-template-name="aws_auth">
|
|
53
52
|
<div class="form-row">
|
|
54
53
|
<label for="node-config-input-accessKey">AWS Access Key ID</label>
|
|
@@ -60,8 +59,6 @@
|
|
|
60
59
|
</div>
|
|
61
60
|
</script>
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
|
|
65
62
|
<!-- jambonz auth -->
|
|
66
63
|
<script type="text/html" data-template-name="jambonz_auth">
|
|
67
64
|
<div class="form-row">
|
|
@@ -72,10 +69,9 @@
|
|
|
72
69
|
<label for="node-config-input-url">Base URL</label>
|
|
73
70
|
<input type="text" id="node-config-input-url" placeholder="http://localhost:3000">
|
|
74
71
|
<input type="hidden" id="node-config-input-urlType">
|
|
75
|
-
|
|
76
72
|
</div>
|
|
77
73
|
<div class="form-row">
|
|
78
|
-
<label for="node-config-input-accountSid">
|
|
74
|
+
<label for="node-config-input-accountSid">Account SID</label>
|
|
79
75
|
<input type="text" id="node-config-input-accountSid">
|
|
80
76
|
</div>
|
|
81
77
|
<div class="form-row">
|
|
@@ -88,8 +84,6 @@
|
|
|
88
84
|
</div>
|
|
89
85
|
</script>
|
|
90
86
|
|
|
91
|
-
|
|
92
|
-
|
|
93
87
|
<!-- Help Text -->
|
|
94
88
|
|
|
95
89
|
<!-- AWS auth-->
|
|
@@ -100,7 +94,6 @@
|
|
|
100
94
|
</script>
|
|
101
95
|
|
|
102
96
|
<!-- jambonz auth -->
|
|
103
|
-
|
|
104
97
|
<script type="text/x-red" data-help-name="jambonz_auth">
|
|
105
98
|
<p>Creates a new jambonz server credential </p>
|
|
106
99
|
<h3>Properties</h3>
|
package/src/nodes/auth.js
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
|
-
const bent = require('bent');
|
|
3
|
-
var mustache = require('mustache');
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
|
-
var {v_resolve} = require('./libs')
|
|
6
|
-
|
|
7
1
|
module.exports = function(RED) {
|
|
8
|
-
|
|
9
2
|
function jambonz_auth(config) {
|
|
10
3
|
RED.nodes.createNode(this, config);
|
|
11
4
|
this.accountSid = config.accountSid;
|
|
@@ -18,6 +11,7 @@ module.exports = function(RED) {
|
|
|
18
11
|
this.url = config.urlType;
|
|
19
12
|
}
|
|
20
13
|
}
|
|
14
|
+
|
|
21
15
|
RED.nodes.registerType('jambonz_auth', jambonz_auth, {
|
|
22
16
|
credentials: {
|
|
23
17
|
url: {type: 'text'},
|
|
@@ -39,5 +33,4 @@ module.exports = function(RED) {
|
|
|
39
33
|
secretAccessKey: {type: 'text'}
|
|
40
34
|
}
|
|
41
35
|
});
|
|
42
|
-
|
|
43
|
-
}
|
|
36
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('conference',{
|
|
3
|
+
RED.nodes.registerType('conference',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#bbabaa',
|
|
6
6
|
defaults: {
|
|
@@ -43,10 +43,8 @@ RED.nodes.registerType('conference',{
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
|
-
|
|
47
46
|
</script>
|
|
48
47
|
|
|
49
|
-
|
|
50
48
|
<!-- HTML -->
|
|
51
49
|
<script type="text/html" data-template-name="conference">
|
|
52
50
|
<div class="form-row">
|
|
@@ -95,25 +93,24 @@ RED.nodes.registerType('conference',{
|
|
|
95
93
|
<script type="text/html" data-help-name="conference">
|
|
96
94
|
<p>places a caller in a conference.</p>
|
|
97
95
|
<h3>Properties</h3>
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
<h3>Outputs</h3>
|
|
96
|
+
<p><code>Conference Name </code> - The name of the conference to join the caller to.</p>
|
|
97
|
+
<p><code>Enter hook </code> - A webhook to retrieve something to play or say to the caller just before they are put into a conference after waiting for it to start</p>
|
|
98
|
+
<p><code>Wait hook </code> - A webhook to retrieve commands to play or say while the caller is waiting for the conference to start</p>
|
|
99
|
+
<p><code>Beep on entry</code> - if checked, play a beep tone to the conference when caller enters </p>
|
|
100
|
+
<p><code>Start on entry</code> - if checked, start the conference only when this caller enters</p>
|
|
101
|
+
<p><code>End on exit</code> - if checked, end the conference when this caller hangs up</p>
|
|
102
|
+
<p><code>Max participants</code> - maximum number of participants that will be allowed in the conference</p>
|
|
103
|
+
<h3>Outputs</h3>
|
|
107
104
|
<dl class="message-properties">
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
106
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>conference</code> action appended </dd>
|
|
110
107
|
</dl>
|
|
111
108
|
|
|
112
109
|
<h3>Details</h3>
|
|
113
110
|
The conference verb places a call into a conference.
|
|
114
111
|
<h3>References</h3>
|
|
115
112
|
<ul>
|
|
116
|
-
<li><a href="https://
|
|
113
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/conference/">Jambonz conference reference</a></li>
|
|
117
114
|
</ul>
|
|
118
115
|
</script>
|
|
119
116
|
|
package/src/nodes/conference.js
CHANGED
package/src/nodes/config.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
|
|
3
|
+
RED.nodes.registerType('create-call',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#aebfb9',
|
|
6
6
|
defaults: {
|
|
@@ -57,7 +57,6 @@
|
|
|
57
57
|
prepareTtsControls(node);
|
|
58
58
|
prepareSttControls(node);
|
|
59
59
|
|
|
60
|
-
|
|
61
60
|
$('#node-input-from').typedInput({
|
|
62
61
|
default: $('#node-input-fromType').val(),
|
|
63
62
|
types: ['str','msg', 'flow', 'global', 'jsonata', 'env'],
|
|
@@ -125,7 +124,6 @@
|
|
|
125
124
|
});
|
|
126
125
|
</script>
|
|
127
126
|
|
|
128
|
-
|
|
129
127
|
<!-- HTML -->
|
|
130
128
|
<script type="text/html" data-template-name="create-call">
|
|
131
129
|
<div class="form-row">
|
|
@@ -254,12 +252,9 @@
|
|
|
254
252
|
</div>
|
|
255
253
|
</fieldset>
|
|
256
254
|
</div>
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
</script>
|
|
255
|
+
</script>
|
|
260
256
|
|
|
261
257
|
<!-- Help Text -->
|
|
262
|
-
|
|
263
258
|
<script type="text/html" data-help-name="create-call">
|
|
264
259
|
<p>Create an outbound call</p>
|
|
265
260
|
<h3>Properties</h3>
|
|
@@ -271,17 +266,13 @@
|
|
|
271
266
|
|
|
272
267
|
<h3>Outputs</h3>
|
|
273
268
|
<dl class="message-properties">
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
269
|
+
<dt>statusCode<span class="property-type">int</span></dt>
|
|
270
|
+
<dd> <code>msg.statusCode</code> will contain the response code from Jambomnz to the createCall request</dd>
|
|
271
|
+
<dt>callSid<span class="property-type">string</span></dt>
|
|
272
|
+
<dd> <code>msg.callSid</code> will contain the SID of the call that was created</dd>
|
|
278
273
|
</dl>
|
|
279
274
|
|
|
280
275
|
<h3>Details</h3>
|
|
281
276
|
The create call command is used to generate a new outbound call.
|
|
282
277
|
When the call is answered the specified application's call hook will be invoked.
|
|
283
|
-
|
|
284
|
-
<ul>
|
|
285
|
-
<li><a href="https://docs.jambonz.org/rest/#create-a-call">Jambonz reference</a></li>
|
|
286
|
-
</ul>
|
|
287
|
-
</script>
|
|
278
|
+
</script>
|
package/src/nodes/create_call.js
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
|
-
var mustache = require('mustache');
|
|
3
|
-
const { toNamespacedPath } = require('path');
|
|
4
|
-
mustache.escape = function(text) {return text;};
|
|
5
1
|
var {v_resolve, doCreateCall, } = require('./libs')
|
|
6
2
|
|
|
7
3
|
module.exports = function(RED) {
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
/** Create call */
|
|
5
|
+
function create_call(config) {
|
|
10
6
|
RED.nodes.createNode(this, config);
|
|
11
7
|
var node = this;
|
|
12
8
|
const server = RED.nodes.getNode(config.server);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
|
|
3
|
+
RED.nodes.registerType('create-sms',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#aebfb9',
|
|
6
6
|
defaults: {
|
|
@@ -46,12 +46,9 @@
|
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
|
-
|
|
50
49
|
</script>
|
|
51
50
|
|
|
52
|
-
|
|
53
51
|
<!-- HTML -->
|
|
54
|
-
|
|
55
52
|
<script type="text/html" data-template-name="create-sms">
|
|
56
53
|
<div class="form-row">
|
|
57
54
|
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
@@ -81,11 +78,9 @@
|
|
|
81
78
|
<input type="text" id="node-input-provider">
|
|
82
79
|
<input type="hidden" id="node-input-providerType">
|
|
83
80
|
</div>
|
|
84
|
-
|
|
81
|
+
</script>
|
|
85
82
|
|
|
86
|
-
|
|
87
83
|
<!-- Help Text -->
|
|
88
|
-
|
|
89
84
|
<script type="text/html" data-help-name="create-sms">
|
|
90
85
|
<p>Send an SMS</p>
|
|
91
86
|
<h3>Properties</h3>
|
|
@@ -94,13 +89,6 @@
|
|
|
94
89
|
<p><code>To</code> - Destination phone number</p>
|
|
95
90
|
<p><code>Text</code> - Text message</p>
|
|
96
91
|
|
|
97
|
-
|
|
98
92
|
<h3>Details</h3>
|
|
99
93
|
The create message command is used to send an SMS message.
|
|
100
|
-
|
|
101
|
-
<h3>References</h3>
|
|
102
|
-
<ul>
|
|
103
|
-
<li><a href="https://docs.jambonz.org/rest/#create-a-call">Jambonz reference</a></li>
|
|
104
|
-
</ul>
|
|
105
|
-
-->
|
|
106
|
-
</script>
|
|
94
|
+
</script>
|
package/src/nodes/create_sms.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 {v_resolve, doCreateMessage} = require('./libs')
|
|
6
2
|
|
|
7
|
-
|
|
8
3
|
module.exports = function(RED) {
|
|
9
4
|
/** Create sms */
|
|
10
5
|
function create_sms(config) {
|
package/src/nodes/dequeue.html
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('dequeue',{
|
|
3
|
+
RED.nodes.registerType('dequeue',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#bbabaa',
|
|
6
6
|
defaults: {
|
|
@@ -42,7 +42,6 @@ RED.nodes.registerType('dequeue',{
|
|
|
42
42
|
});
|
|
43
43
|
</script>
|
|
44
44
|
|
|
45
|
-
|
|
46
45
|
<!-- HTML -->
|
|
47
46
|
<script type="text/html" data-template-name="dequeue">
|
|
48
47
|
<div class="form-row">
|
|
@@ -73,9 +72,8 @@ RED.nodes.registerType('dequeue',{
|
|
|
73
72
|
<input type="text" id="node-input-timeout" placeholder="seconds to wait if queue is empty">
|
|
74
73
|
<input type="hidden" id="node-input-timeoutType">
|
|
75
74
|
</div>
|
|
76
|
-
|
|
75
|
+
</script>
|
|
77
76
|
|
|
78
|
-
|
|
79
77
|
<!-- Help Text -->
|
|
80
78
|
<script type="text/html" data-help-name="dequeue">
|
|
81
79
|
<p>removes the a call from the front of a queue and bridges that call to the current caller.</p>
|
|
@@ -89,14 +87,14 @@ RED.nodes.registerType('dequeue',{
|
|
|
89
87
|
|
|
90
88
|
<h3>Outputs</h3>
|
|
91
89
|
<dl class="message-properties">
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
91
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>dequeue</code> action appended </dd>
|
|
94
92
|
</dl>
|
|
95
93
|
|
|
96
94
|
<h3>Details</h3>
|
|
97
95
|
The dequeue verb removes the a call from the front of a specified queue and bridges that call to the current caller.
|
|
98
96
|
<h3>References</h3>
|
|
99
97
|
<ul>
|
|
100
|
-
<li><a href="https://
|
|
98
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/dequeue/">Jambonz dequeue reference</a></li>
|
|
101
99
|
</ul>
|
|
102
|
-
|
|
100
|
+
</script>
|
package/src/nodes/dequeue.js
CHANGED
package/src/nodes/dial.html
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('dial',{
|
|
3
|
+
RED.nodes.registerType('dial',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#bbabaa',
|
|
6
6
|
defaults: {
|
|
7
7
|
name: {value: ''},
|
|
8
|
-
targets:{value:[{type: 'phone', dest: '', user: '', pass: '', varType: 'str', trunk: ''}]},
|
|
8
|
+
targets:{value:[{type: 'phone', dest: '', user: '', pass: '', varType: 'str', trunk: '', trunkType: 'str'}]},
|
|
9
9
|
headers: {value: []},
|
|
10
10
|
actionhook: {value: ''},
|
|
11
11
|
actionhookType: {value: 'str'},
|
|
@@ -64,6 +64,10 @@ RED.nodes.registerType('dial',{
|
|
|
64
64
|
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
65
65
|
typeField: $('#node-input-calleridType')
|
|
66
66
|
});
|
|
67
|
+
$('#node-input-target-property-trunk').typedInput({
|
|
68
|
+
types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
69
|
+
typeField: $('#node-input-target-property-trunk')
|
|
70
|
+
});
|
|
67
71
|
$('#node-input-actionhook').typedInput({
|
|
68
72
|
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
69
73
|
typeField: $('#node-input-actionhookType')
|
|
@@ -130,7 +134,9 @@ RED.nodes.registerType('dial',{
|
|
|
130
134
|
dest: '',
|
|
131
135
|
user: '',
|
|
132
136
|
pass: '',
|
|
133
|
-
varType: 'str'
|
|
137
|
+
varType: 'str',
|
|
138
|
+
trunk: '',
|
|
139
|
+
trunkType: 'str'
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
142
|
|
|
@@ -143,7 +149,7 @@ RED.nodes.registerType('dial',{
|
|
|
143
149
|
var row2 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
144
150
|
var row3 = $('<div/>',{style:"margin-top:8px;"}).appendTo(fragment);
|
|
145
151
|
var row4 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
146
|
-
var row5 = $('<div/>',{style:"margin-top:8px;"}).appendTo(fragment);
|
|
152
|
+
var row5 = $('<div/>',{style:"display:flex;margin-top:8px;"}).appendTo(fragment);
|
|
147
153
|
|
|
148
154
|
var selectField = $('<select/>',{class:"node-input-target-type",style:"width:110px; margin-right:10px;"})
|
|
149
155
|
.appendTo(row1);
|
|
@@ -177,12 +183,13 @@ RED.nodes.registerType('dial',{
|
|
|
177
183
|
$('<label style="padding-top:8px; padding-right:20px">Trunk:</label>')
|
|
178
184
|
.appendTo(row5);
|
|
179
185
|
|
|
180
|
-
|
|
186
|
+
var trunkName = $('<input/>',{
|
|
181
187
|
class:"node-input-target-property-trunk",
|
|
182
188
|
type:"text",
|
|
183
189
|
placeholder: 'Specify the name of the trunk used for this outbound call'
|
|
184
190
|
})
|
|
185
|
-
.appendTo(row5)
|
|
191
|
+
.appendTo(row5)
|
|
192
|
+
.typedInput({types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env']});
|
|
186
193
|
|
|
187
194
|
selectField.on('change', function() {
|
|
188
195
|
var type = $(this).val();
|
|
@@ -231,7 +238,8 @@ RED.nodes.registerType('dial',{
|
|
|
231
238
|
|
|
232
239
|
switch (target.type) {
|
|
233
240
|
case 'phone':
|
|
234
|
-
trunkfield.
|
|
241
|
+
trunkfield.typedInput('type', target.trunkType);
|
|
242
|
+
trunkfield.typedInput('value', target.trunk);
|
|
235
243
|
case 'sip':
|
|
236
244
|
userfield.val(target.user);
|
|
237
245
|
passfield.val(target.pass);
|
|
@@ -321,7 +329,8 @@ RED.nodes.registerType('dial',{
|
|
|
321
329
|
var dest = target.find('.node-input-target-property-name').typedInput('value');
|
|
322
330
|
var user = target.find('.node-input-target-property-authuser').val();
|
|
323
331
|
var pass = target.find('.node-input-target-property-authpassword').val();
|
|
324
|
-
var trunk = target.find('.node-input-target-property-trunk').
|
|
332
|
+
var trunk = target.find('.node-input-target-property-trunk').typedInput('value');
|
|
333
|
+
var trunkType = target.find('.node-input-target-property-trunk').typedInput('type');
|
|
325
334
|
if (!['phone', 'user', 'sip', 'teams'].includes(type) || 0 === dest.length) return;
|
|
326
335
|
|
|
327
336
|
var t = {
|
|
@@ -333,6 +342,7 @@ RED.nodes.registerType('dial',{
|
|
|
333
342
|
Object.assign(t, {user, pass});
|
|
334
343
|
}
|
|
335
344
|
if ('phone' === type && trunk.length > 0) {
|
|
345
|
+
t.trunkType = trunkType;
|
|
336
346
|
t.trunk = trunk;
|
|
337
347
|
}
|
|
338
348
|
node.targets.push(t);
|
|
@@ -353,13 +363,9 @@ RED.nodes.registerType('dial',{
|
|
|
353
363
|
console.log(`saved headers ${JSON.stringify(node.headers)}`);
|
|
354
364
|
},
|
|
355
365
|
});
|
|
356
|
-
|
|
357
|
-
|
|
358
366
|
</script>
|
|
359
367
|
|
|
360
|
-
|
|
361
368
|
<!-- HTML -->
|
|
362
|
-
|
|
363
369
|
<script type="text/html" data-template-name="dial">
|
|
364
370
|
<style>
|
|
365
371
|
ol#node-input-target-container .red-ui-typedInput-container {
|
|
@@ -559,7 +565,7 @@ RED.nodes.registerType('dial',{
|
|
|
559
565
|
</div>
|
|
560
566
|
</fieldset>
|
|
561
567
|
</div>
|
|
562
|
-
|
|
568
|
+
</script>
|
|
563
569
|
|
|
564
570
|
<!-- Help Text -->
|
|
565
571
|
<script type="text/html" data-help-name="dial">
|
|
@@ -604,7 +610,6 @@ RED.nodes.registerType('dial',{
|
|
|
604
610
|
<p><code>Send interim transcriptions</code> -
|
|
605
611
|
<dd>if true interim transcriptions are sent.</p>
|
|
606
612
|
|
|
607
|
-
|
|
608
613
|
<h3>Outputs</h3>
|
|
609
614
|
<dl class="message-properties">
|
|
610
615
|
<dt>jambonz<span class="property-type">object</span></dt>
|
|
@@ -614,6 +619,6 @@ RED.nodes.registerType('dial',{
|
|
|
614
619
|
<h3>Details</h3>
|
|
615
620
|
The dial verb is used to create a new call by dialing out to a number, a registered sip user, or sip endpoint
|
|
616
621
|
<ul>
|
|
617
|
-
<li><a href="https://
|
|
622
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/dial/">Jambonz dial reference</a></li>
|
|
618
623
|
</ul>
|
|
619
624
|
</script>
|
package/src/nodes/dial.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var {createHash} = require('crypto');
|
|
2
|
-
const bent = require('bent');
|
|
3
1
|
var {appendVerb, v_resolve} = require('./libs')
|
|
4
2
|
|
|
5
3
|
module.exports = function(RED) {
|
|
@@ -8,15 +6,16 @@ module.exports = function(RED) {
|
|
|
8
6
|
var node = this;
|
|
9
7
|
|
|
10
8
|
node.on('input', function(msg) {
|
|
11
|
-
|
|
12
9
|
node.log(`dial config: ${JSON.stringify(config)}, msg.call: ${JSON.stringify(msg.call)}`);
|
|
13
10
|
var target = config.targets.map((t) => {
|
|
14
11
|
const obj = Object.assign({}, t);
|
|
15
12
|
var dest = v_resolve(obj.dest, obj.varType, this.context(), msg);
|
|
13
|
+
var trunk = v_resolve(obj.trunk, obj.trunkType, this.context(), msg);
|
|
16
14
|
node.log(`dial: dest ${t.varType}:${t.dest} resolved to ${dest}`);
|
|
17
15
|
switch (t.type) {
|
|
18
16
|
case 'phone':
|
|
19
17
|
obj.number = dest;
|
|
18
|
+
obj.trunk = trunk;
|
|
20
19
|
break;
|
|
21
20
|
case 'user':
|
|
22
21
|
obj.name = dest;
|
|
@@ -37,6 +36,7 @@ module.exports = function(RED) {
|
|
|
37
36
|
break;
|
|
38
37
|
}
|
|
39
38
|
delete obj.varType;
|
|
39
|
+
delete obj.trunkType;
|
|
40
40
|
delete obj.dest;
|
|
41
41
|
return obj;
|
|
42
42
|
});
|
|
@@ -53,7 +53,6 @@ module.exports = function(RED) {
|
|
|
53
53
|
dtmfHook: v_resolve(config.dtmfhook, config.dtmfhookType, this.context(), msg)
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
|
|
57
56
|
// headers
|
|
58
57
|
var headers = {};
|
|
59
58
|
config.headers.forEach(function(h) {
|
|
@@ -126,7 +125,6 @@ module.exports = function(RED) {
|
|
|
126
125
|
delete data.dtmfHook;
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
|
|
130
128
|
node.log(`dial verb: ${JSON.stringify(data)}`);
|
|
131
129
|
|
|
132
130
|
appendVerb(msg, data);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- Javascript -->
|
|
2
2
|
<script type="text/javascript">
|
|
3
|
-
RED.nodes.registerType('dialogflow',{
|
|
3
|
+
RED.nodes.registerType('dialogflow',{
|
|
4
4
|
category: 'jambonz',
|
|
5
5
|
color: '#bbabaa',
|
|
6
6
|
defaults: {
|
|
@@ -107,10 +107,8 @@ RED.nodes.registerType('dialogflow',{
|
|
|
107
107
|
recLangElem.val(node.recognizerlang);
|
|
108
108
|
}
|
|
109
109
|
});
|
|
110
|
-
|
|
111
110
|
</script>
|
|
112
111
|
|
|
113
|
-
|
|
114
112
|
<!-- HTML -->
|
|
115
113
|
<script type="text/html" data-template-name="dialogflow">
|
|
116
114
|
<div class="form-row">
|
|
@@ -215,9 +213,7 @@ RED.nodes.registerType('dialogflow',{
|
|
|
215
213
|
</script>
|
|
216
214
|
|
|
217
215
|
<!-- Help Text -->
|
|
218
|
-
|
|
219
|
-
<script type="text/html" data-help-name="audio in">
|
|
220
|
-
<script type="text/html" data-help-name="dialogflow">
|
|
216
|
+
<script type="text/html" data-help-name="dialogflow">
|
|
221
217
|
<p>Run a Google dialogflow bot on the call</p>
|
|
222
218
|
<h3>Properties</h3>
|
|
223
219
|
<p><code>Dialogflow Project ID</code> -
|
|
@@ -236,7 +232,6 @@ RED.nodes.registerType('dialogflow',{
|
|
|
236
232
|
Webhook to call when an intent, transcription or other dialogflow event is received. Optional.</p>
|
|
237
233
|
<p><code>Action Hook</code> -
|
|
238
234
|
Webhook to call when the dialogflow bot interaction concludes. Optional.</p>
|
|
239
|
-
|
|
240
235
|
|
|
241
236
|
<h3>Outputs</h3>
|
|
242
237
|
<dl class="message-properties">
|
|
@@ -250,11 +245,6 @@ RED.nodes.registerType('dialogflow',{
|
|
|
250
245
|
|
|
251
246
|
<h3>References</h3>
|
|
252
247
|
<ul>
|
|
253
|
-
<li><a href="https://
|
|
248
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/dialogflow/">Jambonz dialogflow reference</a></li>
|
|
254
249
|
</ul>
|
|
255
|
-
</script>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
250
|
</script>
|
package/src/nodes/dialogflow.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
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
3
|
module.exports = function(RED) {
|
|
@@ -44,7 +40,6 @@ function dialogflow(config) {
|
|
|
44
40
|
voice: config.voice
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
|
-
|
|
48
43
|
appendVerb(msg, obj);
|
|
49
44
|
node.send(msg);
|
|
50
45
|
});
|