@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.
Files changed (93) hide show
  1. package/examples/Authenticating sip devices.json +1 -0
  2. package/examples/Conference with LCC.json +1 -0
  3. package/{src/examples → examples}/Connecting to a dialogflow bot.json +0 -0
  4. package/examples/Create Call and Send DTMF.json +1 -0
  5. package/examples/Get Log Data.json +1 -0
  6. package/examples/Leave Queue.json +1 -0
  7. package/examples/SIP Responses.json +1 -0
  8. package/{src/examples → examples}/SIP trunking outbound call.json +0 -0
  9. package/examples/Simple IVR.json +1 -0
  10. package/examples/Simple Queue.json +1 -0
  11. package/examples/Using Redirect.json +1 -0
  12. package/examples/Voicemail using Listen into S3 bucket.json +130 -0
  13. package/examples/config.json +1 -0
  14. package/examples/gather.json +1 -0
  15. package/examples/lex.json +1 -0
  16. package/examples/messages.json +1 -0
  17. package/examples/rasa.json +1 -0
  18. package/examples/tag a call.json +1 -0
  19. package/package.json +52 -14
  20. package/resources/editor.js +414 -0
  21. package/src/data/recognizer.json +685 -1
  22. package/src/data/tts.json +2970 -1
  23. package/src/nodes/auth.html +108 -0
  24. package/src/nodes/auth.js +43 -0
  25. package/src/nodes/conference.html +121 -0
  26. package/src/nodes/conference.js +31 -0
  27. package/src/nodes/config.html +484 -0
  28. package/src/nodes/config.js +74 -0
  29. package/src/nodes/create_call.html +287 -0
  30. package/src/nodes/create_call.js +104 -0
  31. package/src/nodes/create_sms.html +106 -0
  32. package/src/nodes/create_sms.js +65 -0
  33. package/src/nodes/dequeue.html +102 -0
  34. package/src/nodes/dequeue.js +25 -0
  35. package/src/nodes/dial.html +619 -0
  36. package/src/nodes/dial.js +138 -0
  37. package/src/nodes/dialogflow.html +260 -0
  38. package/src/nodes/dialogflow.js +53 -0
  39. package/src/nodes/dtmf.html +74 -0
  40. package/src/nodes/dtmf.js +22 -0
  41. package/src/nodes/enqueue.html +90 -0
  42. package/src/nodes/enqueue.js +25 -0
  43. package/src/nodes/gather.html +322 -0
  44. package/src/nodes/gather.js +83 -0
  45. package/src/nodes/get_alerts.html +94 -0
  46. package/src/nodes/get_alerts.js +47 -0
  47. package/src/nodes/get_calls.html +59 -0
  48. package/src/nodes/get_calls.js +38 -0
  49. package/src/nodes/get_recent_calls.html +95 -0
  50. package/src/nodes/get_recent_calls.js +47 -0
  51. package/src/nodes/hangup.html +46 -0
  52. package/src/nodes/hangup.js +20 -0
  53. package/src/nodes/jambonz.html +63 -38
  54. package/src/nodes/lcc.html +256 -0
  55. package/src/nodes/lcc.js +102 -0
  56. package/src/nodes/leave.html +40 -0
  57. package/src/nodes/leave.js +21 -0
  58. package/src/nodes/lex.html +264 -0
  59. package/src/nodes/lex.js +75 -0
  60. package/src/nodes/libs.js +99 -0
  61. package/src/nodes/listen.html +341 -0
  62. package/src/nodes/listen.js +82 -0
  63. package/src/nodes/message.html +95 -0
  64. package/src/nodes/message.js +32 -0
  65. package/src/nodes/pause.html +62 -0
  66. package/src/nodes/pause.js +25 -0
  67. package/src/nodes/play.html +76 -0
  68. package/src/nodes/play.js +23 -0
  69. package/src/nodes/rasa.html +106 -0
  70. package/src/nodes/rasa.js +22 -0
  71. package/src/nodes/redirect.html +64 -0
  72. package/src/nodes/redirect.js +24 -0
  73. package/src/nodes/s3-upload.html +29 -14
  74. package/src/nodes/s3-upload.js +24 -9
  75. package/src/nodes/say.html +115 -0
  76. package/src/nodes/say.js +38 -0
  77. package/src/nodes/sip-decline.html +76 -0
  78. package/src/nodes/sip-decline.js +25 -0
  79. package/src/nodes/sip-refer.html +116 -0
  80. package/src/nodes/sip-refer.js +33 -0
  81. package/src/nodes/sip-request.html +96 -0
  82. package/src/nodes/sip-request.js +36 -0
  83. package/src/nodes/tag.html +60 -0
  84. package/src/nodes/tag.js +22 -0
  85. package/src/nodes/template.html +63 -0
  86. package/src/nodes/template.js +9 -0
  87. package/src/nodes/userauth.html +85 -0
  88. package/src/nodes/userauth.js +70 -0
  89. package/src/nodes/webhooks.js +0 -16
  90. package/src/utils/http-helpers.js +68 -0
  91. package/src/examples/Authenticating sip devices.json +0 -10
  92. package/src/nodes/http-helpers.js +0 -26
  93. package/src/nodes/jambonz.js +0 -1044
