@telegenta/webclient 2.0.12 → 3.0.1

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 (105) hide show
  1. package/README.md +102 -81
  2. package/demos/add_phone_number.html +8 -7
  3. package/demos/calldata_available.html +5 -5
  4. package/demos/embedded_config.html +3 -3
  5. package/demos/event_client.html +226 -211
  6. package/demos/phone_client.html +540 -514
  7. package/demos/styles.css +0 -0
  8. package/dist/telegenta.js +3663 -0
  9. package/dist/telegenta.min.js +1 -0
  10. package/docs/EventClient.html +3 -1093
  11. package/docs/EventServiceNotConnected.html +3 -0
  12. package/docs/InvalidMediaDevice.html +3 -0
  13. package/docs/InvalidOptions.html +3 -0
  14. package/docs/InvalidParameter.html +3 -0
  15. package/docs/LogHandler.html +7 -0
  16. package/docs/MediaNotPrepared.html +3 -0
  17. package/docs/NoActiveSession.html +3 -0
  18. package/docs/NotAllowed.html +3 -0
  19. package/docs/NotReady.html +3 -0
  20. package/docs/Phone.html +4 -2837
  21. package/docs/Request.html +3 -0
  22. package/docs/Requestor.html +3 -0
  23. package/docs/Session.html +3 -2599
  24. package/docs/UnableToConnect.html +3 -0
  25. package/docs/data/search.json +1 -0
  26. package/docs/event-client.js.html +352 -0
  27. package/docs/exceptions.js.html +104 -0
  28. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  29. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  30. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  31. package/docs/global.html +5 -4950
  32. package/docs/index.html +3 -66
  33. package/docs/logger.js.html +106 -0
  34. package/docs/phone-client.js.html +2175 -0
  35. package/docs/requestor.js.html +223 -0
  36. package/docs/scripts/core.js +726 -0
  37. package/docs/scripts/core.min.js +23 -0
  38. package/docs/scripts/resize.js +90 -0
  39. package/docs/scripts/search.js +265 -0
  40. package/docs/scripts/search.min.js +6 -0
  41. package/docs/scripts/{prettify → third-party}/Apache-License-2.0.txt +202 -202
  42. package/docs/scripts/third-party/fuse.js +9 -0
  43. package/docs/scripts/third-party/hljs-line-num-original.js +369 -0
  44. package/docs/scripts/third-party/hljs-line-num.js +1 -0
  45. package/docs/scripts/third-party/hljs-original.js +5171 -0
  46. package/docs/scripts/third-party/hljs.js +1 -0
  47. package/docs/scripts/third-party/popper.js +5 -0
  48. package/docs/scripts/third-party/tippy.js +1 -0
  49. package/docs/scripts/third-party/tocbot.js +672 -0
  50. package/docs/scripts/third-party/tocbot.min.js +1 -0
  51. package/docs/styles/clean-jsdoc-theme-base.css +1159 -0
  52. package/docs/styles/clean-jsdoc-theme-dark.css +412 -0
  53. package/docs/styles/clean-jsdoc-theme-light.css +482 -0
  54. package/docs/styles/clean-jsdoc-theme-scrollbar.css +30 -0
  55. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +1 -0
  56. package/docs/styles/clean-jsdoc-theme.min.css +1 -0
  57. package/package.json +38 -26
  58. package/babel.config.js +0 -16
  59. package/browser/telegenta.min.js +0 -1
  60. package/demos/telegenta.min.js +0 -1
  61. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  62. package/docs/fonts/OpenSans-Bold-webfont.svg +0 -1830
  63. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  64. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  65. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
  66. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  67. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  68. package/docs/fonts/OpenSans-Italic-webfont.svg +0 -1830
  69. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  70. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  71. package/docs/fonts/OpenSans-Light-webfont.svg +0 -1831
  72. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  73. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  74. package/docs/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
  75. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  76. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  77. package/docs/fonts/OpenSans-Regular-webfont.svg +0 -1831
  78. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  79. package/docs/fonts/OpenSans-Semibold-webfont.eot +0 -0
  80. package/docs/fonts/OpenSans-Semibold-webfont.svg +0 -1830
  81. package/docs/fonts/OpenSans-Semibold-webfont.ttf +0 -0
  82. package/docs/fonts/OpenSans-Semibold-webfont.woff +0 -0
  83. package/docs/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
  84. package/docs/fonts/OpenSans-SemiboldItalic-webfont.svg +0 -1830
  85. package/docs/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
  86. package/docs/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
  87. package/docs/scripts/linenumber.js +0 -25
  88. package/docs/scripts/prettify/lang-css.js +0 -2
  89. package/docs/scripts/prettify/prettify.js +0 -28
  90. package/docs/styles/jsdoc-default.css +0 -692
  91. package/docs/styles/prettify-jsdoc.css +0 -111
  92. package/docs/styles/prettify-tomorrow.css +0 -132
  93. package/embedded_client/embedded_phone.js +0 -325
  94. package/embedded_client/index.html +0 -201
  95. package/embedded_client/server.php +0 -28
  96. package/embedded_client/styles.css +0 -310
  97. package/embedded_client/tiny_rest_client.php +0 -73
  98. package/embedded_client/webphone_sprites.png +0 -0
  99. package/es5/event-client.js +0 -277
  100. package/es5/index.js +0 -44
  101. package/es5/phone-client.js +0 -1336
  102. package/src/event-client.js +0 -1
  103. package/src/index.js +0 -10
  104. package/src/phone-client.js +0 -1
  105. package/webpack.config.js +0 -39
