@wazo/sdk 0.38.2 → 0.38.5
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/README.md +57 -10
- package/dist/wazo-sdk.js +5 -5
- package/esm/__tests__/web-rtc-client.test.js +8 -0
- package/esm/checker/Checker.js +8 -0
- package/esm/checker/checks/index.js +8 -0
- package/esm/checker/checks/webrtc-transport.js +8 -0
- package/esm/checker/checks/webrtc.js +8 -0
- package/esm/domain/__tests__/Line.test.js +5 -5
- package/esm/index.js +48 -11
- package/esm/lib/WazoSessionDescriptionHandler.js +8 -0
- package/esm/simple/Auth.js +48 -11
- package/esm/simple/Configuration.js +48 -11
- package/esm/simple/Phone.js +48 -11
- package/esm/simple/Softphone.js +40 -11
- package/esm/simple/index.js +48 -11
- package/esm/simple/room/LocalParticipant.js +48 -11
- package/esm/simple/room/Participant.js +48 -11
- package/esm/simple/room/RemoteParticipant.js +48 -11
- package/esm/simple/room/Room.js +48 -11
- package/esm/simple/room/SipRoom.js +48 -11
- package/esm/simple/room/Stream.js +48 -11
- package/esm/simple/room/__tests__/RemoteParticipant.test.js +48 -11
- package/esm/simple/utils.js +48 -11
- package/esm/web-rtc-client.js +8 -0
- package/lib/__tests__/web-rtc-client.test.js +8 -0
- package/lib/checker/Checker.js +8 -0
- package/lib/checker/checks/index.js +8 -0
- package/lib/checker/checks/webrtc-transport.js +8 -0
- package/lib/checker/checks/webrtc.js +8 -0
- package/lib/domain/__tests__/Line.test.js +5 -5
- package/lib/index.js +48 -11
- package/lib/lib/WazoSessionDescriptionHandler.js +8 -0
- package/lib/simple/Auth.js +48 -11
- package/lib/simple/Configuration.js +48 -11
- package/lib/simple/Phone.js +48 -11
- package/lib/simple/Softphone.js +40 -11
- package/lib/simple/index.js +48 -11
- package/lib/simple/room/LocalParticipant.js +48 -11
- package/lib/simple/room/Participant.js +48 -11
- package/lib/simple/room/RemoteParticipant.js +48 -11
- package/lib/simple/room/Room.js +48 -11
- package/lib/simple/room/SipRoom.js +48 -11
- package/lib/simple/room/Stream.js +48 -11
- package/lib/simple/room/__tests__/RemoteParticipant.test.js +48 -11
- package/lib/simple/utils.js +48 -11
- package/lib/web-rtc-client.js +8 -0
- package/package.json +1 -1
- package/src/domain/__tests__/Line.test.js +5 -5
- package/src/lib/WazoSessionDescriptionHandler.js +8 -0
- package/src/simple/Softphone.js +40 -11
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ describe('Line domain', () => {
|
|
|
11
11
|
username: 'ipcor1pj',
|
|
12
12
|
links: [
|
|
13
13
|
{
|
|
14
|
-
href: 'https://stack.
|
|
14
|
+
href: 'https://stack.example.com/api/confd/1.1/endpoints/sip/19',
|
|
15
15
|
rel: 'endpoint_sip',
|
|
16
16
|
},
|
|
17
17
|
],
|
|
@@ -25,7 +25,7 @@ describe('Line domain', () => {
|
|
|
25
25
|
context: 'default',
|
|
26
26
|
links: [
|
|
27
27
|
{
|
|
28
|
-
href: 'https://stack.
|
|
28
|
+
href: 'https://stack.example.com/api/confd/1.1/extensions/59',
|
|
29
29
|
rel: 'extensions',
|
|
30
30
|
},
|
|
31
31
|
],
|
|
@@ -33,7 +33,7 @@ describe('Line domain', () => {
|
|
|
33
33
|
],
|
|
34
34
|
links: [
|
|
35
35
|
{
|
|
36
|
-
href: 'https://stack.
|
|
36
|
+
href: 'https://stack.example.com/api/confd/1.1/lines/8',
|
|
37
37
|
rel: 'lines',
|
|
38
38
|
},
|
|
39
39
|
],
|
|
@@ -51,7 +51,7 @@ describe('Line domain', () => {
|
|
|
51
51
|
context: 'default',
|
|
52
52
|
links: [
|
|
53
53
|
{
|
|
54
|
-
href: 'https://stack.
|
|
54
|
+
href: 'https://stack.example.com/api/confd/1.1/extensions/59',
|
|
55
55
|
rel: 'extensions',
|
|
56
56
|
},
|
|
57
57
|
],
|
|
@@ -61,7 +61,7 @@ describe('Line domain', () => {
|
|
|
61
61
|
id: 19,
|
|
62
62
|
links: [
|
|
63
63
|
{
|
|
64
|
-
href: 'https://stack.
|
|
64
|
+
href: 'https://stack.example.com/api/confd/1.1/endpoints/sip/19',
|
|
65
65
|
rel: 'endpoint_sip',
|
|
66
66
|
},
|
|
67
67
|
],
|
|
@@ -110,6 +110,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
110
110
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
111
111
|
if (event.candidate) {
|
|
112
112
|
this.gatheredCandidates.push(parseCandidate(event.candidate.candidate));
|
|
113
|
+
|
|
114
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
115
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
116
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
117
|
+
ice: event.candidate.candidate,
|
|
118
|
+
});
|
|
119
|
+
this.iceGatheringComplete();
|
|
120
|
+
}
|
|
113
121
|
}
|
|
114
122
|
};
|
|
115
123
|
|
package/src/simple/Softphone.js
CHANGED
|
@@ -14,7 +14,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
14
14
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
15
15
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
16
16
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
17
|
-
const
|
|
17
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
18
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
19
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
18
20
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
19
21
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
20
22
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -31,12 +33,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
31
33
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
32
34
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
33
35
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
36
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
34
37
|
|
|
35
38
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
36
39
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
37
40
|
|
|
38
41
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
39
|
-
const
|
|
42
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
40
43
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
41
44
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
42
45
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -56,10 +59,13 @@ class Softphone {
|
|
|
56
59
|
onLinkEnabled(link: Object) {}
|
|
57
60
|
onIFrameLoaded() {}
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
onCallLocallyAnswered(call: Object) {}
|
|
63
|
+
onCallEstablished(call: Object) {}
|
|
64
|
+
onOutgoingCallMade(call: Object) {}
|
|
61
65
|
onCallIncoming(call: Object) {}
|
|
66
|
+
onCallRejected(call: Object) {}
|
|
62
67
|
onCallEnded(call: Object, card: Object, direction: string, fromExtension: string) {}
|
|
68
|
+
|
|
63
69
|
onCardSaved(card: Object) {}
|
|
64
70
|
onCardCanceled() {}
|
|
65
71
|
onAuthenticated(session: Object) {}
|
|
@@ -91,7 +97,18 @@ class Softphone {
|
|
|
91
97
|
onStopRecording() {}
|
|
92
98
|
onUnHandledEvent(event: Object) {}
|
|
93
99
|
|
|
94
|
-
init({
|
|
100
|
+
init({
|
|
101
|
+
url,
|
|
102
|
+
width,
|
|
103
|
+
height,
|
|
104
|
+
server,
|
|
105
|
+
port,
|
|
106
|
+
language,
|
|
107
|
+
wrapUpDuration,
|
|
108
|
+
enableAgent = true,
|
|
109
|
+
tenantId,
|
|
110
|
+
debug = false,
|
|
111
|
+
}: Object = {}) {
|
|
95
112
|
this.url = url || 'https://softphone.wazo.io';
|
|
96
113
|
this.width = width || 500;
|
|
97
114
|
this.height = height || 600;
|
|
@@ -103,8 +120,7 @@ class Softphone {
|
|
|
103
120
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
104
121
|
|
|
105
122
|
if (!server) {
|
|
106
|
-
|
|
107
|
-
server = 'stack.dev.wazo.io';
|
|
123
|
+
throw new Error('`server` is not set');
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
const config: Object = { server };
|
|
@@ -114,6 +130,9 @@ class Softphone {
|
|
|
114
130
|
if (port) {
|
|
115
131
|
config.port = port;
|
|
116
132
|
}
|
|
133
|
+
if (tenantId) {
|
|
134
|
+
config.tenantId = tenantId;
|
|
135
|
+
}
|
|
117
136
|
if (wrapUpDuration) {
|
|
118
137
|
config.wrapUpDuration = wrapUpDuration;
|
|
119
138
|
}
|
|
@@ -124,6 +143,10 @@ class Softphone {
|
|
|
124
143
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
125
144
|
}
|
|
126
145
|
|
|
146
|
+
if (debug) {
|
|
147
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
148
|
+
}
|
|
149
|
+
|
|
127
150
|
this._createIframe(() => {
|
|
128
151
|
this.iframeLoaded = true;
|
|
129
152
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -244,8 +267,8 @@ class Softphone {
|
|
|
244
267
|
}
|
|
245
268
|
|
|
246
269
|
switch (event.data.type) {
|
|
247
|
-
case
|
|
248
|
-
this.
|
|
270
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
271
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
249
272
|
break;
|
|
250
273
|
case SDK_CALL_ENDED: {
|
|
251
274
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -336,8 +359,14 @@ class Softphone {
|
|
|
336
359
|
case BRIDGE_ON_CARD_CANCELED:
|
|
337
360
|
this.onCardCanceled();
|
|
338
361
|
break;
|
|
339
|
-
case
|
|
340
|
-
this.
|
|
362
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
363
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
364
|
+
break;
|
|
365
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
366
|
+
this.onCallRejected(event.data.call);
|
|
367
|
+
break;
|
|
368
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
369
|
+
this.onCallEstablished(event.data.call);
|
|
341
370
|
break;
|
|
342
371
|
default:
|
|
343
372
|
this.onUnHandledEvent(event);
|