@exotel-npm-dev/webrtc-client-sdk 1.0.11 → 1.0.13
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/Changelog +4 -1
- package/Makefile +16 -0
- package/dist/exotelsdk.js +491 -220
- package/dist/exotelsdk.js.map +1 -1
- package/package.json +3 -3
- package/src/api/callAPI/Call.js +1 -2
- package/src/api/omAPI/Diagnostics.js +120 -121
- package/src/api/omAPI/DiagnosticsListener.js +13 -12
- package/src/api/registerAPI/RegisterListener.js +12 -12
- package/src/listeners/CallListener.js +10 -10
- package/src/listeners/Callback.js +132 -132
- package/src/listeners/ExWebClient.js +25 -18
- package/src/listeners/ExotelVoiceClientListener.js +9 -9
- package/src/listeners/SessionListeners.js +110 -110
- package/src/api/omAPI/WebrtcLogger.js +0 -55
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exotel-npm-dev/webrtc-client-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "client sdk for webrtc based on webrtc core sdk",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,6 @@
|
|
|
29
29
|
"webpack-cli": "^4.10.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@exotel-npm-dev/webrtc-core-sdk": "^1.0.
|
|
32
|
+
"@exotel-npm-dev/webrtc-core-sdk": "^1.0.13"
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|
package/src/api/callAPI/Call.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CallDetails } from "./CallDetails";
|
|
2
|
-
import { webrtcLogger } from "../omAPI/WebrtcLogger"
|
|
3
2
|
|
|
4
3
|
import { webrtcSIPPhone } from '@exotel-npm-dev/webrtc-core-sdk';
|
|
5
|
-
var logger =
|
|
4
|
+
var logger = webrtcSIPPhone.getLogger();
|
|
6
5
|
|
|
7
6
|
export function Call() {
|
|
8
7
|
this.Answer = function () {
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { diagnosticsCallback } from "../../listeners/Callback";
|
|
2
|
-
import { webrtcLogger } from "./WebrtcLogger"
|
|
3
2
|
|
|
4
3
|
import { webrtcSIPPhone } from '@exotel-npm-dev/webrtc-core-sdk';
|
|
5
|
-
var logger =
|
|
4
|
+
var logger = webrtcSIPPhone.getLogger();
|
|
6
5
|
var speakerNode;
|
|
7
6
|
var micNode;
|
|
8
7
|
var audioTrack;
|
|
9
8
|
var thisBrowserName = "";
|
|
10
9
|
var intervalID;
|
|
11
10
|
|
|
12
|
-
var speakerTestTone = document.createElement("audio");
|
|
11
|
+
var speakerTestTone = document.createElement("audio");
|
|
13
12
|
var eventMapper = { sipml5: {}, sipjs: {} };
|
|
14
13
|
eventMapper.sipjs.started = "WS_TEST_PASS";
|
|
15
14
|
eventMapper.sipjs.failed_to_start = "WS_TEST_FAIL";
|
|
@@ -71,7 +70,7 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
71
70
|
logger.log(msg);
|
|
72
71
|
var oldMsg = window.localStorage.getItem('troubleShootReport')
|
|
73
72
|
if (oldMsg) {
|
|
74
|
-
|
|
73
|
+
msg = oldMsg + msg
|
|
75
74
|
}
|
|
76
75
|
window.localStorage.setItem('troubleShootReport', msg)
|
|
77
76
|
diagnosticsCallback.triggerDiagnosticsSaveCallback('troubleShootReport', msg)
|
|
@@ -127,11 +126,11 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
127
126
|
this.addToTrobuleshootReport(
|
|
128
127
|
"INFO",
|
|
129
128
|
"Browser: " +
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
browserName +
|
|
130
|
+
"/" +
|
|
131
|
+
version +
|
|
132
|
+
", Platform: " +
|
|
133
|
+
navigator.platform
|
|
135
134
|
);
|
|
136
135
|
thisBrowserName = browserName;
|
|
137
136
|
if (browserName == "Chrome") {
|
|
@@ -148,52 +147,52 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
148
147
|
stopSpeakerTesttoneWithSuccess: function () {
|
|
149
148
|
this.stopSpeakerTest();
|
|
150
149
|
this.sendDeviceTestingEvent("SPEAKER_TEST_PASS");
|
|
151
|
-
this.addToTrobuleshootReport("INFO", "Speaker device testing is successfull");
|
|
150
|
+
this.addToTrobuleshootReport("INFO", "Speaker device testing is successfull");
|
|
152
151
|
this.addToTrobuleshootReport("INFO", "Speaker device testing is completed");
|
|
153
152
|
},
|
|
154
153
|
|
|
155
154
|
stopSpeakerTesttoneWithFailure: function () {
|
|
156
155
|
this.stopSpeakerTest();
|
|
157
156
|
this.sendDeviceTestingEvent("SPEAKER_TEST_FAIL");
|
|
158
|
-
this.addToTrobuleshootReport("INFO", "Speaker device testing is failed");
|
|
157
|
+
this.addToTrobuleshootReport("INFO", "Speaker device testing is failed");
|
|
159
158
|
this.addToTrobuleshootReport("INFO", "Speaker device testing is completed");
|
|
160
159
|
},
|
|
161
160
|
|
|
162
161
|
startSpeakerTest: function () {
|
|
163
|
-
var parent = this;
|
|
162
|
+
var parent = this;
|
|
164
163
|
|
|
165
164
|
try {
|
|
166
|
-
|
|
165
|
+
intervalID = setInterval(function () {
|
|
167
166
|
|
|
168
|
-
|
|
167
|
+
try {
|
|
169
168
|
speakerTestTone = webrtcSIPPhone.getSpeakerTestTone();
|
|
170
169
|
/* Close last pending tracks.. */
|
|
171
170
|
logger.log("close last track")
|
|
172
171
|
speakerTestTone.pause();
|
|
173
|
-
parent.closeAudioTrack();
|
|
174
|
-
|
|
172
|
+
parent.closeAudioTrack();
|
|
173
|
+
|
|
175
174
|
parent.addToTrobuleshootReport("INFO", "Speaker device testing is started");
|
|
176
175
|
logger.log("speakerTestTone : play start", speakerTestTone);
|
|
177
|
-
|
|
178
|
-
speakerTestTone.addEventListener("ended", function(event) {
|
|
176
|
+
|
|
177
|
+
speakerTestTone.addEventListener("ended", function (event) {
|
|
179
178
|
logger.log("speakerTestTone : tone iteration ended");
|
|
180
179
|
});
|
|
181
180
|
|
|
182
181
|
logger.log("start new track")
|
|
183
182
|
|
|
184
183
|
var playPromise = speakerTestTone.play();
|
|
185
|
-
|
|
184
|
+
|
|
186
185
|
if (playPromise !== undefined) {
|
|
187
186
|
playPromise.then(_ => {
|
|
188
187
|
logger.log("speakerTestTone : promise successfull");
|
|
189
188
|
})
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
|
|
189
|
+
.catch(error => {
|
|
190
|
+
// Auto-play was prevented
|
|
191
|
+
// Show paused UI.
|
|
192
|
+
logger.log("speakerTestTone : failed", error);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
|
|
197
196
|
var stream;
|
|
198
197
|
var browserVersion;
|
|
199
198
|
var browserName;
|
|
@@ -215,32 +214,32 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
215
214
|
} catch {
|
|
216
215
|
logger.log("No speakertone to test..\n")
|
|
217
216
|
}
|
|
218
|
-
|
|
219
|
-
|
|
217
|
+
//Enable this for tone loop - Start
|
|
218
|
+
}, 1000)
|
|
220
219
|
} catch (e) {
|
|
221
|
-
logger.log("speakerTestTone : start failed"
|
|
220
|
+
logger.log("speakerTestTone : start failed", e);
|
|
222
221
|
}
|
|
223
222
|
//Enable this for tone loop - End
|
|
224
223
|
|
|
225
224
|
},
|
|
226
225
|
|
|
227
226
|
stopSpeakerTest: function () {
|
|
228
|
-
var parent = this;
|
|
227
|
+
var parent = this;
|
|
229
228
|
speakerTestTone = webrtcSIPPhone.getSpeakerTestTone();
|
|
230
229
|
//Enable this for tone loop - Start
|
|
231
230
|
try {
|
|
232
|
-
clearInterval(intervalID)
|
|
231
|
+
clearInterval(intervalID)
|
|
233
232
|
intervalID = 0
|
|
234
|
-
|
|
233
|
+
//Enable this for tone loop - End
|
|
235
234
|
speakerTestTone.pause();
|
|
236
|
-
parent.closeAudioTrack();
|
|
235
|
+
parent.closeAudioTrack();
|
|
237
236
|
parent.addToTrobuleshootReport("INFO", "Speaker device testing is stopped");
|
|
238
|
-
|
|
237
|
+
//Enable this for tone loop - Start
|
|
239
238
|
} catch (e) {
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
},
|
|
239
|
+
logger.log("speakerTestTone : stop failed", e);
|
|
240
|
+
}
|
|
241
|
+
//Enable this for tone loop - End
|
|
242
|
+
},
|
|
244
243
|
|
|
245
244
|
startMicTest: function () {
|
|
246
245
|
this.closeAudioTrack();
|
|
@@ -260,14 +259,14 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
260
259
|
parent.addToTrobuleshootReport(
|
|
261
260
|
"INFO",
|
|
262
261
|
"Device track settings: " +
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
262
|
+
"len: " +
|
|
263
|
+
tracks.length +
|
|
264
|
+
", id:" +
|
|
265
|
+
track.getSettings().deviceId +
|
|
266
|
+
", kind: " +
|
|
267
|
+
track.kind +
|
|
268
|
+
", label:" +
|
|
269
|
+
track.label
|
|
271
270
|
);
|
|
272
271
|
//parent.setMicName(track.label);
|
|
273
272
|
if (thisBrowserName != "Chrome") {
|
|
@@ -291,30 +290,30 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
291
290
|
},
|
|
292
291
|
|
|
293
292
|
stopMicTest: function () {
|
|
294
|
-
this.closeAudioTrack();
|
|
293
|
+
this.closeAudioTrack();
|
|
295
294
|
this.addToTrobuleshootReport("INFO", "Mic device testing is stopped");
|
|
296
|
-
},
|
|
295
|
+
},
|
|
297
296
|
|
|
298
297
|
stopMicTestSuccess: function () {
|
|
299
|
-
this.closeAudioTrack();
|
|
298
|
+
this.closeAudioTrack();
|
|
300
299
|
this.addToTrobuleshootReport(
|
|
301
300
|
"INFO",
|
|
302
301
|
"Microphone device testing is successful"
|
|
303
302
|
);
|
|
304
303
|
this.sendDeviceTestingEvent("MICROPHONE_TEST_PASS");
|
|
305
304
|
this.addToTrobuleshootReport("INFO", "Mic device testing is completed");
|
|
306
|
-
},
|
|
307
|
-
|
|
305
|
+
},
|
|
306
|
+
|
|
308
307
|
stopMicTestFailure: function () {
|
|
309
|
-
this.closeAudioTrack();
|
|
308
|
+
this.closeAudioTrack();
|
|
310
309
|
this.addToTrobuleshootReport(
|
|
311
310
|
"INFO",
|
|
312
311
|
"Microphone device testing is failure"
|
|
313
312
|
);
|
|
314
|
-
this.sendDeviceTestingEvent("MICROPHONE_TEST_FAIL");
|
|
313
|
+
this.sendDeviceTestingEvent("MICROPHONE_TEST_FAIL");
|
|
315
314
|
this.addToTrobuleshootReport("INFO", "Mic device testing is failure");
|
|
316
315
|
this.addToTrobuleshootReport("INFO", "Mic device testing is completed");
|
|
317
|
-
},
|
|
316
|
+
},
|
|
318
317
|
|
|
319
318
|
setDeviceNames: function () {
|
|
320
319
|
if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
|
|
@@ -330,11 +329,11 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
330
329
|
parent.addToTrobuleshootReport(
|
|
331
330
|
"INFO",
|
|
332
331
|
"Device: " +
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
deviceInfos[i].kind +
|
|
333
|
+
", label: " +
|
|
334
|
+
deviceInfos[i].label +
|
|
335
|
+
", id:" +
|
|
336
|
+
deviceInfos[i].deviceId
|
|
338
337
|
);
|
|
339
338
|
if (deviceInfos[i].deviceId == "default") {
|
|
340
339
|
if (deviceInfos[i].kind == "audiooutput") {
|
|
@@ -374,29 +373,29 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
374
373
|
fillStreamMicrophone: function (stream, outDevice) {
|
|
375
374
|
try {
|
|
376
375
|
var audioContext = new AudioContext();
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
376
|
+
var analyser = audioContext.createAnalyser();
|
|
377
|
+
var source = audioContext.createMediaStreamSource(stream);
|
|
378
|
+
micNode = audioContext.createScriptProcessor(2048, 1, 1);
|
|
379
|
+
analyser.smoothingTimeConstant = 0.8;
|
|
380
|
+
analyser.fftSize = 1024;
|
|
381
|
+
source.connect(analyser);
|
|
382
|
+
analyser.connect(micNode);
|
|
383
|
+
micNode.connect(audioContext.destination);
|
|
384
|
+
micNode.onaudioprocess = function () {
|
|
385
|
+
var array = new Uint8Array(analyser.frequencyBinCount);
|
|
386
|
+
analyser.getByteFrequencyData(array);
|
|
387
|
+
var values = 0;
|
|
388
|
+
var length = array.length;
|
|
389
|
+
for (var i = 0; i < length; i++) {
|
|
390
|
+
values += array[i];
|
|
391
|
+
}
|
|
392
|
+
var average = values / length;
|
|
393
|
+
//diagnosticsCallback.triggerDiagnosticsMicStatusCallback(average, "mic ok");
|
|
394
|
+
diagnosticsCallback.triggerKeyValueSetCallback("mic", average, "mic ok")
|
|
395
|
+
if (average > 9) {
|
|
396
|
+
//fillMicColors(Math.round(average));
|
|
397
|
+
}
|
|
398
|
+
};
|
|
400
399
|
} catch (e) {
|
|
401
400
|
logger.log("Media source not available for mic test ..")
|
|
402
401
|
average = 0;
|
|
@@ -407,49 +406,49 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
407
406
|
|
|
408
407
|
fillStreamSpeaker: function (stream, outDevice) {
|
|
409
408
|
try {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
409
|
+
var audioContext = new AudioContext();
|
|
410
|
+
var analyser = audioContext.createAnalyser();
|
|
411
|
+
var source = audioContext.createMediaStreamSource(stream);
|
|
412
|
+
speakerNode = audioContext.createScriptProcessor(2048, 1, 1);
|
|
413
|
+
analyser.smoothingTimeConstant = 0.8;
|
|
414
|
+
analyser.fftSize = 1024;
|
|
415
|
+
source.connect(analyser);
|
|
416
|
+
analyser.connect(speakerNode);
|
|
417
|
+
speakerNode.connect(audioContext.destination);
|
|
418
|
+
speakerNode.onaudioprocess = function () {
|
|
419
|
+
var array = new Uint8Array(analyser.frequencyBinCount);
|
|
420
|
+
analyser.getByteFrequencyData(array);
|
|
421
|
+
var values = 0;
|
|
422
|
+
var length = array.length;
|
|
423
|
+
for (var i = 0; i < length; i++) {
|
|
424
|
+
values += array[i];
|
|
425
|
+
}
|
|
426
|
+
var average = values / length;
|
|
427
|
+
diagnosticsCallback.triggerKeyValueSetCallback("speaker", average, "speaker ok");
|
|
428
|
+
};
|
|
430
429
|
} catch (e) {
|
|
431
430
|
logger.log("Media source not available for speaker test ..")
|
|
432
431
|
average = 0;
|
|
433
|
-
diagnosticsCallback.triggerKeyValueSetCallback("speaker", average, "speaker error");
|
|
432
|
+
diagnosticsCallback.triggerKeyValueSetCallback("speaker", average, "speaker error");
|
|
434
433
|
}
|
|
435
434
|
},
|
|
436
435
|
|
|
437
|
-
setUserRegTroubleshootData: function(txtUser) {
|
|
436
|
+
setUserRegTroubleshootData: function (txtUser) {
|
|
438
437
|
logger.log("No explicit registration sent during testing...")
|
|
439
438
|
},
|
|
440
439
|
|
|
441
|
-
setWSTroubleshootData: function(txtWsStatus) {
|
|
442
|
-
|
|
440
|
+
setWSTroubleshootData: function (txtWsStatus) {
|
|
441
|
+
//Already done during init, no need to do again.
|
|
443
442
|
let txtWSSUrl = webrtcSIPPhone.getWSSUrl();
|
|
444
443
|
diagnosticsCallback.triggerKeyValueSetCallback("wss", txtWsStatus, txtWSSUrl)
|
|
445
444
|
},
|
|
446
445
|
|
|
447
446
|
startWSAndUserRegistrationTest: function () {
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
447
|
+
try {
|
|
448
|
+
this.startNetworkProtocolTest();
|
|
449
|
+
} catch (e) {
|
|
450
|
+
logger.log(e);
|
|
451
|
+
}
|
|
453
452
|
},
|
|
454
453
|
|
|
455
454
|
sendEventToWebRTCTroubleshooter: function (eventType, sipMethod) {
|
|
@@ -470,7 +469,7 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
470
469
|
}
|
|
471
470
|
},
|
|
472
471
|
|
|
473
|
-
noop: function () {},
|
|
472
|
+
noop: function () { },
|
|
474
473
|
|
|
475
474
|
sendNetworkTestingEvent: function (event) {
|
|
476
475
|
this.addToTrobuleshootReport("INFO", "NETWORK EVENT = " + event);
|
|
@@ -493,7 +492,7 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
493
492
|
var key = keys[j];
|
|
494
493
|
this.setTroubleshootCandidateData(key, "waiting", "");
|
|
495
494
|
}
|
|
496
|
-
},
|
|
495
|
+
},
|
|
497
496
|
|
|
498
497
|
proccessCandidatesForTroubleshoot: function (candidates) {
|
|
499
498
|
candidateProcessData = {
|
|
@@ -524,7 +523,7 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
524
523
|
if (protocolType == "udp" || protocolType == "UDP") {
|
|
525
524
|
candidateProcessData.udp = true;
|
|
526
525
|
candidateProcessData.udpCandidates.push(candidate);
|
|
527
|
-
if (candidate.length > 0) {
|
|
526
|
+
if (candidate.length > 0) {
|
|
528
527
|
this.sendNetworkTestingEvent("UDP_TEST_COMPLETE");
|
|
529
528
|
}
|
|
530
529
|
} else if (protocolType == "tcp" || protocolType == "TCP") {
|
|
@@ -534,14 +533,14 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
534
533
|
}
|
|
535
534
|
|
|
536
535
|
try {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
536
|
+
if (address.includes(":") || address.includes("-")) {
|
|
537
|
+
candidateProcessData.ipv6 = true;
|
|
538
|
+
candidateProcessData.ipv6Candidates.push(candidate);
|
|
539
|
+
this.sendNetworkTestingEvent("IPV6_TEST_COMPLETE");
|
|
540
|
+
}
|
|
542
541
|
} catch (e) {
|
|
543
542
|
this.sendNetworkTestingEvent("IPV6_TEST_COMPLETE");
|
|
544
|
-
}
|
|
543
|
+
}
|
|
545
544
|
|
|
546
545
|
if (candidateType == "host") {
|
|
547
546
|
candidateProcessData.host = true;
|
|
@@ -596,7 +595,7 @@ export var ameyoWebRTCTroubleshooter = {
|
|
|
596
595
|
this.sendNetworkTestingEvent("REFLEX_CON_TEST_STARTING");
|
|
597
596
|
this.addToTrobuleshootReport("INFO", "Gathering ICE candidates ");
|
|
598
597
|
|
|
599
|
-
this.startCandidatesForTroubleshoot()
|
|
598
|
+
this.startCandidatesForTroubleshoot()
|
|
600
599
|
|
|
601
600
|
var configuration = {
|
|
602
601
|
iceServers: [
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { diagnosticsCallback } from '../../listeners/Callback';
|
|
2
|
-
import {ameyoWebRTCTroubleshooter} from './Diagnostics';
|
|
3
|
-
import {
|
|
2
|
+
import { ameyoWebRTCTroubleshooter } from './Diagnostics';
|
|
3
|
+
import { webrtcSIPPhone } from '@exotel-npm-dev/webrtc-core-sdk';
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var logger =
|
|
6
|
+
var logger = webrtcSIPPhone.getLogger();
|
|
7
|
+
|
|
7
8
|
export function initDiagnostics(setDiagnosticsReportCallback, keyValueSetCallback) {
|
|
8
9
|
if (!keyValueSetCallback || !setDiagnosticsReportCallback) {
|
|
9
10
|
logger.log("Callbacks are not set")
|
|
@@ -12,7 +13,7 @@ export function initDiagnostics(setDiagnosticsReportCallback, keyValueSetCallbac
|
|
|
12
13
|
diagnosticsCallback.setKeyValueCallback(keyValueSetCallback);
|
|
13
14
|
diagnosticsCallback.setDiagnosticsReportCallback(setDiagnosticsReportCallback);
|
|
14
15
|
let version = ameyoWebRTCTroubleshooter.getBrowserData();
|
|
15
|
-
diagnosticsCallback.keyValueSetCallback('browserVersion','ready', version)
|
|
16
|
+
diagnosticsCallback.keyValueSetCallback('browserVersion', 'ready', version)
|
|
16
17
|
return;
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -26,7 +27,7 @@ export function startSpeakerDiagnosticsTest() {
|
|
|
26
27
|
/**
|
|
27
28
|
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
28
29
|
*/
|
|
29
|
-
logger.log("Request to startSpeakerTest:\n")
|
|
30
|
+
logger.log("Request to startSpeakerTest:\n");
|
|
30
31
|
ameyoWebRTCTroubleshooter.startSpeakerTest()
|
|
31
32
|
return;
|
|
32
33
|
}
|
|
@@ -36,14 +37,14 @@ export function stopSpeakerDiagnosticsTest(speakerTestResponse) {
|
|
|
36
37
|
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
|
-
logger.log("Request to stopSpeakerTest - Suuccessful Test:\n")
|
|
40
|
+
logger.log("Request to stopSpeakerTest - Suuccessful Test:\n");
|
|
40
41
|
if (speakerTestResponse == 'yes') {
|
|
41
42
|
ameyoWebRTCTroubleshooter.stopSpeakerTesttoneWithSuccess()
|
|
42
43
|
} else if (speakerTestResponse == 'no') {
|
|
43
44
|
ameyoWebRTCTroubleshooter.stopSpeakerTesttoneWithFailure()
|
|
44
45
|
} else {
|
|
45
46
|
ameyoWebRTCTroubleshooter.stopSpeakerTest()
|
|
46
|
-
}
|
|
47
|
+
}
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
|
|
@@ -51,7 +52,7 @@ export function startMicDiagnosticsTest() {
|
|
|
51
52
|
/**
|
|
52
53
|
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
53
54
|
*/
|
|
54
|
-
logger.log("Request to startMicTest:\n")
|
|
55
|
+
logger.log("Request to startMicTest:\n");
|
|
55
56
|
ameyoWebRTCTroubleshooter.startMicTest()
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
@@ -60,7 +61,7 @@ export function stopMicDiagnosticsTest(micTestResponse) {
|
|
|
60
61
|
/**
|
|
61
62
|
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
62
63
|
*/
|
|
63
|
-
logger.log("Request to stopMicTest - Successful Test:\n")
|
|
64
|
+
logger.log("Request to stopMicTest - Successful Test:\n");
|
|
64
65
|
if (micTestResponse == 'yes') {
|
|
65
66
|
ameyoWebRTCTroubleshooter.stopMicTestSuccess()
|
|
66
67
|
} else if (micTestResponse == 'no') {
|
|
@@ -78,7 +79,7 @@ export function startNetworkDiagnostics() {
|
|
|
78
79
|
/**
|
|
79
80
|
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
80
81
|
*/
|
|
81
|
-
logger.log("Request to start network diagnostics:\n")
|
|
82
|
+
logger.log("Request to start network diagnostics:\n");
|
|
82
83
|
ameyoWebRTCTroubleshooter.startWSAndUserRegistrationTest();
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
@@ -86,10 +87,10 @@ export function startNetworkDiagnostics() {
|
|
|
86
87
|
/**
|
|
87
88
|
* Function to troubleshoot the environment
|
|
88
89
|
*/
|
|
89
|
-
|
|
90
|
+
export function stopNetworkDiagnostics() {
|
|
90
91
|
/**
|
|
91
92
|
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
92
93
|
*/
|
|
93
|
-
logger.log("Request to stop network diagnostics:\n")
|
|
94
|
+
logger.log("Request to stop network diagnostics:\n");
|
|
94
95
|
return;
|
|
95
96
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { webrtcSIPPhone } from "@exotel-npm-dev/webrtc-core-sdk";
|
|
2
2
|
|
|
3
|
-
var logger =
|
|
3
|
+
var logger = webrtcSIPPhone.getLogger();
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Function to register the phone onto a webRTC client
|
|
@@ -15,17 +15,17 @@ export function DoRegister(sipAccountInfo, exWebClient) {
|
|
|
15
15
|
/**
|
|
16
16
|
* CHANGE IS REQUIRED - in the initialize function provision is to be given to pass Callback functions as arguments
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
try {
|
|
19
19
|
exWebClient.initialize(userContext,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} catch(e) {
|
|
20
|
+
sipAccountInfo.domain, //hostname
|
|
21
|
+
sipAccountInfo.userName, //subscriberName
|
|
22
|
+
sipAccountInfo.displayname,//displayName
|
|
23
|
+
sipAccountInfo.accountSid,//accountSid
|
|
24
|
+
'', sipAccountInfo); // subscriberToken
|
|
25
|
+
} catch (e) {
|
|
26
26
|
logger.log("Register failed ", e)
|
|
27
|
-
}
|
|
28
|
-
|
|
27
|
+
}
|
|
28
|
+
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
|
|
@@ -34,7 +34,7 @@ export function DoRegister(sipAccountInfo, exWebClient) {
|
|
|
34
34
|
* @param {*} sipAccountInfo
|
|
35
35
|
* @param {*} exWebClient
|
|
36
36
|
*/
|
|
37
|
-
export function UnRegister(sipAccountInfo, exWebClient){
|
|
37
|
+
export function UnRegister(sipAccountInfo, exWebClient) {
|
|
38
38
|
try {
|
|
39
39
|
exWebClient.unregister(sipAccountInfo);
|
|
40
40
|
} catch (e) {
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { webrtcLogger } from "../api/omAPI/WebrtcLogger"
|
|
2
1
|
import { callbacks } from "./Callback";
|
|
2
|
+
import { webrtcSIPPhone } from "@exotel-npm-dev/webrtc-core-sdk";
|
|
3
3
|
|
|
4
|
-
var logger =
|
|
4
|
+
var logger = webrtcSIPPhone.getLogger();
|
|
5
5
|
|
|
6
6
|
export function CallListener() {
|
|
7
|
-
this.onIncomingCall = function(call,phone){
|
|
7
|
+
this.onIncomingCall = function (call, phone) {
|
|
8
8
|
/**
|
|
9
9
|
* When there is an incoming call, [INVITE is received on SIP] send a call back to the
|
|
10
10
|
*/
|
|
11
11
|
logger.log("CallListener:Initialise call")
|
|
12
|
-
callbacks.initializeCall(call,phone)
|
|
12
|
+
callbacks.initializeCall(call, phone)
|
|
13
13
|
|
|
14
14
|
/** Triggers the callback on the UI end with message indicating it to be an incoming call */
|
|
15
15
|
logger.log("CallListener:Trigger Incoming")
|
|
16
16
|
callbacks.triggerCallback("incoming");
|
|
17
17
|
}
|
|
18
|
-
this.onCallEstablished = function(call,phone){
|
|
18
|
+
this.onCallEstablished = function (call, phone) {
|
|
19
19
|
/**
|
|
20
20
|
* When connection is established [ACK is sent by other party on SIP]
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
logger.log("CallListener:Initialise call")
|
|
23
|
+
callbacks.initializeCall(call, phone)
|
|
24
24
|
/** Triggers the callback on the UI end with message indicating call has been established*/
|
|
25
25
|
logger.log("CallListener:Trigger Connected")
|
|
26
26
|
callbacks.triggerCallback("connected")
|
|
27
27
|
}
|
|
28
|
-
this.onCallEnded = function(call,phone) {
|
|
28
|
+
this.onCallEnded = function (call, phone) {
|
|
29
29
|
/**
|
|
30
30
|
* When other party ends the call [BYE is received and sent by SIP]
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
callbacks.initializeCall(call,phone)
|
|
32
|
+
logger.log("CallListener:Initialise call")
|
|
33
|
+
callbacks.initializeCall(call, phone)
|
|
34
34
|
/** Triggers the callback on the UI end with message indicating call has ended */
|
|
35
35
|
logger.log("CallListener:Trigger Call Ended")
|
|
36
36
|
callbacks.triggerCallback("callEnded")
|