@@ -1,111 +0,0 @@
1
- /* JSDoc prettify.js theme */
2
-
3
- /* plain text */
4
- .pln {
5
- color: #000000;
6
- font-weight: normal;
7
- font-style: normal;
8
- }
9
-
10
- /* string content */
11
- .str {
12
- color: hsl(104, 100%, 24%);
13
- font-weight: normal;
14
- font-style: normal;
15
- }
16
-
17
- /* a keyword */
18
- .kwd {
19
- color: #000000;
20
- font-weight: bold;
21
- font-style: normal;
22
- }
23
-
24
- /* a comment */
25
- .com {
26
- font-weight: normal;
27
- font-style: italic;
28
- }
29
-
30
- /* a type name */
31
- .typ {
32
- color: #000000;
33
- font-weight: normal;
34
- font-style: normal;
35
- }
36
-
37
- /* a literal value */
38
- .lit {
39
- color: #006400;
40
- font-weight: normal;
41
- font-style: normal;
42
- }
43
-
44
- /* punctuation */
45
- .pun {
46
- color: #000000;
47
- font-weight: bold;
48
- font-style: normal;
49
- }
50
-
51
- /* lisp open bracket */
52
- .opn {
53
- color: #000000;
54
- font-weight: bold;
55
- font-style: normal;
56
- }
57
-
58
- /* lisp close bracket */
59
- .clo {
60
- color: #000000;
61
- font-weight: bold;
62
- font-style: normal;
63
- }
64
-
65
- /* a markup tag name */
66
- .tag {
67
- color: #006400;
68
- font-weight: normal;
69
- font-style: normal;
70
- }
71
-
72
- /* a markup attribute name */
73
- .atn {
74
- color: #006400;
75
- font-weight: normal;
76
- font-style: normal;
77
- }
78
-
79
- /* a markup attribute value */
80
- .atv {
81
- color: #006400;
82
- font-weight: normal;
83
- font-style: normal;
84
- }
85
-
86
- /* a declaration */
87
- .dec {
88
- color: #000000;
89
- font-weight: bold;
90
- font-style: normal;
91
- }
92
-
93
- /* a variable name */
94
- .var {
95
- color: #000000;
96
- font-weight: normal;
97
- font-style: normal;
98
- }
99
-
100
- /* a function name */
101
- .fun {
102
- color: #000000;
103
- font-weight: bold;
104
- font-style: normal;
105
- }
106
-
107
- /* Specify class=linenums on a pre to get line numbering */
108
- ol.linenums {
109
- margin-top: 0;
110
- margin-bottom: 0;
111
- }
@@ -1,132 +0,0 @@
1
- /* Tomorrow Theme */
2
- /* Original theme - https://github.com/chriskempson/tomorrow-theme */
3
- /* Pretty printing styles. Used with prettify.js. */
4
- /* SPAN elements with the classes below are added by prettyprint. */
5
- /* plain text */
6
- .pln {
7
- color: #4d4d4c; }
8
-
9
- @media screen {
10
- /* string content */
11
- .str {
12
- color: hsl(104, 100%, 24%); }
13
-
14
- /* a keyword */
15
- .kwd {
16
- color: hsl(240, 100%, 50%); }
17
-
18
- /* a comment */
19
- .com {
20
- color: hsl(0, 0%, 60%); }
21
-
22
- /* a type name */
23
- .typ {
24
- color: hsl(240, 100%, 32%); }
25
-
26
- /* a literal value */
27
- .lit {
28
- color: hsl(240, 100%, 40%); }
29
-
30
- /* punctuation */
31
- .pun {
32
- color: #000000; }
33
-
34
- /* lisp open bracket */
35
- .opn {
36
- color: #000000; }
37
-
38
- /* lisp close bracket */
39
- .clo {
40
- color: #000000; }
41
-
42
- /* a markup tag name */
43
- .tag {
44
- color: #c82829; }
45
-
46
- /* a markup attribute name */
47
- .atn {
48
- color: #f5871f; }
49
-
50
- /* a markup attribute value */
51
- .atv {
52
- color: #3e999f; }
53
-
54
- /* a declaration */
55
- .dec {
56
- color: #f5871f; }
57
-
58
- /* a variable name */
59
- .var {
60
- color: #c82829; }
61
-
62
- /* a function name */
63
- .fun {
64
- color: #4271ae; } }
65
- /* Use higher contrast and text-weight for printable form. */
66
- @media print, projection {
67
- .str {
68
- color: #060; }
69
-
70
- .kwd {
71
- color: #006;
72
- font-weight: bold; }
73
-
74
- .com {
75
- color: #600;
76
- font-style: italic; }
77
-
78
- .typ {
79
- color: #404;
80
- font-weight: bold; }
81
-
82
- .lit {
83
- color: #044; }
84
-
85
- .pun, .opn, .clo {
86
- color: #440; }
87
-
88
- .tag {
89
- color: #006;
90
- font-weight: bold; }
91
-
92
- .atn {
93
- color: #404; }
94
-
95
- .atv {
96
- color: #060; } }
97
- /* Style */
98
- /*
99
- pre.prettyprint {
100
- background: white;
101
- font-family: Consolas, Monaco, 'Andale Mono', monospace;
102
- font-size: 12px;
103
- line-height: 1.5;
104
- border: 1px solid #ccc;
105
- padding: 10px; }
106
- */
107
-
108
- /* Specify class=linenums on a pre to get line numbering */
109
- ol.linenums {
110
- margin-top: 0;
111
- margin-bottom: 0; }
112
-
113
- /* IE indents via margin-left */
114
- li.L0,
115
- li.L1,
116
- li.L2,
117
- li.L3,
118
- li.L4,
119
- li.L5,
120
- li.L6,
121
- li.L7,
122
- li.L8,
123
- li.L9 {
124
- /* */ }
125
-
126
- /* Alternate shading for lines */
127
- li.L1,
128
- li.L3,
129
- li.L5,
130
- li.L7,
131
- li.L9 {
132
- /* */ }
@@ -1,325 +0,0 @@
1
- // Create namespace to live in
2
- const tg37 = {};
3
- tg37.logContent = '';
4
-
5
- // WebRTC Phone
6
- tg37.initialize = function (config) {
7
-
8
- // Create phone instance
9
- tg37.phone = new Telegenta.Phone(new Telegenta.Logger.LogHandler(Telegenta.Logger.LOGLVL.WARN, tg37.logHandler));
10
- // tg37.phone = new Telegenta.Phone();
11
- tg37.phoneState = 'INIT';
12
- tg37.config = config;
13
-
14
- // First check browser is compatible
15
- if (!tg37.phone.browserSupported) {
16
- tg37.setPhoneState('ERROR', 'Your browser is not supported');
17
- return;
18
- }
19
-
20
- // Load config
21
- try {
22
- tg37.cfg = JSON.parse(localStorage.getItem('telegenta_phone_config'));
23
- } catch (e) {
24
- tg37.cfg = null;
25
- }
26
-
27
- if (!tg37.cfg) {
28
- tg37.cfg = {};
29
- tg37.logHandler('INFO ', 'Creating new configuration');
30
- tg37.cfg.audioIn = 'default';
31
- tg37.cfg.audioOut = 'default';
32
- }
33
-
34
- // Set values for config audio select boxes
35
- document.getElementById('audio_input_selector').value = tg37.cfg.audioIn;
36
- document.getElementById('audio_output_selector').value = tg37.cfg.audioOut;
37
-
38
- // return;
39
-
40
- // Now request media permissions and enumerate devices for device selectors
41
- tg37.phone.prepareMedia().then(function () {
42
- // Set options for config select boxes
43
- // Note: Fetching audio devices from untrusted sources (e.g. file://) will return an empty name by the
44
- // browser, so we use 'id' instead, or else select boxes will be empty
45
- tg37.phone.audioInputDeviceList.forEach(function (item) {
46
- document.getElementById('audio_input_selector').appendChild(new Option(item.name?item.name:item.id, item.id))
47
- });
48
- tg37.phone.audioOutputDeviceList.forEach(function (item) {
49
- document.getElementById('audio_output_selector').appendChild(new Option(item.name?item.name:item.id, item.id))
50
- });
51
-
52
- /*
53
- * Setup phone events now
54
- */
55
-
56
- // Handle connecting events and set state
57
- tg37.phone.on('connectionStateChange', function (event) {
58
- tg37.logHandler('DEBUG', 'Connection = ' + event.state);
59
- switch (event.state) {
60
- case 'CONNECTING':
61
- tg37.setPhoneState('INIT', 'Connecting to server');
62
- break;
63
-
64
- case 'REGISTERED':
65
- case 'CONNECTED':
66
- tg37.setPhoneState('IDLE', 'Connecting to server');
67
- break;
68
-
69
- case 'UNREGISTERED':
70
- case 'DISCONNECTED':
71
- tg37.setPhoneState('ERROR', 'Disconnected from server');
72
- break;
73
-
74
- case 'REGISTRATION_FAILED':
75
- tg37.setPhoneState('ERROR', 'Registration failed');
76
- break;
77
-
78
- default:
79
- tg37.logHandler('ERROR', 'Unknown connecting state ' + event.state);
80
- }
81
- });
82
-
83
- // Update our phone state
84
- tg37.phone.on('sessionStateChange', function (event) {
85
- tg37.logHandler('INFO ', '' + event.state);
86
- switch (event.state) {
87
- case 'INITIALIZING':
88
- tg37.setPhoneState('CONNECTING', 'Initializing...');
89
- break;
90
-
91
- case 'CALLING':
92
- tg37.setPhoneState('CONNECTING', 'Calling...');
93
- break;
94
-
95
- case 'PROGRESS':
96
- switch (event.code) {
97
- case 180:
98
- case 183:
99
- tg37.setPhoneState('CONNECTING', 'Ringing...');
100
- break;
101
-
102
- default:
103
- tg37.setPhoneState('CONNECTING');
104
- }
105
- break;
106
-
107
- case 'ACTIVE':
108
- tg37.setPhoneState('ACTIVE');
109
- break;
110
-
111
- case 'TERMINATED':
112
- tg37.setPhoneState('TERMINATED');
113
- break;
114
-
115
- case 'FAILED':
116
- tg37.setPhoneState('FAILED', event.cause);
117
- break;
118
-
119
- case 'IDLE':
120
- tg37.setPhoneState('IDLE');
121
- break;
122
-
123
- default:
124
- tg37.logHandler('ERROR', 'Unknown session state ' + event.state);
125
- }
126
- });
127
-
128
- // Call duration events (~1 sec) will just update UI
129
- tg37.phone.on('callDurationUpdate', function (event) {
130
- document.getElementById('dial_button_duration').textContent = '(' + event.durationStr + ')';
131
- });
132
-
133
- // Recording state events will just update UI
134
- tg37.phone.on('recordingStateChange', function (event) {
135
- if (event.state) {
136
- tg37.logHandler('INFO ', 'Recording started');
137
- } else {
138
- tg37.logHandler('INFO ', 'Recording stopped');
139
- }
140
-
141
- tg37.setRecIconState(event.state);
142
- if (event.error) {
143
- tg37.logHandler('ERROR', 'Recording error = ' + event.error);
144
- }
145
- });
146
-
147
- // Mute state events will just update UI
148
- tg37.phone.on('muteStateChange', function (event) {
149
- if (event.state) {
150
- tg37.logHandler('INFO ', 'Microphone muted');
151
- } else {
152
- tg37.logHandler('INFO ', 'Microphone unmuted');
153
- }
154
-
155
- tg37.setMuteIconState(event.state);
156
- });
157
-
158
- /*
159
- * Start phone and connect to server
160
- */
161
- let options = {
162
- remoteAudioElement: document.getElementById('remote_audio'),
163
- register: false,
164
- audioInputDeviceId: tg37.cfg.audioIn,
165
- audioOutputDeviceId: tg37.cfg.audioOut,
166
- };
167
-
168
- // Choose username+password credentials or provision token to client?
169
- if (config.provisionToken) {
170
- options.provisionToken = config.provisionToken;
171
- } else if (config.username) {
172
- options.authorizationUsername = config.username;
173
- options.password = config.password;
174
- } else {
175
- tg37.logHandler('ERROR', 'Unable to start missing provision token or account credentials');
176
- return;
177
- }
178
-
179
- tg37.setPhoneState('INIT', 'Starting phone');
180
- tg37.phone.start(options);
181
-
182
- }).catch(function (err) {
183
- tg37.logHandler('ERROR', 'Unable to start phone: ' + err);
184
- });
185
- };
186
-
187
- // Dial button pressed handler
188
- tg37.pressDialBtn = function () {
189
- switch (tg37.phoneState) {
190
- case 'IDLE':
191
- let number = document.getElementById('destination_number').value;
192
- if (number.length < 3) {
193
- this.logHandler('WARN ', 'You must enter a valid phone number first!');
194
- return;
195
- }
196
-
197
- tg37.phone.call(number);
198
- break;
199
-
200
- case 'CONNECTING':
201
- case 'ACTIVE':
202
- tg37.phone.hangup();
203
- break;
204
-
205
- default:
206
- break;
207
- }
208
- };
209
-
210
- // Keypad pressed
211
- tg37.pressNumberBtn = function (code) {
212
- if (tg37.phoneState === 'ACTIVE') {
213
- tg37.phone.sendDTMF(code)
214
- } else {
215
- document.getElementById('destination_number').value += code;
216
- }
217
- };
218
-
219
- // state: INIT, IDLE, CONNECTING, ACTIVE, TERMINATED, FAILED, ERROR
220
- tg37.setPhoneState = function (state, msg) {
221
- tg37.logHandler('DEBUG', 'Phone state = ' + state);
222
- switch (state) {
223
- case 'INIT':
224
- tg37.setDialButton('Initializing...', '', 'gray');
225
- break;
226
-
227
- case 'IDLE':
228
- tg37.setDialButton('Dial', 'Please input number to dial', 'green');
229
- document.getElementById('dial_button_duration').textContent = '';
230
- tg37.setRecIconState(false);
231
- tg37.setMuteIconState(false);
232
- break;
233
-
234
- case 'CONNECTING':
235
- tg37.setDialButton('Calling', msg, 'yellow');
236
- break;
237
-
238
- case 'ACTIVE':
239
- tg37.setDialButton('Call connected', '', 'blue');
240
- break;
241
-
242
- case 'TERMINATED':
243
- tg37.setDialButton('Call terminated', '', 'yellow');
244
- break;
245
-
246
- case 'FAILED':
247
- tg37.setDialButton('Call failed', msg, 'red');
248
- break;
249
-
250
- case 'ERROR':
251
- tg37.setDialButton('Error', msg, 'red');
252
- break;
253
-
254
- default:
255
- tg37.logHandler('ERROR ', 'Unknown state ' + state);
256
- break;
257
- }
258
-
259
- tg37.phoneState = state;
260
- };
261
-
262
- // Set dial button texts and color helper method
263
- tg37.setDialButton = function (text, subtext, color) {
264
- subtext = (subtext.length) ? subtext : '&nbsp;';
265
- document.getElementById('dial_button_text').textContent = text;
266
- document.getElementById('dial_button_subtext').innerHTML = subtext;
267
- document.getElementById('dial_button').classList.remove('btn-green', 'btn-yellow', 'btn-blue', 'btn-red', 'btn-gray');
268
- if (color) {
269
- document.getElementById('dial_button').classList.add('btn-' + color);
270
- } else {
271
- document.getElementById('dial_button').classList.add('btn-gray');
272
- }
273
- };
274
-
275
- // Update record button icon
276
- tg37.setRecIconState = function (state) {
277
- const recIcon = document.getElementById('RecButton');
278
- if (state) {
279
- recIcon.title = 'Stop recording';
280
- recIcon.classList.replace('top-record', 'top-stoprecord');
281
- } else {
282
- recIcon.title = 'Start recording';
283
- recIcon.classList.replace('top-stoprecord', 'top-record');
284
- }
285
- };
286
-
287
- // Update mute button icon
288
- tg37.setMuteIconState = function (state) {
289
- const muteIcon = document.getElementById('MuteButton');
290
- if (state) {
291
- muteIcon.title = 'Unmute microphone';
292
- muteIcon.classList.replace('top-unmute', 'top-mute');
293
- } else {
294
- muteIcon.title = 'Mute microphone';
295
- muteIcon.classList.replace('top-mute', 'top-unmute');
296
- }
297
- };
298
-
299
- // Save current configuration to browser local storage
300
- tg37.saveAndCloseConfig = function () {
301
- tg37.cfg.audioIn = document.getElementById('audio_input_selector').value;
302
- tg37.cfg.audioOut = document.getElementById('audio_output_selector').value;
303
- tg37.phone.setAudioInputDevice(tg37.cfg.audioIn);
304
- tg37.phone.setAudioOutputDevice(tg37.cfg.audioOut);
305
- localStorage.setItem('telegenta_phone_config', JSON.stringify(tg37.cfg));
306
- document.getElementById('Settings').classList.remove('showElement');
307
- };
308
-
309
- // Simple logger function
310
- tg37.logHandler = function (level, msg) {
311
- // console.log(msg);
312
-
313
- // Don't loc these levels
314
- if (level === 'DEBUG') {
315
- return;
316
- }
317
-
318
- let ts = new Date().toISOString().substr(11, 8);
319
- if (typeof(msg) === 'object') {
320
- msg = msg[0];
321
- }
322
- tg37.logContent = tg37.logContent + ts + ' ' + msg + '\n';
323
- document.getElementById('log_element').value = tg37.logContent;
324
- };
325
-