@@ -0,0 +1,108 @@
1
+ <!-- Javascript -->
2
+ <script type="text/javascript">
3
+
4
+ RED.nodes.registerType('jambonz_auth',{
5
+ category: 'config',
6
+ defaults: {
7
+ name: {},
8
+ urlType: {},
9
+ url: {type: 'text'}
10
+ },
11
+ credentials: {
12
+ accountSid: {type: 'text'},
13
+ apiToken: {type: 'text'}
14
+ },
15
+ label: function() { return this.name || 'auth';},
16
+ oneditprepare: function() {
17
+ $('#btn-test-credentials').on('click', testCredentials);
18
+ $('#node-config-input-url').typedInput({
19
+ types: ['str',
20
+ {value: 'https://api.jambonz.us', label : 'jambonz.us', hasValue: false},
21
+ {value: 'https://api.jambonz.xyz', label : 'jambonz.xyz', hasValue: false}],
22
+ typeField: $('#node-config-input-urlType')
23
+ });
24
+ }
25
+ });
26
+
27
+
28
+
29
+
30
+ RED.nodes.registerType('aws_auth',{
31
+ category: 'config',
32
+ credentials: {
33
+ accessKey: {type: 'text'},
34
+ secretAccessKey: {type: 'text'}
35
+ },
36
+ label: function() {
37
+ if (!this.credentials) return null;
38
+ const akey = this.credentials.accessKey;
39
+ let mask = '';
40
+ for (let i = 4; i < akey.length; i++) mask += '*';
41
+ return akey.substr(0, 4) + mask;
42
+ }
43
+ });
44
+ </script>
45
+
46
+
47
+ <!-- HTML -->
48
+
49
+
50
+
51
+ <!-- aws auth -->
52
+ <script type="text/html" data-template-name="aws_auth">
53
+ <div class="form-row">
54
+ <label for="node-config-input-accessKey">AWS Access Key ID</label>
55
+ <input type="text" id="node-config-input-accessKey">
56
+ </div>
57
+ <div class="form-row">
58
+ <label for="node-config-input-secretAccessKey">AWS Secret Access Key</label>
59
+ <input type="text" id="node-config-input-secretAccessKey">
60
+ </div>
61
+ </script>
62
+
63
+
64
+
65
+ <!-- jambonz auth -->
66
+ <script type="text/html" data-template-name="jambonz_auth">
67
+ <div class="form-row">
68
+ <label for="node-config-input-name"><i class="icon-tag"></i> Name</label>
69
+ <input type="text" id="node-config-input-name" placeholder="Name">
70
+ </div>
71
+ <div class="form-row">
72
+ <label for="node-config-input-url">Base URL</label>
73
+ <input type="text" id="node-config-input-url" placeholder="http://localhost:3000">
74
+ <input type="hidden" id="node-config-input-urlType">
75
+
76
+ </div>
77
+ <div class="form-row">
78
+ <label for="node-config-input-accountSid">AccountSid</label>
79
+ <input type="text" id="node-config-input-accountSid">
80
+ </div>
81
+ <div class="form-row">
82
+ <label for="node-config-input-apiToken">API token</label>
83
+ <input type="text" id="node-config-input-apiToken">
84
+ </div>
85
+ <div class="form-row">
86
+ <button id="btn-test-credentials"><i class="fa fa-lock"></i> Test Credentials</button>
87
+ <span id="node-config-test-status" style="margin-left: 20px;"></span>
88
+ </div>
89
+ </script>
90
+
91
+
92
+
93
+ <!-- Help Text -->
94
+
95
+ <!-- AWS auth-->
96
+ <script type="text/x-red" data-help-name="aws_auth">
97
+ <p>AWS access key and secret access key to use for Lex</p>
98
+ <h3>Properties</h3>
99
+ <p>Enter the AWS access key and secret access key</p>
100
+ </script>
101
+
102
+ <!-- jambonz auth -->
103
+
104
+ <script type="text/x-red" data-help-name="jambonz_auth">
105
+ <p>Creates a new jambonz server credential </p>
106
+ <h3>Properties</h3>
107
+ <p>Enter the base url of the server, along with your API key</p>
108
+ </script>
@@ -0,0 +1,43 @@
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
+ module.exports = function(RED) {
8
+
9
+ function jambonz_auth(config) {
10
+ RED.nodes.createNode(this, config);
11
+ this.accountSid = config.accountSid;
12
+ this.apiKey = config.apiKey;
13
+ this.name = config.name;
14
+ this.urlType = config.urlType
15
+ if (this.urlType == 'str'){
16
+ this.url = config.url;
17
+ } else {
18
+ this.url = config.urlType;
19
+ }
20
+ }
21
+ RED.nodes.registerType('jambonz_auth', jambonz_auth, {
22
+ credentials: {
23
+ url: {type: 'text'},
24
+ urlType: {},
25
+ accountSid: {type: 'text'},
26
+ apiToken: {type: 'text'}
27
+ }
28
+ });
29
+
30
+ function aws_auth(config) {
31
+ RED.nodes.createNode(this, config);
32
+ this.accessKey = config.accessKey;
33
+ this.secretAccessKey = config.secretAccessKey;
34
+ }
35
+
36
+ RED.nodes.registerType('aws_auth', aws_auth, {
37
+ credentials: {
38
+ accessKey: {type: 'text'},
39
+ secretAccessKey: {type: 'text'}
40
+ }
41
+ });
42
+
43
+ }
@@ -0,0 +1,121 @@
1
+ <!-- Javascript -->
2
+ <script type="text/javascript">
3
+ RED.nodes.registerType('conference',{
4
+ category: 'jambonz',
5
+ color: '#bbabaa',
6
+ defaults: {
7
+ name: {value: ''},
8
+ conference: {required: true, value: ''},
9
+ conferenceType: {value: 'str'},
10
+ beep: {value: false},
11
+ endConferenceOnExit: {value: false},
12
+ startConferenceOnEnter: {value: false},
13
+ maxParticipants: {},
14
+ maxParticipantsType: {value: 'num'},
15
+ enterHook: {},
16
+ enterHookType: {value: 'str'},
17
+ waitHook: {},
18
+ waitHookType: {value: 'str'},
19
+ joinMuted : {value: false}
20
+ },
21
+ inputs:1,
22
+ outputs:1,
23
+ icon: "font-awesome/fa-cubes",
24
+ label: function() {
25
+ return this.name || 'conference';
26
+ },
27
+ oneditprepare: function() {
28
+ $('#node-input-conference').typedInput({
29
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
30
+ typeField: $('#node-input-conferenceType')
31
+ });
32
+ $('#node-input-enterHook').typedInput({
33
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
34
+ typeField: $('#node-input-enterHookType')
35
+ });
36
+ $('#node-input-waitHook').typedInput({
37
+ types: ['str', 'msg', 'flow', 'global', 'jsonata', 'env'],
38
+ typeField: $('#node-input-waitHookType')
39
+ });
40
+ $('#node-input-maxParticipants').typedInput({
41
+ types: ['num', 'msg', 'flow', 'global', 'jsonata', 'env'],
42
+ typeField: $('#node-input-maxParticipantsType')
43
+ });
44
+ }
45
+ });
46
+
47
+ </script>
48
+
49
+
50
+ <!-- HTML -->
51
+ <script type="text/html" data-template-name="conference">
52
+ <div class="form-row">
53
+ <label for="node-input-name"><i class="icon-tag"></i> Name</label>
54
+ <input type="text" id="node-input-name" placeholder="Name">
55
+ </div>
56
+ <div class="form-row">
57
+ <label for="node-input-conference">Conference name</label>
58
+ <input type="text" id="node-input-conference" placeholder="conference to join">
59
+ <input type="hidden" id="node-input-conferenceType">
60
+ </div>
61
+ <div class="form-row">
62
+ <label for="node-input-enterHook">Enter hook</label>
63
+ <input type="text" id="node-input-enterHook" placeholder="webhook url">
64
+ <input type="hidden" id="node-input-enterHookType">
65
+ </div>
66
+ <div class="form-row">
67
+ <label for="node-input-waitHook">Wait hook</label>
68
+ <input type="text" id="node-input-waitHook" placeholder="webhook url">
69
+ <input type="hidden" id="node-input-waitHookType">
70
+ </div>
71
+ <div class="form-row">
72
+ <label for="node-input-beep">Beep on entry</label>
73
+ <input type="checkbox" id="node-input-beep">
74
+ </div>
75
+ <div class="form-row">
76
+ <label for="node-input-startConferenceOnEnter">Start on entry</label>
77
+ <input type="checkbox" id="node-input-startConferenceOnEnter">
78
+ </div>
79
+ <div class="form-row">
80
+ <label for="node-input-endConferenceOnExit">End on exit</label>
81
+ <input type="checkbox" id="node-input-endConferenceOnExit">
82
+ </div>
83
+ <div class="form-row">
84
+ <label for="node-input-joinMuted">Join Muted</label>
85
+ <input type="checkbox" id="node-input-joinMuted">
86
+ </div>
87
+ <div class="form-row">
88
+ <label for="node-input-maxParticipants">Max participants</label>
89
+ <input type="text" id="node-input-maxParticipants">
90
+ <input type="hidden" id="node-input-maxParticipantsType">
91
+ </div>
92
+ </script>
93
+
94
+ <!-- Help Text -->
95
+ <script type="text/html" data-help-name="conference">
96
+ <p>places a caller in a conference.</p>
97
+ <h3>Properties</h3>
98
+ <p><code>Conference Name </code> - The name of the conference to join the caller to.</p>
99
+ <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>
100
+ <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>
101
+ <p><code>Beep on entry</code> - if checked, play a beep tone to the conference when caller enters </p>
102
+ <p><code>Start on entry</code> - if checked, start the conference only when this caller enters</p>
103
+ <p><code>End on exit</code> - if checked, end the conference when this caller hangs up</p>
104
+ <p><code>Max participants</code> - maximum number of participants that will be allowed in the conference</p>
105
+
106
+ <h3>Outputs</h3>
107
+ <dl class="message-properties">
108
+ <dt>jambonz<span class="property-type">object</span></dt>
109
+ <dd> <code>msg.jambonz</code> will contain any previous actions provided to the input with the new <code>conference</code> action appended </dd>
110
+ </dl>
111
+
112
+ <h3>Details</h3>
113
+ The conference verb places a call into a conference.
114
+ <h3>References</h3>
115
+ <ul>
116
+ <li><a href="https://docs.jambonz.org/jambonz/#conference">Jambonz conference reference</a></li>
117
+ </ul>
118
+ </script>
119
+
120
+
121
+
@@ -0,0 +1,31 @@
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
+ /** conference */
9
+ function conference(config) {
10
+ RED.nodes.createNode(this, config);
11
+ var node = this;
12
+ node.on('input', function(msg) {
13
+ var val = v_resolve(config.maxParticipants, config.maxParticipantsType, this.context(), msg);
14
+ var maxParticipants = /^\d+$/.test(val) ? parseInt(val) : val;
15
+
16
+ appendVerb(msg, {
17
+ verb: 'conference',
18
+ name: v_resolve(config.conference, config.conferenceType, this.context(), msg),
19
+ enterHook: v_resolve(config.enterHook, config.enterHookType, this.context(), msg),
20
+ waitHook: v_resolve(config.waitHook, config.waitHookType, this.context(), msg),
21
+ maxParticipants,
22
+ beep: config.beep,
23
+ startConferenceOnEnter: config.startConferenceOnEnter,
24
+ endOnExit: config.endOnExit,
25
+ joinMuted : config.joinMuted
26
+ });
27
+ node.send(msg);
28
+ });
29
+ }
30
+ RED.nodes.registerType('conference', conference);
31
+ }