@exotel-npm-dev/webrtc-client-sdk 1.0.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/package.json +25 -0
- package/src/api/callAPI/Call.js +83 -0
- package/src/api/callAPI/CallDetails.js +74 -0
- package/src/api/omAPI/Diagnostics.js +644 -0
- package/src/api/omAPI/DiagnosticsFSM.js +142 -0
- package/src/api/omAPI/DiagnosticsFSM.ts +378 -0
- package/src/api/omAPI/DiagnosticsListener.js +95 -0
- package/src/api/omAPI/FSM.js +126 -0
- package/src/api/omAPI/WebrtcLogger.js +55 -0
- package/src/api/omAPI/js-finite-state-machine.js +126 -0
- package/src/api/omAPI/log/index.js +8 -0
- package/src/api/omAPI/log/index.ts +3 -0
- package/src/api/omAPI/log/levels.js +13 -0
- package/src/api/omAPI/log/levels.ts +10 -0
- package/src/api/omAPI/log/logger-factory.js +115 -0
- package/src/api/omAPI/log/logger-factory.ts +119 -0
- package/src/api/omAPI/log/logger.js +41 -0
- package/src/api/omAPI/log/logger.ts +42 -0
- package/src/api/registerAPI/RegisterListener.js +43 -0
- package/src/constants/ErrorConstants.js +6 -0
- package/src/constants/common.js +12 -0
- package/src/listeners/CallCtrlerDummy.js +8 -0
- package/src/listeners/CallListener.js +38 -0
- package/src/listeners/Callback.js +176 -0
- package/src/listeners/ExWebClient.js +468 -0
- package/src/listeners/ExotelVoiceClientListener.js +45 -0
- package/src/listeners/SessionListeners.js +123 -0
- package/src/phone.json +75 -0
- package/src/phoneDetailsAPI.js +43 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var DiagnosticsListener_1 = require("./DiagnosticsListener");
|
|
4
|
+
var Callback_1 = require("../../listeners/Callback");
|
|
5
|
+
var AmeyoWebrtcTroubleshooterFSM = /** @class */ (function () {
|
|
6
|
+
function AmeyoWebrtcTroubleshooterFSM() {
|
|
7
|
+
var _this = this;
|
|
8
|
+
this.deviceTestingFSM = new window.FSM("INITIAL_STATE", { name: "Device testing FSM" });
|
|
9
|
+
this.networkTestingFSM = new window.FSM("INITIAL_STATE", { name: "Network testing FSM" });
|
|
10
|
+
this.addDeviceTestingFSMTransitions = function () {
|
|
11
|
+
_this.deviceTestingFSM.addTransition('MICROPHONE_TEST_STARTING', 'INITIAL_STATE', null, 'MICROPHONE_TEST_STARTED', _this.startMicTest);
|
|
12
|
+
_this.deviceTestingFSM.addTransition('MICROPHONE_TEST_PASS', 'MICROPHONE_TEST_STARTED', null, 'MICROPHONE_TEST_PASSED', _this.microphoneSuccessCallback);
|
|
13
|
+
_this.deviceTestingFSM.addTransition('MICROPHONE_TEST_FAIL', 'MICROPHONE_TEST_STARTED', null, 'MICROPHONE_TEST_FAILED', _this.microphoneFailureCallback);
|
|
14
|
+
_this.deviceTestingFSM.addTransition('PROCEED', 'MICROPHONE_TEST_PASSED', null, 'MICROPHONE_TEST_DONE', _this.microphoneTestDoneCallback);
|
|
15
|
+
_this.deviceTestingFSM.addTransition('PROCEED', 'MICROPHONE_TEST_FAILED', null, 'MICROPHONE_TEST_DONE', _this.microphoneTestDoneCallback);
|
|
16
|
+
_this.deviceTestingFSM.addTransition('SPEAKER_TEST_STARTNG', 'MICROPHONE_TEST_DONE', null, 'SPEAKER_TEST_STARTED', _this.startSpeakerTest);
|
|
17
|
+
_this.deviceTestingFSM.addTransition('SPEAKER_TEST_PASS', 'SPEAKER_TEST_STARTED', null, 'SPEAKER_TEST_PASSED', _this.speakerSuccessCallback);
|
|
18
|
+
_this.deviceTestingFSM.addTransition('SPEAKER_TEST_FAIL', 'SPEAKER_TEST_STARTED', null, 'SPEAKER_TEST_FAILED', _this.speakerFailureCallback);
|
|
19
|
+
_this.deviceTestingFSM.addTransition('PROCEED', 'SPEAKER_TEST_PASSED', null, 'SPEAKER_TEST_DONE', _this.speakerTestDoneCallback);
|
|
20
|
+
_this.deviceTestingFSM.addTransition('PROCEED', 'SPEAKER_TEST_FAILED', null, 'SPEAKER_TEST_DONE', _this.speakerTestDoneCallback);
|
|
21
|
+
};
|
|
22
|
+
this.startMicTest = function () {
|
|
23
|
+
Callback_1.ameyoWebRTCTroubleshooter.startMicTest();
|
|
24
|
+
};
|
|
25
|
+
this.startSpeakerTest = function () {
|
|
26
|
+
Callback_1.ameyoWebRTCTroubleshooter.startSpeakerTest();
|
|
27
|
+
};
|
|
28
|
+
this.microphoneSuccessCallback = function () {
|
|
29
|
+
_this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
30
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.microphoneTestSuccessEvent();
|
|
31
|
+
};
|
|
32
|
+
this.microphoneFailureCallback = function () {
|
|
33
|
+
_this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
34
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.microphoneTestFailedEvent();
|
|
35
|
+
};
|
|
36
|
+
this.microphoneTestDoneCallback = function () {
|
|
37
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.microphoneTestDoneEvent();
|
|
38
|
+
};
|
|
39
|
+
this.speakerSuccessCallback = function () {
|
|
40
|
+
_this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
41
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.speakerTestSuccessEvent();
|
|
42
|
+
};
|
|
43
|
+
this.speakerFailureCallback = function () {
|
|
44
|
+
_this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
45
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.speakerTestFailedEvent();
|
|
46
|
+
};
|
|
47
|
+
this.speakerTestDoneCallback = function () {
|
|
48
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.speakerTestDoneEvent();
|
|
49
|
+
};
|
|
50
|
+
this.addNetworkTestingFSMTransitions = function () {
|
|
51
|
+
_this.networkTestingFSM.addTransition('WS_TEST_STARTING', 'INITIAL_STATE', null, 'WS_TEST_STARTED', _this.startWebsocketTesting);
|
|
52
|
+
_this.networkTestingFSM.addTransition('WS_TEST_PASS', 'WS_TEST_STARTED', null, 'WS_TEST_PASSED', _this.wsPassCallback);
|
|
53
|
+
_this.networkTestingFSM.addTransition('WS_TEST_FAIL', 'WS_TEST_STARTED', null, 'WS_TEST_FAILED', _this.wsFailCallback);
|
|
54
|
+
_this.networkTestingFSM.addTransition('PROCEED', 'WS_TEST_PASSED', null, 'WS_TEST_DONE', _this.wsTestDoneCallback);
|
|
55
|
+
_this.networkTestingFSM.addTransition('PROCEED', 'WS_TEST_FAILED', null, 'WS_TEST_DONE', _this.wsTestDoneCallback);
|
|
56
|
+
_this.networkTestingFSM.addTransition('USER_REG_TEST_STARTING', 'WS_TEST_DONE', null, 'USER_REG_TEST_STARTED', null);
|
|
57
|
+
_this.networkTestingFSM.addTransition('USER_REG_TEST_PASS', 'USER_REG_TEST_STARTED', null, 'USER_REG_TEST_PASSED', _this.userRegPassCallback);
|
|
58
|
+
_this.networkTestingFSM.addTransition('USER_REG_TEST_FAIL', 'USER_REG_TEST_STARTED', null, 'USER_REG_TEST_FAILED', _this.userRegFailCallback);
|
|
59
|
+
_this.networkTestingFSM.addTransition('PROCEED', 'USER_REG_TEST_PASSED', null, 'USER_REG_TEST_DONE', _this.userRegDoneCallback);
|
|
60
|
+
_this.networkTestingFSM.addTransition('PROCEED', 'USER_REG_TEST_FAILED', null, 'USER_REG_TEST_DONE', _this.userRegDoneCallback);
|
|
61
|
+
_this.networkTestingFSM.addTransition('UDP_TEST_STARTING', 'USER_REG_TEST_DONE', null, 'UDP_TEST_STARTED', _this.startNetworkProtocolTesting);
|
|
62
|
+
_this.networkTestingFSM.addTransition('UDP_TEST_COMPLETE', 'UDP_TEST_STARTED', null, 'UDP_TEST_COMPLETED', _this.udpCompletedCallback);
|
|
63
|
+
_this.networkTestingFSM.addTransition('TCP_TEST_STARTING', 'UDP_TEST_COMPLETED', null, 'TCP_TEST_STARTED', null);
|
|
64
|
+
_this.networkTestingFSM.addTransition('TCP_TEST_COMPLETE', 'TCP_TEST_STARTED', null, 'TCP_TEST_COMPLETED', _this.tcpCompletedCallback);
|
|
65
|
+
_this.networkTestingFSM.addTransition('IPV6_TEST_STARTING', 'TCP_TEST_COMPLETED', null, 'IPV6_TEST_STARTED', null);
|
|
66
|
+
_this.networkTestingFSM.addTransition('IPV6_TEST_COMPLETE', 'IPV6_TEST_STARTED', null, 'IPV6_TEST_COMPLETED', _this.ipv6CompletedCallback);
|
|
67
|
+
_this.networkTestingFSM.addTransition('HOST_CON_TEST_STARTING', 'IPV6_TEST_COMPLETED', null, 'HOST_CON_TEST_STARTED', null);
|
|
68
|
+
_this.networkTestingFSM.addTransition('HOST_CON_TEST_COMPLETE', 'HOST_CON_TEST_STARTED', null, 'HOST_CON_TEST_COMPLETED', _this.hostCandidateCompletedCallback);
|
|
69
|
+
_this.networkTestingFSM.addTransition('REFLEX_CON_TEST_STARTING', 'HOST_CON_TEST_COMPLETED', null, 'REFLEX_CON_TEST_STARTED', null);
|
|
70
|
+
_this.networkTestingFSM.addTransition('REFLEX_CON_TEST_COMPLETE', 'REFLEX_CON_TEST_STARTED', null, 'REFLEX_CON_TEST_COMPLETED', _this.reflexCandidateCompletedCallback);
|
|
71
|
+
};
|
|
72
|
+
this.startNetworkProtocolTesting = function () {
|
|
73
|
+
Callback_1.ameyoWebRTCTroubleshooter.startNetworkProtocolTest();
|
|
74
|
+
};
|
|
75
|
+
this.startWebsocketTesting = function () {
|
|
76
|
+
Callback_1.ameyoWebRTCTroubleshooter.startWsTesting();
|
|
77
|
+
};
|
|
78
|
+
this.wsPassCallback = function () {
|
|
79
|
+
_this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
80
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.wsConTestSuccessEvent();
|
|
81
|
+
};
|
|
82
|
+
this.wsFailCallback = function () {
|
|
83
|
+
_this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
84
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.wsConTestFailedEvent();
|
|
85
|
+
};
|
|
86
|
+
this.wsTestDoneCallback = function () {
|
|
87
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.wsConTestDoneEvent();
|
|
88
|
+
};
|
|
89
|
+
this.userRegPassCallback = function () {
|
|
90
|
+
_this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
91
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.userRegTestSuccessEvent();
|
|
92
|
+
};
|
|
93
|
+
this.userRegFailCallback = function () {
|
|
94
|
+
_this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
95
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.userRegTestFailedEvent();
|
|
96
|
+
};
|
|
97
|
+
this.userRegDoneCallback = function () {
|
|
98
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.userRegTestDoneEvent();
|
|
99
|
+
_this.networkTestingFSM.sendEvent('UDP_TEST_STARTING', null);
|
|
100
|
+
};
|
|
101
|
+
this.udpCompletedCallback = function () {
|
|
102
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.udpTestCompletedEvent();
|
|
103
|
+
};
|
|
104
|
+
this.tcpCompletedCallback = function () {
|
|
105
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.tcpTestCompletedEvent();
|
|
106
|
+
};
|
|
107
|
+
this.ipv6CompletedCallback = function () {
|
|
108
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.ipv6TestCompletedEvent();
|
|
109
|
+
};
|
|
110
|
+
this.hostCandidateCompletedCallback = function () {
|
|
111
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.hostCandidateTestCompletedEvent();
|
|
112
|
+
};
|
|
113
|
+
this.reflexCandidateCompletedCallback = function () {
|
|
114
|
+
DiagnosticsListener_1.webrtcTroubleshooterEventBus.reflexCandidateTestCompletedEvent();
|
|
115
|
+
};
|
|
116
|
+
this.sendDeviceTestingEventForFSM = function (event) {
|
|
117
|
+
_this.deviceTestingFSM.sendEvent(event.toUpperCase(), null);
|
|
118
|
+
};
|
|
119
|
+
this.sendNetworkTestingEventForFSM = function (event) {
|
|
120
|
+
_this.networkTestingFSM.sendEvent(event.toUpperCase(), null);
|
|
121
|
+
};
|
|
122
|
+
this.addDeviceTestingFSMTransitions();
|
|
123
|
+
this.addNetworkTestingFSMTransitions();
|
|
124
|
+
window.deviceTestingFSM = this.deviceTestingFSM;
|
|
125
|
+
window.networkTestingFSM = this.networkTestingFSM;
|
|
126
|
+
window.sendDeviceTestingEvent = this.sendDeviceTestingEventForFSM;
|
|
127
|
+
window.sendNetworkTestingEvent = this.sendNetworkTestingEventForFSM;
|
|
128
|
+
}
|
|
129
|
+
AmeyoWebrtcTroubleshooterFSM.prototype.restFSM = function () {
|
|
130
|
+
if (this.deviceTestingFSM.currentState === 'SPEAKER_TEST_PASSED' || this.deviceTestingFSM.currentState === 'SPEAKER_TEST_STARTED')
|
|
131
|
+
Callback_1.ameyoWebRTCTroubleshooter.stopSpeakerTesttone();
|
|
132
|
+
this.deviceTestingFSM = new window.FSM("INITIAL_STATE", { name: "Device testing FSM" });
|
|
133
|
+
this.networkTestingFSM = new window.FSM("INITIAL_STATE", { name: "Network testing FSM" });
|
|
134
|
+
this.addDeviceTestingFSMTransitions();
|
|
135
|
+
this.addNetworkTestingFSMTransitions();
|
|
136
|
+
window.deviceTestingFSM = this.deviceTestingFSM;
|
|
137
|
+
window.networkTestingFSM = this.networkTestingFSM;
|
|
138
|
+
};
|
|
139
|
+
return AmeyoWebrtcTroubleshooterFSM;
|
|
140
|
+
}());
|
|
141
|
+
var ameyoWebrtcTroubleshooterFSMInstance = new AmeyoWebrtcTroubleshooterFSM();
|
|
142
|
+
exports["default"] = ameyoWebrtcTroubleshooterFSMInstance;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import {webrtcTroubleshooterEventBus} from './DiagnosticsListener';
|
|
2
|
+
import {ameyoWebRTCTroubleshooter} from '../../listeners/Callback';
|
|
3
|
+
|
|
4
|
+
declare global {
|
|
5
|
+
interface Window {
|
|
6
|
+
FSM:any
|
|
7
|
+
deviceTestingFSM:any
|
|
8
|
+
networkTestingFSM:any
|
|
9
|
+
startMicTest:any
|
|
10
|
+
startSpeakerTest:any
|
|
11
|
+
sendDeviceTestingEvent:any
|
|
12
|
+
sendNetworkTestingEvent:any
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class AmeyoWebrtcTroubleshooterFSM {
|
|
17
|
+
|
|
18
|
+
constructor(){
|
|
19
|
+
this.addDeviceTestingFSMTransitions();
|
|
20
|
+
this.addNetworkTestingFSMTransitions();
|
|
21
|
+
window.deviceTestingFSM = this.deviceTestingFSM;
|
|
22
|
+
window.networkTestingFSM = this.networkTestingFSM;
|
|
23
|
+
window.sendDeviceTestingEvent = this.sendDeviceTestingEventForFSM;
|
|
24
|
+
window.sendNetworkTestingEvent = this.sendNetworkTestingEventForFSM;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
deviceTestingFSM:any = new window.FSM("INITIAL_STATE", { name: "Device testing FSM" });
|
|
28
|
+
networkTestingFSM:any = new window.FSM("INITIAL_STATE", { name: "Network testing FSM" });
|
|
29
|
+
|
|
30
|
+
addDeviceTestingFSMTransitions=()=>{
|
|
31
|
+
this.deviceTestingFSM.addTransition(
|
|
32
|
+
'MICROPHONE_TEST_STARTING',
|
|
33
|
+
'INITIAL_STATE',
|
|
34
|
+
null,
|
|
35
|
+
'MICROPHONE_TEST_STARTED',
|
|
36
|
+
this.startMicTest
|
|
37
|
+
);
|
|
38
|
+
this.deviceTestingFSM.addTransition(
|
|
39
|
+
'MICROPHONE_TEST_PASS',
|
|
40
|
+
'MICROPHONE_TEST_STARTED',
|
|
41
|
+
null,
|
|
42
|
+
'MICROPHONE_TEST_PASSED',
|
|
43
|
+
this.microphoneSuccessCallback
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
this.deviceTestingFSM.addTransition(
|
|
48
|
+
'MICROPHONE_TEST_FAIL',
|
|
49
|
+
'MICROPHONE_TEST_STARTED',
|
|
50
|
+
null,
|
|
51
|
+
'MICROPHONE_TEST_FAILED',
|
|
52
|
+
this.microphoneFailureCallback
|
|
53
|
+
);
|
|
54
|
+
this.deviceTestingFSM.addTransition(
|
|
55
|
+
'PROCEED',
|
|
56
|
+
'MICROPHONE_TEST_PASSED',
|
|
57
|
+
null,
|
|
58
|
+
'MICROPHONE_TEST_DONE',
|
|
59
|
+
this.microphoneTestDoneCallback
|
|
60
|
+
);
|
|
61
|
+
this.deviceTestingFSM.addTransition(
|
|
62
|
+
'PROCEED',
|
|
63
|
+
'MICROPHONE_TEST_FAILED',
|
|
64
|
+
null,
|
|
65
|
+
'MICROPHONE_TEST_DONE',
|
|
66
|
+
this.microphoneTestDoneCallback
|
|
67
|
+
);
|
|
68
|
+
this.deviceTestingFSM.addTransition(
|
|
69
|
+
'SPEAKER_TEST_STARTNG',
|
|
70
|
+
'MICROPHONE_TEST_DONE',
|
|
71
|
+
null,
|
|
72
|
+
'SPEAKER_TEST_STARTED',
|
|
73
|
+
this.startSpeakerTest
|
|
74
|
+
);
|
|
75
|
+
this.deviceTestingFSM.addTransition(
|
|
76
|
+
'SPEAKER_TEST_PASS',
|
|
77
|
+
'SPEAKER_TEST_STARTED',
|
|
78
|
+
null,
|
|
79
|
+
'SPEAKER_TEST_PASSED',
|
|
80
|
+
this.speakerSuccessCallback
|
|
81
|
+
);
|
|
82
|
+
this.deviceTestingFSM.addTransition(
|
|
83
|
+
'SPEAKER_TEST_FAIL',
|
|
84
|
+
'SPEAKER_TEST_STARTED',
|
|
85
|
+
null,
|
|
86
|
+
'SPEAKER_TEST_FAILED',
|
|
87
|
+
this.speakerFailureCallback
|
|
88
|
+
);
|
|
89
|
+
this.deviceTestingFSM.addTransition(
|
|
90
|
+
'PROCEED',
|
|
91
|
+
'SPEAKER_TEST_PASSED',
|
|
92
|
+
null,
|
|
93
|
+
'SPEAKER_TEST_DONE',
|
|
94
|
+
this.speakerTestDoneCallback
|
|
95
|
+
);
|
|
96
|
+
this.deviceTestingFSM.addTransition(
|
|
97
|
+
'PROCEED',
|
|
98
|
+
'SPEAKER_TEST_FAILED',
|
|
99
|
+
null,
|
|
100
|
+
'SPEAKER_TEST_DONE',
|
|
101
|
+
this.speakerTestDoneCallback
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
startMicTest =()=>{
|
|
106
|
+
ameyoWebRTCTroubleshooter.startMicTest();
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
startSpeakerTest=()=>{
|
|
110
|
+
ameyoWebRTCTroubleshooter.startSpeakerTest();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
microphoneSuccessCallback=()=>{
|
|
114
|
+
this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
115
|
+
webrtcTroubleshooterEventBus.microphoneTestSuccessEvent();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
microphoneFailureCallback=()=>{
|
|
119
|
+
this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
120
|
+
webrtcTroubleshooterEventBus.microphoneTestFailedEvent();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
microphoneTestDoneCallback=()=>{
|
|
124
|
+
webrtcTroubleshooterEventBus.microphoneTestDoneEvent();
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
speakerSuccessCallback=()=>{
|
|
128
|
+
this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
129
|
+
webrtcTroubleshooterEventBus.speakerTestSuccessEvent();
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
speakerFailureCallback=()=>{
|
|
133
|
+
this.deviceTestingFSM.sendEvent('PROCEED', null);
|
|
134
|
+
webrtcTroubleshooterEventBus.speakerTestFailedEvent();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
speakerTestDoneCallback=()=>{
|
|
138
|
+
webrtcTroubleshooterEventBus.speakerTestDoneEvent();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
addNetworkTestingFSMTransitions=()=>{
|
|
142
|
+
|
|
143
|
+
this.networkTestingFSM.addTransition(
|
|
144
|
+
'WS_TEST_STARTING',
|
|
145
|
+
'INITIAL_STATE',
|
|
146
|
+
null,
|
|
147
|
+
'WS_TEST_STARTED',
|
|
148
|
+
this.startWebsocketTesting
|
|
149
|
+
);
|
|
150
|
+
this.networkTestingFSM.addTransition(
|
|
151
|
+
'WS_TEST_PASS',
|
|
152
|
+
'WS_TEST_STARTED',
|
|
153
|
+
null,
|
|
154
|
+
'WS_TEST_PASSED',
|
|
155
|
+
this.wsPassCallback
|
|
156
|
+
);
|
|
157
|
+
this.networkTestingFSM.addTransition(
|
|
158
|
+
'WS_TEST_FAIL',
|
|
159
|
+
'WS_TEST_STARTED',
|
|
160
|
+
null,
|
|
161
|
+
'WS_TEST_FAILED',
|
|
162
|
+
this.wsFailCallback
|
|
163
|
+
);
|
|
164
|
+
this.networkTestingFSM.addTransition(
|
|
165
|
+
'PROCEED',
|
|
166
|
+
'WS_TEST_PASSED',
|
|
167
|
+
null,
|
|
168
|
+
'WS_TEST_DONE',
|
|
169
|
+
this.wsTestDoneCallback
|
|
170
|
+
);
|
|
171
|
+
this.networkTestingFSM.addTransition(
|
|
172
|
+
'PROCEED',
|
|
173
|
+
'WS_TEST_FAILED',
|
|
174
|
+
null,
|
|
175
|
+
'WS_TEST_DONE',
|
|
176
|
+
this.wsTestDoneCallback
|
|
177
|
+
);
|
|
178
|
+
this.networkTestingFSM.addTransition(
|
|
179
|
+
'USER_REG_TEST_STARTING',
|
|
180
|
+
'WS_TEST_DONE',
|
|
181
|
+
null,
|
|
182
|
+
'USER_REG_TEST_STARTED',
|
|
183
|
+
null
|
|
184
|
+
);
|
|
185
|
+
this.networkTestingFSM.addTransition(
|
|
186
|
+
'USER_REG_TEST_PASS',
|
|
187
|
+
'USER_REG_TEST_STARTED',
|
|
188
|
+
null,
|
|
189
|
+
'USER_REG_TEST_PASSED',
|
|
190
|
+
this.userRegPassCallback
|
|
191
|
+
);
|
|
192
|
+
this.networkTestingFSM.addTransition(
|
|
193
|
+
'USER_REG_TEST_FAIL',
|
|
194
|
+
'USER_REG_TEST_STARTED',
|
|
195
|
+
null,
|
|
196
|
+
'USER_REG_TEST_FAILED',
|
|
197
|
+
this.userRegFailCallback
|
|
198
|
+
);
|
|
199
|
+
this.networkTestingFSM.addTransition(
|
|
200
|
+
'PROCEED',
|
|
201
|
+
'USER_REG_TEST_PASSED',
|
|
202
|
+
null,
|
|
203
|
+
'USER_REG_TEST_DONE',
|
|
204
|
+
this.userRegDoneCallback
|
|
205
|
+
);
|
|
206
|
+
this.networkTestingFSM.addTransition(
|
|
207
|
+
'PROCEED',
|
|
208
|
+
'USER_REG_TEST_FAILED',
|
|
209
|
+
null,
|
|
210
|
+
'USER_REG_TEST_DONE',
|
|
211
|
+
this.userRegDoneCallback
|
|
212
|
+
);
|
|
213
|
+
this.networkTestingFSM.addTransition(
|
|
214
|
+
'UDP_TEST_STARTING',
|
|
215
|
+
'USER_REG_TEST_DONE',
|
|
216
|
+
null,
|
|
217
|
+
'UDP_TEST_STARTED',
|
|
218
|
+
this.startNetworkProtocolTesting
|
|
219
|
+
);
|
|
220
|
+
this.networkTestingFSM.addTransition(
|
|
221
|
+
'UDP_TEST_COMPLETE',
|
|
222
|
+
'UDP_TEST_STARTED',
|
|
223
|
+
null,
|
|
224
|
+
'UDP_TEST_COMPLETED',
|
|
225
|
+
this.udpCompletedCallback
|
|
226
|
+
);
|
|
227
|
+
this.networkTestingFSM.addTransition(
|
|
228
|
+
'TCP_TEST_STARTING',
|
|
229
|
+
'UDP_TEST_COMPLETED',
|
|
230
|
+
null,
|
|
231
|
+
'TCP_TEST_STARTED',
|
|
232
|
+
null
|
|
233
|
+
);
|
|
234
|
+
this.networkTestingFSM.addTransition(
|
|
235
|
+
'TCP_TEST_COMPLETE',
|
|
236
|
+
'TCP_TEST_STARTED',
|
|
237
|
+
null,
|
|
238
|
+
'TCP_TEST_COMPLETED',
|
|
239
|
+
this.tcpCompletedCallback
|
|
240
|
+
);
|
|
241
|
+
this.networkTestingFSM.addTransition(
|
|
242
|
+
'IPV6_TEST_STARTING',
|
|
243
|
+
'TCP_TEST_COMPLETED',
|
|
244
|
+
null,
|
|
245
|
+
'IPV6_TEST_STARTED',
|
|
246
|
+
null
|
|
247
|
+
);
|
|
248
|
+
this.networkTestingFSM.addTransition(
|
|
249
|
+
'IPV6_TEST_COMPLETE',
|
|
250
|
+
'IPV6_TEST_STARTED',
|
|
251
|
+
null,
|
|
252
|
+
'IPV6_TEST_COMPLETED',
|
|
253
|
+
this.ipv6CompletedCallback
|
|
254
|
+
);
|
|
255
|
+
this.networkTestingFSM.addTransition(
|
|
256
|
+
'HOST_CON_TEST_STARTING',
|
|
257
|
+
'IPV6_TEST_COMPLETED',
|
|
258
|
+
null,
|
|
259
|
+
'HOST_CON_TEST_STARTED',
|
|
260
|
+
null
|
|
261
|
+
);
|
|
262
|
+
this.networkTestingFSM.addTransition(
|
|
263
|
+
'HOST_CON_TEST_COMPLETE',
|
|
264
|
+
'HOST_CON_TEST_STARTED',
|
|
265
|
+
null,
|
|
266
|
+
'HOST_CON_TEST_COMPLETED',
|
|
267
|
+
this.hostCandidateCompletedCallback
|
|
268
|
+
);
|
|
269
|
+
this.networkTestingFSM.addTransition(
|
|
270
|
+
'REFLEX_CON_TEST_STARTING',
|
|
271
|
+
'HOST_CON_TEST_COMPLETED',
|
|
272
|
+
null,
|
|
273
|
+
'REFLEX_CON_TEST_STARTED',
|
|
274
|
+
null
|
|
275
|
+
);
|
|
276
|
+
this.networkTestingFSM.addTransition(
|
|
277
|
+
'REFLEX_CON_TEST_COMPLETE',
|
|
278
|
+
'REFLEX_CON_TEST_STARTED',
|
|
279
|
+
null,
|
|
280
|
+
'REFLEX_CON_TEST_COMPLETED',
|
|
281
|
+
this.reflexCandidateCompletedCallback
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
startNetworkProtocolTesting=()=>{
|
|
289
|
+
ameyoWebRTCTroubleshooter.startNetworkProtocolTest();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
startWebsocketTesting=()=>{
|
|
293
|
+
ameyoWebRTCTroubleshooter.startWsTesting();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
wsPassCallback=()=>{
|
|
297
|
+
this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
298
|
+
webrtcTroubleshooterEventBus.wsConTestSuccessEvent();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
wsFailCallback=()=>{
|
|
302
|
+
this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
303
|
+
webrtcTroubleshooterEventBus.wsConTestFailedEvent();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
wsTestDoneCallback=()=>{
|
|
307
|
+
webrtcTroubleshooterEventBus.wsConTestDoneEvent();
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
userRegPassCallback=()=>{
|
|
311
|
+
this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
312
|
+
webrtcTroubleshooterEventBus.userRegTestSuccessEvent();
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
userRegFailCallback=()=>{
|
|
316
|
+
this.networkTestingFSM.sendEvent('PROCEED', null);
|
|
317
|
+
webrtcTroubleshooterEventBus.userRegTestFailedEvent();
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
userRegDoneCallback=()=>{
|
|
321
|
+
webrtcTroubleshooterEventBus.userRegTestDoneEvent();
|
|
322
|
+
this.networkTestingFSM.sendEvent('UDP_TEST_STARTING',null);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
udpCompletedCallback=()=>{
|
|
326
|
+
webrtcTroubleshooterEventBus.udpTestCompletedEvent();
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
tcpCompletedCallback=()=>{
|
|
330
|
+
webrtcTroubleshooterEventBus.tcpTestCompletedEvent();
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
ipv6CompletedCallback=()=>{
|
|
334
|
+
webrtcTroubleshooterEventBus.ipv6TestCompletedEvent();
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
hostCandidateCompletedCallback=()=>{
|
|
338
|
+
webrtcTroubleshooterEventBus.hostCandidateTestCompletedEvent();
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
reflexCandidateCompletedCallback=()=>{
|
|
342
|
+
webrtcTroubleshooterEventBus.reflexCandidateTestCompletedEvent();
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
sendDeviceTestingEventForFSM=(event:string)=> {
|
|
348
|
+
this.deviceTestingFSM.sendEvent(event.toUpperCase(), null);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
sendNetworkTestingEventForFSM=(event:string)=> {
|
|
352
|
+
this.networkTestingFSM.sendEvent(event.toUpperCase(), null);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
restFSM(){
|
|
359
|
+
if(this.deviceTestingFSM.currentState === 'SPEAKER_TEST_PASSED' || this.deviceTestingFSM.currentState === 'SPEAKER_TEST_STARTED')
|
|
360
|
+
ameyoWebRTCTroubleshooter.stopSpeakerTesttone();
|
|
361
|
+
|
|
362
|
+
this.deviceTestingFSM = new window.FSM("INITIAL_STATE", { name: "Device testing FSM" });
|
|
363
|
+
this.networkTestingFSM = new window.FSM("INITIAL_STATE", { name: "Network testing FSM" });
|
|
364
|
+
this.addDeviceTestingFSMTransitions();
|
|
365
|
+
this.addNetworkTestingFSMTransitions();
|
|
366
|
+
window.deviceTestingFSM = this.deviceTestingFSM;
|
|
367
|
+
window.networkTestingFSM = this.networkTestingFSM;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
const ameyoWebrtcTroubleshooterFSMInstance= new AmeyoWebrtcTroubleshooterFSM();
|
|
373
|
+
|
|
374
|
+
export default ameyoWebrtcTroubleshooterFSMInstance;
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { diagnosticsCallback } from '../../listeners/Callback';
|
|
2
|
+
import {ameyoWebRTCTroubleshooter} from './Diagnostics';
|
|
3
|
+
import { webrtcLogger } from "./WebrtcLogger"
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var logger = webrtcLogger()
|
|
7
|
+
export function initDiagnostics(setDiagnosticsReportCallback, keyValueSetCallback) {
|
|
8
|
+
if (!keyValueSetCallback || !setDiagnosticsReportCallback) {
|
|
9
|
+
logger.log("Callbacks are not set")
|
|
10
|
+
return
|
|
11
|
+
}
|
|
12
|
+
diagnosticsCallback.setKeyValueCallback(keyValueSetCallback);
|
|
13
|
+
diagnosticsCallback.setDiagnosticsReportCallback(setDiagnosticsReportCallback);
|
|
14
|
+
let version = ameyoWebRTCTroubleshooter.getBrowserData();
|
|
15
|
+
diagnosticsCallback.keyValueSetCallback('browserVersion','ready', version)
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function closeDiagnostics() {
|
|
20
|
+
diagnosticsCallback.setKeyValueCallback(null);
|
|
21
|
+
diagnosticsCallback.setDiagnosticsReportCallback(null);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function startSpeakerDiagnosticsTest() {
|
|
26
|
+
/**
|
|
27
|
+
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
28
|
+
*/
|
|
29
|
+
logger.log("Request to startSpeakerTest:\n") ;
|
|
30
|
+
ameyoWebRTCTroubleshooter.startSpeakerTest()
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function stopSpeakerDiagnosticsTest(speakerTestResponse) {
|
|
35
|
+
/**
|
|
36
|
+
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
logger.log("Request to stopSpeakerTest - Suuccessful Test:\n") ;
|
|
40
|
+
if (speakerTestResponse == 'yes') {
|
|
41
|
+
ameyoWebRTCTroubleshooter.stopSpeakerTesttoneWithSuccess()
|
|
42
|
+
} else if (speakerTestResponse == 'no') {
|
|
43
|
+
ameyoWebRTCTroubleshooter.stopSpeakerTesttoneWithFailure()
|
|
44
|
+
} else {
|
|
45
|
+
ameyoWebRTCTroubleshooter.stopSpeakerTest()
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function startMicDiagnosticsTest() {
|
|
51
|
+
/**
|
|
52
|
+
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
53
|
+
*/
|
|
54
|
+
logger.log("Request to startMicTest:\n") ;
|
|
55
|
+
ameyoWebRTCTroubleshooter.startMicTest()
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function stopMicDiagnosticsTest(micTestResponse) {
|
|
60
|
+
/**
|
|
61
|
+
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
62
|
+
*/
|
|
63
|
+
logger.log("Request to stopMicTest - Successful Test:\n") ;
|
|
64
|
+
if (micTestResponse == 'yes') {
|
|
65
|
+
ameyoWebRTCTroubleshooter.stopMicTestSuccess()
|
|
66
|
+
} else if (micTestResponse == 'no') {
|
|
67
|
+
ameyoWebRTCTroubleshooter.stopMicTestFailure()
|
|
68
|
+
} else {
|
|
69
|
+
ameyoWebRTCTroubleshooter.stopMicTest()
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Function to troubleshoot the environment
|
|
76
|
+
*/
|
|
77
|
+
export function startNetworkDiagnostics() {
|
|
78
|
+
/**
|
|
79
|
+
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
80
|
+
*/
|
|
81
|
+
logger.log("Request to start network diagnostics:\n") ;
|
|
82
|
+
ameyoWebRTCTroubleshooter.startWSAndUserRegistrationTest();
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Function to troubleshoot the environment
|
|
88
|
+
*/
|
|
89
|
+
export function stopNetworkDiagnostics() {
|
|
90
|
+
/**
|
|
91
|
+
* When user registers the agent phone for the first time, register your callback onto webrtc client
|
|
92
|
+
*/
|
|
93
|
+
logger.log("Request to stop network diagnostics:\n") ;
|
|
94
|
+
return;
|
|
95
|
+
}
|