@jambonz/node-red-contrib-jambonz 2.2.73 → 2.3.0
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/examples/Authenticating sip devices.json +1 -0
- package/examples/Conference with LCC.json +1 -0
- package/{src/examples → examples}/Connecting to a dialogflow bot.json +0 -0
- package/examples/Create Call and Send DTMF.json +1 -0
- package/examples/Get Log Data.json +1 -0
- package/examples/Leave Queue.json +1 -0
- package/examples/SIP Responses.json +1 -0
- package/{src/examples → examples}/SIP trunking outbound call.json +0 -0
- package/examples/Simple IVR.json +1 -0
- package/examples/Simple Queue.json +1 -0
- package/examples/Using Redirect.json +1 -0
- package/examples/Voicemail using Listen into S3 bucket.json +130 -0
- package/examples/config.json +1 -0
- package/examples/gather.json +1 -0
- package/examples/lex.json +1 -0
- package/examples/messages.json +1 -0
- package/examples/rasa.json +1 -0
- package/examples/tag a call.json +1 -0
- package/package.json +52 -14
- package/resources/editor.js +414 -0
- package/src/data/recognizer.json +685 -1
- package/src/data/tts.json +2970 -1
- package/src/nodes/auth.html +108 -0
- package/src/nodes/auth.js +43 -0
- package/src/nodes/conference.html +121 -0
- package/src/nodes/conference.js +31 -0
- package/src/nodes/config.html +484 -0
- package/src/nodes/config.js +74 -0
- package/src/nodes/create_call.html +287 -0
- package/src/nodes/create_call.js +104 -0
- package/src/nodes/create_sms.html +106 -0
- package/src/nodes/create_sms.js +65 -0
- package/src/nodes/dequeue.html +102 -0
- package/src/nodes/dequeue.js +25 -0
- package/src/nodes/dial.html +619 -0
- package/src/nodes/dial.js +138 -0
- package/src/nodes/dialogflow.html +260 -0
- package/src/nodes/dialogflow.js +53 -0
- package/src/nodes/dtmf.html +74 -0
- package/src/nodes/dtmf.js +22 -0
- package/src/nodes/enqueue.html +90 -0
- package/src/nodes/enqueue.js +25 -0
- package/src/nodes/gather.html +322 -0
- package/src/nodes/gather.js +83 -0
- package/src/nodes/get_alerts.html +94 -0
- package/src/nodes/get_alerts.js +47 -0
- package/src/nodes/get_calls.html +59 -0
- package/src/nodes/get_calls.js +38 -0
- package/src/nodes/get_recent_calls.html +95 -0
- package/src/nodes/get_recent_calls.js +47 -0
- package/src/nodes/hangup.html +46 -0
- package/src/nodes/hangup.js +20 -0
- package/src/nodes/jambonz.html +63 -38
- package/src/nodes/lcc.html +256 -0
- package/src/nodes/lcc.js +102 -0
- package/src/nodes/leave.html +40 -0
- package/src/nodes/leave.js +21 -0
- package/src/nodes/lex.html +264 -0
- package/src/nodes/lex.js +75 -0
- package/src/nodes/libs.js +99 -0
- package/src/nodes/listen.html +341 -0
- package/src/nodes/listen.js +82 -0
- package/src/nodes/message.html +95 -0
- package/src/nodes/message.js +32 -0
- package/src/nodes/pause.html +62 -0
- package/src/nodes/pause.js +25 -0
- package/src/nodes/play.html +76 -0
- package/src/nodes/play.js +23 -0
- package/src/nodes/rasa.html +106 -0
- package/src/nodes/rasa.js +22 -0
- package/src/nodes/redirect.html +64 -0
- package/src/nodes/redirect.js +24 -0
- package/src/nodes/s3-upload.html +29 -14
- package/src/nodes/s3-upload.js +24 -9
- package/src/nodes/say.html +115 -0
- package/src/nodes/say.js +38 -0
- package/src/nodes/sip-decline.html +76 -0
- package/src/nodes/sip-decline.js +25 -0
- package/src/nodes/sip-refer.html +116 -0
- package/src/nodes/sip-refer.js +33 -0
- package/src/nodes/sip-request.html +96 -0
- package/src/nodes/sip-request.js +36 -0
- package/src/nodes/tag.html +60 -0
- package/src/nodes/tag.js +22 -0
- package/src/nodes/template.html +63 -0
- package/src/nodes/template.js +9 -0
- package/src/nodes/userauth.html +85 -0
- package/src/nodes/userauth.js +70 -0
- package/src/nodes/webhooks.js +0 -16
- package/src/utils/http-helpers.js +68 -0
- package/src/examples/Authenticating sip devices.json +0 -10
- package/src/nodes/http-helpers.js +0 -26
- package/src/nodes/jambonz.js +0 -1044
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<!-- Javascript -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('sip:decline',{
|
|
4
|
+
category: 'jambonz',
|
|
5
|
+
color: '#bbabaa',
|
|
6
|
+
defaults: {
|
|
7
|
+
name: {value: ''},
|
|
8
|
+
status: {},
|
|
9
|
+
statusType: {value: 'num'},
|
|
10
|
+
reason: {value: ''},
|
|
11
|
+
reasonType: {value: 'str'}
|
|
12
|
+
},
|
|
13
|
+
inputs:1,
|
|
14
|
+
outputs:1,
|
|
15
|
+
icon: "font-awesome/fa-cubes",
|
|
16
|
+
label: function() { return this.name || 'sip:decline';},
|
|
17
|
+
oneditprepare: function() {
|
|
18
|
+
$('#node-input-status').typedInput({
|
|
19
|
+
default: $('#node-input-statusType').val(),
|
|
20
|
+
types: ['num','msg', 'flow', 'global'],
|
|
21
|
+
typeField: $('#node-input-statusType')
|
|
22
|
+
});
|
|
23
|
+
$('#node-input-reason').typedInput({
|
|
24
|
+
default: $('#node-input-reasonType').val(),
|
|
25
|
+
types: ['str','msg', 'flow', 'global'],
|
|
26
|
+
typeField: $('#node-input-reasonType')
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
<!-- HTML -->
|
|
36
|
+
<script type="text/html" data-template-name="sip:decline">
|
|
37
|
+
<div class="form-row">
|
|
38
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
39
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
40
|
+
</div>
|
|
41
|
+
<div class="form-row">
|
|
42
|
+
<label for="node-input-status">Status</label>
|
|
43
|
+
<input type="text" id="node-input-status" placeholder="SIP status code">
|
|
44
|
+
<input type="hidden" id="node-input-statusType">
|
|
45
|
+
</div>
|
|
46
|
+
<div class="form-row">
|
|
47
|
+
<label for="node-input-reason">Reason</label>
|
|
48
|
+
<input type="text" id="node-input-reason" placeholder="sip reason">
|
|
49
|
+
<input type="hidden" id="node-input-reasonType">
|
|
50
|
+
</div>
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<!-- Help Text -->
|
|
54
|
+
<script type="text/html" data-help-name="sip:decline">
|
|
55
|
+
<p>Reject an incoming call with a status code and, optionally, reason</p>
|
|
56
|
+
<h3>Inputs</h3>
|
|
57
|
+
<dl class="message-properties">
|
|
58
|
+
<dt>SIP status code<span class="property-type">number</span></dt>
|
|
59
|
+
<dd>A valid SIP status code in the range 4XX - 6XX</dd>
|
|
60
|
+
<dt>Reason<span class="property-type">string</span></dt>
|
|
61
|
+
<dd>A brief description</dd>
|
|
62
|
+
</dl>
|
|
63
|
+
|
|
64
|
+
<h3>Outputs</h3>
|
|
65
|
+
<dl class="message-properties">
|
|
66
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
67
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>sip:decline</code> action appended </dd>
|
|
68
|
+
</dl>
|
|
69
|
+
|
|
70
|
+
<h3>Details</h3>
|
|
71
|
+
The sip:decline verb rejects an incoming call.
|
|
72
|
+
<h3>References</h3>
|
|
73
|
+
<ul>
|
|
74
|
+
<li><a href="https://docs.jambonz.org/jambonz/#sipdecline">Jambonz sip:decline reference</a></li>
|
|
75
|
+
</ul>
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var {createHash} = require('crypto');
|
|
2
|
+
const bent = require('bent');
|
|
3
|
+
var mustache = require('mustache');
|
|
4
|
+
mustache.escape = function(text) {return text;};
|
|
5
|
+
var {appendVerb, v_resolve} = require('./libs')
|
|
6
|
+
|
|
7
|
+
module.exports = function(RED) {
|
|
8
|
+
/** sip:decline */
|
|
9
|
+
function sip_decline(config) {
|
|
10
|
+
RED.nodes.createNode(this, config);
|
|
11
|
+
var node = this;
|
|
12
|
+
node.on('input', function(msg) {
|
|
13
|
+
var status = v_resolve(config.status, config.statusType, this.context(), msg);
|
|
14
|
+
var reason = v_resolve(config.reason, config.reasonType, this.context(), msg);
|
|
15
|
+
appendVerb(msg, {
|
|
16
|
+
verb: 'sip:decline',
|
|
17
|
+
status: parseInt(status),
|
|
18
|
+
reason
|
|
19
|
+
});
|
|
20
|
+
node.send(msg);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
RED.nodes.registerType('sip:decline', sip_decline);
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
<!-- Javascript -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('sip:refer',{
|
|
4
|
+
category: 'jambonz',
|
|
5
|
+
color: '#bbabaa',
|
|
6
|
+
defaults: {
|
|
7
|
+
name: {value: ''},
|
|
8
|
+
referTo: {required: true},
|
|
9
|
+
referToType: {value: 'str'},
|
|
10
|
+
referredBy: {value: ''},
|
|
11
|
+
referredByType: {value: 'str'},
|
|
12
|
+
headers: {value: ''},
|
|
13
|
+
headersType: {value: 'json'},
|
|
14
|
+
eventHook: {value: ''},
|
|
15
|
+
eventHookType: {value: 'str'},
|
|
16
|
+
actionHook: {value: ''},
|
|
17
|
+
actionHookType: {value: 'str'}
|
|
18
|
+
},
|
|
19
|
+
inputs:1,
|
|
20
|
+
outputs:1,
|
|
21
|
+
icon: "font-awesome/fa-cubes",
|
|
22
|
+
label: function() { return this.name || 'sip:refer';},
|
|
23
|
+
oneditprepare: function() {
|
|
24
|
+
|
|
25
|
+
$('#node-input-referTo').typedInput({
|
|
26
|
+
default: $('#node-input-referToType').val(),
|
|
27
|
+
types: ['str','msg', 'flow', 'global'],
|
|
28
|
+
typeField: $('#node-input-referToType')
|
|
29
|
+
});
|
|
30
|
+
$('#node-input-referredBy').typedInput({
|
|
31
|
+
default: $('#node-input-referredByType').val(),
|
|
32
|
+
types: ['str','msg', 'flow', 'global'],
|
|
33
|
+
typeField: $('#node-input-referredByType')
|
|
34
|
+
});
|
|
35
|
+
$('#node-input-actionHook').typedInput({
|
|
36
|
+
default: $('#node-input-actionHookType').val(),
|
|
37
|
+
types: ['str','msg', 'flow', 'global'],
|
|
38
|
+
typeField: $('#node-input-actionHookType')
|
|
39
|
+
});
|
|
40
|
+
$('#node-input-eventHook').typedInput({
|
|
41
|
+
default: $('#node-input-eventHookType').val(),
|
|
42
|
+
types: ['str','msg', 'flow', 'global'],
|
|
43
|
+
typeField: $('#node-input-actionHookType')
|
|
44
|
+
});
|
|
45
|
+
$('#node-input-headers').typedInput({
|
|
46
|
+
default: $('#node-input-headersType').val(),
|
|
47
|
+
types: ['json','msg', 'flow', 'global'],
|
|
48
|
+
typeField: $('#node-input-headersType')
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<!-- HTML -->
|
|
58
|
+
<script type="text/html" data-template-name="sip:refer">
|
|
59
|
+
<div class="form-row">
|
|
60
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
61
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
62
|
+
</div>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<div class="form-row">
|
|
66
|
+
<label for="node-input-referTo">referTo</label>
|
|
67
|
+
<input type="text" id="node-input-referTo" placeholder="address">
|
|
68
|
+
<input type="hidden" id="node-input-referTobody">
|
|
69
|
+
</div>
|
|
70
|
+
<div class="form-row">
|
|
71
|
+
<label for="node-input-referredBy">referredBy</label>
|
|
72
|
+
<input type="text" id="node-input-referredBy" placeholder="address">
|
|
73
|
+
<input type="hidden" id="node-input-referredByType">
|
|
74
|
+
</div>
|
|
75
|
+
<div class="form-row">
|
|
76
|
+
<label for="node-input-actionHook">Action Hook</label>
|
|
77
|
+
<input type="text" id="node-input-actionHook" placeholder="/action">
|
|
78
|
+
<input type="hidden" id="node-input-actionHookType">
|
|
79
|
+
</div>
|
|
80
|
+
<div class="form-row">
|
|
81
|
+
<label for="node-input-eventHook">Event Hook</label>
|
|
82
|
+
<input type="text" id="node-input-eventHook" placeholder="/event">
|
|
83
|
+
<input type="hidden" id="node-input-eventHookType">
|
|
84
|
+
</div>
|
|
85
|
+
<div class="form-row">
|
|
86
|
+
<label for="node-input-headers">Headers</label>
|
|
87
|
+
<input type="text" id="node-input-headers" placeholder="SIP headers">
|
|
88
|
+
<input type="hidden" id="node-input-headersType">
|
|
89
|
+
</div>
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
<!-- Help Text -->
|
|
96
|
+
<script type="text/html" data-help-name="sip:refer">
|
|
97
|
+
<p>The sip:refer action will send a sip REFER to the far end carrier or sip phone</p>
|
|
98
|
+
<h3>Properties</h3>
|
|
99
|
+
<p><code>referTo</code> - a sip uri or a phone number / user identifier </p>
|
|
100
|
+
<p><code>referredBy</code> - a sip uri or a phone number / user identifier; if not provided it will default to the identity of the party being transferred</p>
|
|
101
|
+
<p><code>actionHook</code> - a webhook to call when the transfer has completed </p>
|
|
102
|
+
<p><code>eventHook</code> - a webhook to call when NOTIFY messages of follow-on call status are received </p>
|
|
103
|
+
<p><code>headers</code> - additional SIP headers to include in the response </p>
|
|
104
|
+
|
|
105
|
+
<h3>Outputs</h3>
|
|
106
|
+
<dl class="message-properties">
|
|
107
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
108
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>sip:decline</code> action appended </dd>
|
|
109
|
+
</dl>
|
|
110
|
+
|
|
111
|
+
<h3>Details</h3>
|
|
112
|
+
The sip:refer action is used to blind transfer a call. It will send a sip REFER to the far end carrier or sip phone, which must support the REFER in order for the transfer to work. After the sip:refer completes successfully, the call leg will have left the jambonz platform. <h3>References</h3>
|
|
113
|
+
<ul>
|
|
114
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/sip-refer/">Jambonz sip:refer reference</a></li>
|
|
115
|
+
</ul>
|
|
116
|
+
</script>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var {createHash} = require('crypto');
|
|
2
|
+
var mustache = require('mustache');
|
|
3
|
+
mustache.escape = function(text) {return text;};
|
|
4
|
+
var {appendVerb, } = require('./libs');
|
|
5
|
+
|
|
6
|
+
module.exports = function(RED) {
|
|
7
|
+
function sip_refer(config) {
|
|
8
|
+
RED.nodes.createNode(this, config);
|
|
9
|
+
var node = this;
|
|
10
|
+
node.on('input', function(msg) {
|
|
11
|
+
Object.keys(config).forEach(function(key, index) {
|
|
12
|
+
if (config[key] == ''){
|
|
13
|
+
config[key] = false
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
obj = {
|
|
17
|
+
verb: 'sip:refer',
|
|
18
|
+
referTo: config.referTo
|
|
19
|
+
}
|
|
20
|
+
if (typeof(config.headers == 'string')){
|
|
21
|
+
config.headers=JSON.parse(config.headers)
|
|
22
|
+
}
|
|
23
|
+
config.headers ? obj.headers = config.headers : null
|
|
24
|
+
config.referredBy ? obj.referredBy = config.referredBy : null
|
|
25
|
+
config.actionHook ? obj.actionHook = config.actionHook : null
|
|
26
|
+
config.eventHook ? obj.eventHook = config.eventHook : null
|
|
27
|
+
appendVerb(msg, obj)
|
|
28
|
+
node.send(msg);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
RED.nodes.registerType('sip:refer', sip_refer);
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!-- Javascript -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('sip:request',{
|
|
4
|
+
category: 'jambonz',
|
|
5
|
+
color: '#bbabaa',
|
|
6
|
+
defaults: {
|
|
7
|
+
name: {value: ''},
|
|
8
|
+
method: {required: true},
|
|
9
|
+
headers: {value: ''},
|
|
10
|
+
headersType: {value: 'json'},
|
|
11
|
+
body: {value: ''},
|
|
12
|
+
bodyType: {value: 'str'},
|
|
13
|
+
actionHook: {value: ''},
|
|
14
|
+
actionHookType: {value: 'str'} },
|
|
15
|
+
inputs:1,
|
|
16
|
+
outputs:1,
|
|
17
|
+
icon: "font-awesome/fa-cubes",
|
|
18
|
+
label: function() { return this.name || 'sip:request';},
|
|
19
|
+
oneditprepare: function() {
|
|
20
|
+
$('#node-input-headers').typedInput({
|
|
21
|
+
default: $('#node-input-headersType').val(),
|
|
22
|
+
types: ['json','msg', 'flow', 'global'],
|
|
23
|
+
typeField: $('#node-input-headersType')
|
|
24
|
+
});
|
|
25
|
+
$('#node-input-body').typedInput({
|
|
26
|
+
default: $('#node-input-bodyType').val(),
|
|
27
|
+
types: ['str','msg', 'flow', 'global'],
|
|
28
|
+
typeField: $('#node-input-bodyType')
|
|
29
|
+
});
|
|
30
|
+
$('#node-input-actionHook').typedInput({
|
|
31
|
+
default: $('#node-input-actionHookType').val(),
|
|
32
|
+
types: ['str','msg', 'flow', 'global'],
|
|
33
|
+
typeField: $('#node-input-actionHookType')
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<!-- HTML -->
|
|
43
|
+
<script type="text/html" data-template-name="sip:request">
|
|
44
|
+
<div class="form-row">
|
|
45
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
46
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
47
|
+
</div>
|
|
48
|
+
<div class="form-row">
|
|
49
|
+
<label for="node-input-method">Method</label>
|
|
50
|
+
<select id="node-input-method">
|
|
51
|
+
<option value="INFO" selected>INFO</option>
|
|
52
|
+
<option value="MESSAGE">MESSAGE</option>
|
|
53
|
+
<option value="NOTIFY">NOTIFY</option>
|
|
54
|
+
</select>
|
|
55
|
+
</div>
|
|
56
|
+
<div class="form-row">
|
|
57
|
+
<label for="node-input-headers">Headers</label>
|
|
58
|
+
<input type="text" id="node-input-headers" placeholder="SIP headers">
|
|
59
|
+
<input type="hidden" id="node-input-headersType">
|
|
60
|
+
</div>
|
|
61
|
+
<div class="form-row">
|
|
62
|
+
<label for="node-input-body">SIP Body</label>
|
|
63
|
+
<input type="text" id="node-input-body" placeholder="SIP body">
|
|
64
|
+
<input type="hidden" id="node-input-reasonbody">
|
|
65
|
+
</div>
|
|
66
|
+
<div class="form-row">
|
|
67
|
+
<label for="node-input-actionHook">Action Hook</label>
|
|
68
|
+
<input type="text" id="node-input-actionHook" placeholder="/action">
|
|
69
|
+
<input type="hidden" id="node-input-actionHookType">
|
|
70
|
+
</div>
|
|
71
|
+
</script>
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
<!-- Help Text -->
|
|
77
|
+
<script type="text/html" data-help-name="sip:request">
|
|
78
|
+
<p>send a SIP INFO, NOTIFY, or MESSAGE request on an established call leg</p>
|
|
79
|
+
<h3>Properties</h3>
|
|
80
|
+
<p><code>method</code> - SIP method, should be one of INFO, MESSAGE, or NOTIFY </p>
|
|
81
|
+
<p><code>headers</code> - additional SIP headers to include in the response </p>
|
|
82
|
+
<p><code>body</code> - the body of the SIP request, if any </p>
|
|
83
|
+
<p><code>actionHook</code> - a webhook to call when the sip request has completed </p>
|
|
84
|
+
|
|
85
|
+
<h3>Outputs</h3>
|
|
86
|
+
<dl class="message-properties">
|
|
87
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
88
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>sip:decline</code> action appended </dd>
|
|
89
|
+
</dl>
|
|
90
|
+
|
|
91
|
+
<h3>Details</h3>
|
|
92
|
+
The sip:request verb completes when a response is received from the far end. The actionHook provides the status code of the sip response: <h3>References</h3>
|
|
93
|
+
<ul>
|
|
94
|
+
<li><a href="https://www.jambonz.org/docs/webhooks/sip-request/">Jambonz sip:decline reference</a></li>
|
|
95
|
+
</ul>
|
|
96
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var {createHash} = require('crypto');
|
|
2
|
+
const bent = require('bent');
|
|
3
|
+
var mustache = require('mustache');
|
|
4
|
+
mustache.escape = function(text) {return text;};
|
|
5
|
+
var {appendVerb, v_resolve} = require('./libs');
|
|
6
|
+
const { type } = require('os');
|
|
7
|
+
const { ConfigurationOptions } = require('aws-sdk');
|
|
8
|
+
|
|
9
|
+
module.exports = function(RED) {
|
|
10
|
+
/** sip:decline */
|
|
11
|
+
function sip_request(config) {
|
|
12
|
+
RED.nodes.createNode(this, config);
|
|
13
|
+
var node = this;
|
|
14
|
+
node.on('input', function(msg) {
|
|
15
|
+
obj = {
|
|
16
|
+
verb: 'sip:request',
|
|
17
|
+
method: config.method
|
|
18
|
+
}
|
|
19
|
+
Object.keys(config).forEach(function(key, index) {
|
|
20
|
+
if (config[key] == ''){
|
|
21
|
+
config[key] = false
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
if (typeof(config.headers == 'string')){
|
|
25
|
+
config.headers=JSON.parse(config.headers)
|
|
26
|
+
}
|
|
27
|
+
config.headers ? obj.headers = config.headers : null
|
|
28
|
+
config.body ? obj.body = config.body : null
|
|
29
|
+
config.actionHook ? obj.actionHook = config.actionHook : null
|
|
30
|
+
appendVerb(msg, obj)
|
|
31
|
+
node.send(msg);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
RED.nodes.registerType('sip:request', sip_request);
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Javascript -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('tag',{
|
|
4
|
+
category: 'jambonz',
|
|
5
|
+
color: '#bbabaa',
|
|
6
|
+
defaults: {
|
|
7
|
+
name: {value: ''},
|
|
8
|
+
data: {required: true},
|
|
9
|
+
dataType: {value: 'json'}
|
|
10
|
+
},
|
|
11
|
+
inputs:1,
|
|
12
|
+
outputs:1,
|
|
13
|
+
icon: "font-awesome/fa-cubes",
|
|
14
|
+
label: function() { return this.name || 'tag';},
|
|
15
|
+
oneditprepare: function() {
|
|
16
|
+
$('#node-input-data').typedInput({
|
|
17
|
+
default: $('#node-input-dataType').val(),
|
|
18
|
+
types: ['json', 'msg', 'flow', 'global'],
|
|
19
|
+
typeField: $('#node-input-dataType')
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
<!-- HTML -->
|
|
27
|
+
|
|
28
|
+
<script type="text/html" data-template-name="tag">
|
|
29
|
+
<div class="form-row">
|
|
30
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
31
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
32
|
+
</div>
|
|
33
|
+
<div class="form-row">
|
|
34
|
+
<label for="node-input-length">Data</label>
|
|
35
|
+
<input type="text" id="node-input-data" placeholder="data object">
|
|
36
|
+
<input type="hidden" id="node-input-dataType">
|
|
37
|
+
</div>
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<!-- Help Text -->
|
|
41
|
+
<script type="text/html" data-help-name="tag">
|
|
42
|
+
<p>Add additional metadata to a call</p>
|
|
43
|
+
<h3>Inputs</h3>
|
|
44
|
+
<dl class="message-properties">
|
|
45
|
+
<dt>Data<span class="property-type">json</span></dt>
|
|
46
|
+
<dd>A JSON object containing values to be saved and included in future action or call status notifications.</dd>
|
|
47
|
+
</dl>
|
|
48
|
+
|
|
49
|
+
<h3>Outputs</h3>
|
|
50
|
+
<dl class="message-properties">
|
|
51
|
+
<dt>jambonz<span class="property-type">object</span></dt>
|
|
52
|
+
<dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>tag</code> action appended </dd>
|
|
53
|
+
</dl>
|
|
54
|
+
|
|
55
|
+
<h3>Details</h3>
|
|
56
|
+
The tag verb is used to add properties to the standard call attributes that jambonz includes on every action or call status HTTP POST request.<h3>References</h3>
|
|
57
|
+
<ul>
|
|
58
|
+
<li><a href="https://docs.jambonz.org/jambonz/#tag">Jambonz tag reference</a></li>
|
|
59
|
+
</ul>
|
|
60
|
+
</script>
|
package/src/nodes/tag.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
var {createHash} = require('crypto');
|
|
2
|
+
const bent = require('bent');
|
|
3
|
+
var mustache = require('mustache');
|
|
4
|
+
mustache.escape = function(text) {return text;};
|
|
5
|
+
var {appendVerb, v_resolve} = require('./libs')
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
module.exports = function(RED) {
|
|
9
|
+
function tag(config) {
|
|
10
|
+
RED.nodes.createNode(this, config);
|
|
11
|
+
var node = this;
|
|
12
|
+
node.on('input', function(msg) {
|
|
13
|
+
var data = v_resolve(config.data, config.dataType, this.context(), msg, true);
|
|
14
|
+
appendVerb(msg, {
|
|
15
|
+
verb: 'tag',
|
|
16
|
+
data
|
|
17
|
+
});
|
|
18
|
+
node.send(msg);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
RED.nodes.registerType('tag', tag);
|
|
22
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!-- Javascript -->
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<script type="text/javascript">
|
|
5
|
+
RED.nodes.registerType('NAME',{
|
|
6
|
+
category: 'jambonz',
|
|
7
|
+
color: '#bbabaa',
|
|
8
|
+
defaults: {
|
|
9
|
+
name: {value: ''},
|
|
10
|
+
XXXX:{},
|
|
11
|
+
XXXXType:{value: 'str'}
|
|
12
|
+
},
|
|
13
|
+
inputs:1,
|
|
14
|
+
outputs:1,
|
|
15
|
+
icon: "font-awesome/fa-cubes",
|
|
16
|
+
paletteLabel: "NAME",
|
|
17
|
+
label: function() { return this.name || 'NAME';},
|
|
18
|
+
oneditprepare: () => {
|
|
19
|
+
var node = this;
|
|
20
|
+
$('#node-input-XXXX').typedInput({
|
|
21
|
+
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
22
|
+
typeField: $('#node-input-XXXXType')
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
<!-- HTML -->
|
|
32
|
+
|
|
33
|
+
<script type="text/html" data-template-name="NAME">
|
|
34
|
+
<script type="text/html" data-template-name="listen">
|
|
35
|
+
<div class="form-row">
|
|
36
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
37
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<!-- Help Text -->
|
|
43
|
+
|
|
44
|
+
<script type="text/html" data-help-name="NAME">
|
|
45
|
+
<script type="text/html" data-help-name="NAME">
|
|
46
|
+
<p>DESCRIPTION</p>
|
|
47
|
+
<h3>Properties</h3>
|
|
48
|
+
<p><code>XXXX</code> - TEXT</p>
|
|
49
|
+
|
|
50
|
+
<h3>Outputs</h3>
|
|
51
|
+
<dl class="message-properties">
|
|
52
|
+
<dt>payload<span class="property-type">object</span></dt>
|
|
53
|
+
<dd> <code>msg.payload</code> will contain ... </dd>
|
|
54
|
+
</dl>
|
|
55
|
+
|
|
56
|
+
<h3>Details</h3>
|
|
57
|
+
The listen verb establishes a connection to a websocket server and sends live audio for the current call.<h3>References</h3>
|
|
58
|
+
<ul>
|
|
59
|
+
<li><a href="https://docs.jambonz.org/jambonz/#listen">Jambonz listen reference</a></li>
|
|
60
|
+
</ul>
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var {createHash} = require('crypto');
|
|
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')
|
|
6
|
+
|
|
7
|
+
module.exports = function(RED) {
|
|
8
|
+
|
|
9
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!-- Javascript -->
|
|
2
|
+
<script type="text/javascript">
|
|
3
|
+
RED.nodes.registerType('user auth',{
|
|
4
|
+
category: 'jambonz',
|
|
5
|
+
color:"#c1f986",
|
|
6
|
+
defaults: {
|
|
7
|
+
name: {value: ''},
|
|
8
|
+
password: {},
|
|
9
|
+
passwordType: {},
|
|
10
|
+
ha1: {},
|
|
11
|
+
ha1Type: {}
|
|
12
|
+
},
|
|
13
|
+
inputs:1,
|
|
14
|
+
outputs:1,
|
|
15
|
+
icon: "font-awesome/fa-id-badge",
|
|
16
|
+
label: function() { return this.name || 'user auth';},
|
|
17
|
+
oneditprepare: function() {
|
|
18
|
+
$('#node-input-password').typedInput({
|
|
19
|
+
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
20
|
+
typeField: $('#node-input-passwordType')
|
|
21
|
+
});
|
|
22
|
+
$('#node-input-ha1').typedInput({
|
|
23
|
+
types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
|
|
24
|
+
typeField: $('#node-input-ha1Type')
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<!-- HTML -->
|
|
33
|
+
<!-- user auth -->
|
|
34
|
+
<script type="text/html" data-template-name="user auth">
|
|
35
|
+
<div class="form-row">
|
|
36
|
+
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
|
|
37
|
+
<input type="text" id="node-input-name" placeholder="Name">
|
|
38
|
+
</div>
|
|
39
|
+
<fieldset>
|
|
40
|
+
<legend>Enter either a plain-text or hashed password</legend>
|
|
41
|
+
<div class="form-row">
|
|
42
|
+
<label for="node-input-password">Plain text password</label>
|
|
43
|
+
<input type="text" id="node-input-password">
|
|
44
|
+
<input type="hidden" id="node-input-passwordType">
|
|
45
|
+
</div>
|
|
46
|
+
<div class="form-row">
|
|
47
|
+
<label for="node-input-ha1">Hashed</label>
|
|
48
|
+
<input type="text" id="node-input-ha1">
|
|
49
|
+
<input type="hidden" id="node-input-ha1Type">
|
|
50
|
+
</div>
|
|
51
|
+
</fieldset>
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
<!-- Help Text -->
|
|
59
|
+
<!-- User Text -->
|
|
60
|
+
<script type="text/html" data-help-name="user auth">
|
|
61
|
+
<p>Authenticate a user</p>
|
|
62
|
+
<h3>Inputs</h3>
|
|
63
|
+
<dl class="message-properties">
|
|
64
|
+
<dt>authRequest<span class="property-type">object</span></dt>
|
|
65
|
+
<dd>The digest parameters provided by the user</dd>
|
|
66
|
+
</dl>
|
|
67
|
+
|
|
68
|
+
<h3>Outputs</h3>
|
|
69
|
+
<dl class="message-properties">
|
|
70
|
+
<dt>authResponse<span class="property-type">object</span></dt>
|
|
71
|
+
<dd>An object containing a status property indicating whether the password provided has successfully authenticated the user</dd>
|
|
72
|
+
</dl>
|
|
73
|
+
|
|
74
|
+
<h3>Details</h3>
|
|
75
|
+
The user auth command is used to authenticate a user based on the sip digest they presented and a password retrieved by some means by the application.
|
|
76
|
+
You may provide either a plaintext password, or a precomputed hash based on <a href="https://tools.ietf.org/html/rfc2617">RFC 2617</a>, i.e. MD5( username ":" realm ":" password ).<br/><br/>
|
|
77
|
+
It is valid to provide neither the plaintext nor hashed password, and in this case the user authentication will fail.
|
|
78
|
+
It is useful to do this, for instance, when either the presented domain or username are unrecognized.<br/><br/>
|
|
79
|
+
The output of this node is to set <code>msg.authResponse</code> accordingly, and the <code>webhook out</code> node should then be used to send the result back to the jambonz server.
|
|
80
|
+
<h3>References</h3>
|
|
81
|
+
<ul>
|
|
82
|
+
<li><a href="https://docs.jambonz.org/register-hook">Jambonz user authentication reference</a></li>
|
|
83
|
+
</ul>
|
|
84
|
+
</script>
|
|
85
|
+
|