@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/esm/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 ) {}
|
|
57
60
|
onIFrameLoaded() {}
|
|
58
61
|
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
onCallLocallyAnswered(call ) {}
|
|
63
|
+
onCallEstablished(call ) {}
|
|
64
|
+
onOutgoingCallMade(call ) {}
|
|
61
65
|
onCallIncoming(call ) {}
|
|
66
|
+
onCallRejected(call ) {}
|
|
62
67
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
68
|
+
|
|
63
69
|
onCardSaved(card ) {}
|
|
64
70
|
onCardCanceled() {}
|
|
65
71
|
onAuthenticated(session ) {}
|
|
@@ -91,7 +97,18 @@ class Softphone {
|
|
|
91
97
|
onStopRecording() {}
|
|
92
98
|
onUnHandledEvent(event ) {}
|
|
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
|
+
} = {}) {
|
|
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 = { 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);
|
package/esm/simple/index.js
CHANGED
|
@@ -6296,6 +6296,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6296
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6297
|
if (event.candidate) {
|
|
6298
6298
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6299
|
+
|
|
6300
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6301
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6302
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6303
|
+
ice: event.candidate.candidate,
|
|
6304
|
+
});
|
|
6305
|
+
this.iceGatheringComplete();
|
|
6306
|
+
}
|
|
6299
6307
|
}
|
|
6300
6308
|
};
|
|
6301
6309
|
|
|
@@ -13985,7 +13993,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13985
13993
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13986
13994
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13987
13995
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13988
|
-
const
|
|
13996
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13997
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13998
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13989
13999
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13990
14000
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13991
14001
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -14002,12 +14012,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
14002
14012
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
14003
14013
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
14004
14014
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
14015
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
14005
14016
|
|
|
14006
14017
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
14007
14018
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
14008
14019
|
|
|
14009
14020
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
14010
|
-
const
|
|
14021
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
14011
14022
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
14012
14023
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
14013
14024
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -14027,10 +14038,13 @@ class Softphone {
|
|
|
14027
14038
|
onLinkEnabled(link ) {}
|
|
14028
14039
|
onIFrameLoaded() {}
|
|
14029
14040
|
|
|
14030
|
-
|
|
14031
|
-
|
|
14041
|
+
onCallLocallyAnswered(call ) {}
|
|
14042
|
+
onCallEstablished(call ) {}
|
|
14043
|
+
onOutgoingCallMade(call ) {}
|
|
14032
14044
|
onCallIncoming(call ) {}
|
|
14045
|
+
onCallRejected(call ) {}
|
|
14033
14046
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14047
|
+
|
|
14034
14048
|
onCardSaved(card ) {}
|
|
14035
14049
|
onCardCanceled() {}
|
|
14036
14050
|
onAuthenticated(session ) {}
|
|
@@ -14062,7 +14076,18 @@ class Softphone {
|
|
|
14062
14076
|
onStopRecording() {}
|
|
14063
14077
|
onUnHandledEvent(event ) {}
|
|
14064
14078
|
|
|
14065
|
-
init({
|
|
14079
|
+
init({
|
|
14080
|
+
url,
|
|
14081
|
+
width,
|
|
14082
|
+
height,
|
|
14083
|
+
server,
|
|
14084
|
+
port,
|
|
14085
|
+
language,
|
|
14086
|
+
wrapUpDuration,
|
|
14087
|
+
enableAgent = true,
|
|
14088
|
+
tenantId,
|
|
14089
|
+
debug = false,
|
|
14090
|
+
} = {}) {
|
|
14066
14091
|
this.url = url || 'https://softphone.wazo.io';
|
|
14067
14092
|
this.width = width || 500;
|
|
14068
14093
|
this.height = height || 600;
|
|
@@ -14074,8 +14099,7 @@ class Softphone {
|
|
|
14074
14099
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14075
14100
|
|
|
14076
14101
|
if (!server) {
|
|
14077
|
-
|
|
14078
|
-
server = 'stack.dev.wazo.io';
|
|
14102
|
+
throw new Error('`server` is not set');
|
|
14079
14103
|
}
|
|
14080
14104
|
|
|
14081
14105
|
const config = { server };
|
|
@@ -14085,6 +14109,9 @@ class Softphone {
|
|
|
14085
14109
|
if (port) {
|
|
14086
14110
|
config.port = port;
|
|
14087
14111
|
}
|
|
14112
|
+
if (tenantId) {
|
|
14113
|
+
config.tenantId = tenantId;
|
|
14114
|
+
}
|
|
14088
14115
|
if (wrapUpDuration) {
|
|
14089
14116
|
config.wrapUpDuration = wrapUpDuration;
|
|
14090
14117
|
}
|
|
@@ -14095,6 +14122,10 @@ class Softphone {
|
|
|
14095
14122
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14096
14123
|
}
|
|
14097
14124
|
|
|
14125
|
+
if (debug) {
|
|
14126
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
14127
|
+
}
|
|
14128
|
+
|
|
14098
14129
|
this._createIframe(() => {
|
|
14099
14130
|
this.iframeLoaded = true;
|
|
14100
14131
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -14215,8 +14246,8 @@ class Softphone {
|
|
|
14215
14246
|
}
|
|
14216
14247
|
|
|
14217
14248
|
switch (event.data.type) {
|
|
14218
|
-
case
|
|
14219
|
-
this.
|
|
14249
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14250
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14220
14251
|
break;
|
|
14221
14252
|
case SDK_CALL_ENDED: {
|
|
14222
14253
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14307,8 +14338,14 @@ class Softphone {
|
|
|
14307
14338
|
case BRIDGE_ON_CARD_CANCELED:
|
|
14308
14339
|
this.onCardCanceled();
|
|
14309
14340
|
break;
|
|
14310
|
-
case
|
|
14311
|
-
this.
|
|
14341
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14342
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14343
|
+
break;
|
|
14344
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14345
|
+
this.onCallRejected(event.data.call);
|
|
14346
|
+
break;
|
|
14347
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14348
|
+
this.onCallEstablished(event.data.call);
|
|
14312
14349
|
break;
|
|
14313
14350
|
default:
|
|
14314
14351
|
this.onUnHandledEvent(event);
|
|
@@ -6296,6 +6296,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6296
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6297
|
if (event.candidate) {
|
|
6298
6298
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6299
|
+
|
|
6300
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6301
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6302
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6303
|
+
ice: event.candidate.candidate,
|
|
6304
|
+
});
|
|
6305
|
+
this.iceGatheringComplete();
|
|
6306
|
+
}
|
|
6299
6307
|
}
|
|
6300
6308
|
};
|
|
6301
6309
|
|
|
@@ -12854,7 +12862,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
12854
12862
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
12855
12863
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
12856
12864
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
12857
|
-
const
|
|
12865
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
12866
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
12867
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
12858
12868
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
12859
12869
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
12860
12870
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -12871,12 +12881,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
12871
12881
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
12872
12882
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
12873
12883
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
12884
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
12874
12885
|
|
|
12875
12886
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
12876
12887
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
12877
12888
|
|
|
12878
12889
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
12879
|
-
const
|
|
12890
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
12880
12891
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
12881
12892
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
12882
12893
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -12896,10 +12907,13 @@ class Softphone {
|
|
|
12896
12907
|
onLinkEnabled(link ) {}
|
|
12897
12908
|
onIFrameLoaded() {}
|
|
12898
12909
|
|
|
12899
|
-
|
|
12900
|
-
|
|
12910
|
+
onCallLocallyAnswered(call ) {}
|
|
12911
|
+
onCallEstablished(call ) {}
|
|
12912
|
+
onOutgoingCallMade(call ) {}
|
|
12901
12913
|
onCallIncoming(call ) {}
|
|
12914
|
+
onCallRejected(call ) {}
|
|
12902
12915
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
12916
|
+
|
|
12903
12917
|
onCardSaved(card ) {}
|
|
12904
12918
|
onCardCanceled() {}
|
|
12905
12919
|
onAuthenticated(session ) {}
|
|
@@ -12931,7 +12945,18 @@ class Softphone {
|
|
|
12931
12945
|
onStopRecording() {}
|
|
12932
12946
|
onUnHandledEvent(event ) {}
|
|
12933
12947
|
|
|
12934
|
-
init({
|
|
12948
|
+
init({
|
|
12949
|
+
url,
|
|
12950
|
+
width,
|
|
12951
|
+
height,
|
|
12952
|
+
server,
|
|
12953
|
+
port,
|
|
12954
|
+
language,
|
|
12955
|
+
wrapUpDuration,
|
|
12956
|
+
enableAgent = true,
|
|
12957
|
+
tenantId,
|
|
12958
|
+
debug = false,
|
|
12959
|
+
} = {}) {
|
|
12935
12960
|
this.url = url || 'https://softphone.wazo.io';
|
|
12936
12961
|
this.width = width || 500;
|
|
12937
12962
|
this.height = height || 600;
|
|
@@ -12943,8 +12968,7 @@ class Softphone {
|
|
|
12943
12968
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
12944
12969
|
|
|
12945
12970
|
if (!server) {
|
|
12946
|
-
|
|
12947
|
-
server = 'stack.dev.wazo.io';
|
|
12971
|
+
throw new Error('`server` is not set');
|
|
12948
12972
|
}
|
|
12949
12973
|
|
|
12950
12974
|
const config = { server };
|
|
@@ -12954,6 +12978,9 @@ class Softphone {
|
|
|
12954
12978
|
if (port) {
|
|
12955
12979
|
config.port = port;
|
|
12956
12980
|
}
|
|
12981
|
+
if (tenantId) {
|
|
12982
|
+
config.tenantId = tenantId;
|
|
12983
|
+
}
|
|
12957
12984
|
if (wrapUpDuration) {
|
|
12958
12985
|
config.wrapUpDuration = wrapUpDuration;
|
|
12959
12986
|
}
|
|
@@ -12964,6 +12991,10 @@ class Softphone {
|
|
|
12964
12991
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
12965
12992
|
}
|
|
12966
12993
|
|
|
12994
|
+
if (debug) {
|
|
12995
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
12996
|
+
}
|
|
12997
|
+
|
|
12967
12998
|
this._createIframe(() => {
|
|
12968
12999
|
this.iframeLoaded = true;
|
|
12969
13000
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -13084,8 +13115,8 @@ class Softphone {
|
|
|
13084
13115
|
}
|
|
13085
13116
|
|
|
13086
13117
|
switch (event.data.type) {
|
|
13087
|
-
case
|
|
13088
|
-
this.
|
|
13118
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13119
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13089
13120
|
break;
|
|
13090
13121
|
case SDK_CALL_ENDED: {
|
|
13091
13122
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13176,8 +13207,14 @@ class Softphone {
|
|
|
13176
13207
|
case BRIDGE_ON_CARD_CANCELED:
|
|
13177
13208
|
this.onCardCanceled();
|
|
13178
13209
|
break;
|
|
13179
|
-
case
|
|
13180
|
-
this.
|
|
13210
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13211
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13212
|
+
break;
|
|
13213
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13214
|
+
this.onCallRejected(event.data.call);
|
|
13215
|
+
break;
|
|
13216
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13217
|
+
this.onCallEstablished(event.data.call);
|
|
13181
13218
|
break;
|
|
13182
13219
|
default:
|
|
13183
13220
|
this.onUnHandledEvent(event);
|
|
@@ -6296,6 +6296,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6296
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6297
|
if (event.candidate) {
|
|
6298
6298
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6299
|
+
|
|
6300
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6301
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6302
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6303
|
+
ice: event.candidate.candidate,
|
|
6304
|
+
});
|
|
6305
|
+
this.iceGatheringComplete();
|
|
6306
|
+
}
|
|
6299
6307
|
}
|
|
6300
6308
|
};
|
|
6301
6309
|
|
|
@@ -12859,7 +12867,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
12859
12867
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
12860
12868
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
12861
12869
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
12862
|
-
const
|
|
12870
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
12871
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
12872
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
12863
12873
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
12864
12874
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
12865
12875
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -12876,12 +12886,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
12876
12886
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
12877
12887
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
12878
12888
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
12889
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
12879
12890
|
|
|
12880
12891
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
12881
12892
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
12882
12893
|
|
|
12883
12894
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
12884
|
-
const
|
|
12895
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
12885
12896
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
12886
12897
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
12887
12898
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -12901,10 +12912,13 @@ class Softphone {
|
|
|
12901
12912
|
onLinkEnabled(link ) {}
|
|
12902
12913
|
onIFrameLoaded() {}
|
|
12903
12914
|
|
|
12904
|
-
|
|
12905
|
-
|
|
12915
|
+
onCallLocallyAnswered(call ) {}
|
|
12916
|
+
onCallEstablished(call ) {}
|
|
12917
|
+
onOutgoingCallMade(call ) {}
|
|
12906
12918
|
onCallIncoming(call ) {}
|
|
12919
|
+
onCallRejected(call ) {}
|
|
12907
12920
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
12921
|
+
|
|
12908
12922
|
onCardSaved(card ) {}
|
|
12909
12923
|
onCardCanceled() {}
|
|
12910
12924
|
onAuthenticated(session ) {}
|
|
@@ -12936,7 +12950,18 @@ class Softphone {
|
|
|
12936
12950
|
onStopRecording() {}
|
|
12937
12951
|
onUnHandledEvent(event ) {}
|
|
12938
12952
|
|
|
12939
|
-
init({
|
|
12953
|
+
init({
|
|
12954
|
+
url,
|
|
12955
|
+
width,
|
|
12956
|
+
height,
|
|
12957
|
+
server,
|
|
12958
|
+
port,
|
|
12959
|
+
language,
|
|
12960
|
+
wrapUpDuration,
|
|
12961
|
+
enableAgent = true,
|
|
12962
|
+
tenantId,
|
|
12963
|
+
debug = false,
|
|
12964
|
+
} = {}) {
|
|
12940
12965
|
this.url = url || 'https://softphone.wazo.io';
|
|
12941
12966
|
this.width = width || 500;
|
|
12942
12967
|
this.height = height || 600;
|
|
@@ -12948,8 +12973,7 @@ class Softphone {
|
|
|
12948
12973
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
12949
12974
|
|
|
12950
12975
|
if (!server) {
|
|
12951
|
-
|
|
12952
|
-
server = 'stack.dev.wazo.io';
|
|
12976
|
+
throw new Error('`server` is not set');
|
|
12953
12977
|
}
|
|
12954
12978
|
|
|
12955
12979
|
const config = { server };
|
|
@@ -12959,6 +12983,9 @@ class Softphone {
|
|
|
12959
12983
|
if (port) {
|
|
12960
12984
|
config.port = port;
|
|
12961
12985
|
}
|
|
12986
|
+
if (tenantId) {
|
|
12987
|
+
config.tenantId = tenantId;
|
|
12988
|
+
}
|
|
12962
12989
|
if (wrapUpDuration) {
|
|
12963
12990
|
config.wrapUpDuration = wrapUpDuration;
|
|
12964
12991
|
}
|
|
@@ -12969,6 +12996,10 @@ class Softphone {
|
|
|
12969
12996
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
12970
12997
|
}
|
|
12971
12998
|
|
|
12999
|
+
if (debug) {
|
|
13000
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13001
|
+
}
|
|
13002
|
+
|
|
12972
13003
|
this._createIframe(() => {
|
|
12973
13004
|
this.iframeLoaded = true;
|
|
12974
13005
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -13089,8 +13120,8 @@ class Softphone {
|
|
|
13089
13120
|
}
|
|
13090
13121
|
|
|
13091
13122
|
switch (event.data.type) {
|
|
13092
|
-
case
|
|
13093
|
-
this.
|
|
13123
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13124
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13094
13125
|
break;
|
|
13095
13126
|
case SDK_CALL_ENDED: {
|
|
13096
13127
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13181,8 +13212,14 @@ class Softphone {
|
|
|
13181
13212
|
case BRIDGE_ON_CARD_CANCELED:
|
|
13182
13213
|
this.onCardCanceled();
|
|
13183
13214
|
break;
|
|
13184
|
-
case
|
|
13185
|
-
this.
|
|
13215
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13216
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13217
|
+
break;
|
|
13218
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13219
|
+
this.onCallRejected(event.data.call);
|
|
13220
|
+
break;
|
|
13221
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13222
|
+
this.onCallEstablished(event.data.call);
|
|
13186
13223
|
break;
|
|
13187
13224
|
default:
|
|
13188
13225
|
this.onUnHandledEvent(event);
|
|
@@ -6296,6 +6296,14 @@ class WazoSessionDescriptionHandler extends SessionDescriptionHandler {
|
|
|
6296
6296
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6297
6297
|
if (event.candidate) {
|
|
6298
6298
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6299
|
+
|
|
6300
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6301
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6302
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6303
|
+
ice: event.candidate.candidate,
|
|
6304
|
+
});
|
|
6305
|
+
this.iceGatheringComplete();
|
|
6306
|
+
}
|
|
6299
6307
|
}
|
|
6300
6308
|
};
|
|
6301
6309
|
|
|
@@ -13138,7 +13146,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13138
13146
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13139
13147
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13140
13148
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13141
|
-
const
|
|
13149
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13150
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13151
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13142
13152
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13143
13153
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13144
13154
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13155,12 +13165,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
13155
13165
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13156
13166
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13157
13167
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13168
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13158
13169
|
|
|
13159
13170
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13160
13171
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13161
13172
|
|
|
13162
13173
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13163
|
-
const
|
|
13174
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13164
13175
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13165
13176
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13166
13177
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -13180,10 +13191,13 @@ class Softphone {
|
|
|
13180
13191
|
onLinkEnabled(link ) {}
|
|
13181
13192
|
onIFrameLoaded() {}
|
|
13182
13193
|
|
|
13183
|
-
|
|
13184
|
-
|
|
13194
|
+
onCallLocallyAnswered(call ) {}
|
|
13195
|
+
onCallEstablished(call ) {}
|
|
13196
|
+
onOutgoingCallMade(call ) {}
|
|
13185
13197
|
onCallIncoming(call ) {}
|
|
13198
|
+
onCallRejected(call ) {}
|
|
13186
13199
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13200
|
+
|
|
13187
13201
|
onCardSaved(card ) {}
|
|
13188
13202
|
onCardCanceled() {}
|
|
13189
13203
|
onAuthenticated(session ) {}
|
|
@@ -13215,7 +13229,18 @@ class Softphone {
|
|
|
13215
13229
|
onStopRecording() {}
|
|
13216
13230
|
onUnHandledEvent(event ) {}
|
|
13217
13231
|
|
|
13218
|
-
init({
|
|
13232
|
+
init({
|
|
13233
|
+
url,
|
|
13234
|
+
width,
|
|
13235
|
+
height,
|
|
13236
|
+
server,
|
|
13237
|
+
port,
|
|
13238
|
+
language,
|
|
13239
|
+
wrapUpDuration,
|
|
13240
|
+
enableAgent = true,
|
|
13241
|
+
tenantId,
|
|
13242
|
+
debug = false,
|
|
13243
|
+
} = {}) {
|
|
13219
13244
|
this.url = url || 'https://softphone.wazo.io';
|
|
13220
13245
|
this.width = width || 500;
|
|
13221
13246
|
this.height = height || 600;
|
|
@@ -13227,8 +13252,7 @@ class Softphone {
|
|
|
13227
13252
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13228
13253
|
|
|
13229
13254
|
if (!server) {
|
|
13230
|
-
|
|
13231
|
-
server = 'stack.dev.wazo.io';
|
|
13255
|
+
throw new Error('`server` is not set');
|
|
13232
13256
|
}
|
|
13233
13257
|
|
|
13234
13258
|
const config = { server };
|
|
@@ -13238,6 +13262,9 @@ class Softphone {
|
|
|
13238
13262
|
if (port) {
|
|
13239
13263
|
config.port = port;
|
|
13240
13264
|
}
|
|
13265
|
+
if (tenantId) {
|
|
13266
|
+
config.tenantId = tenantId;
|
|
13267
|
+
}
|
|
13241
13268
|
if (wrapUpDuration) {
|
|
13242
13269
|
config.wrapUpDuration = wrapUpDuration;
|
|
13243
13270
|
}
|
|
@@ -13248,6 +13275,10 @@ class Softphone {
|
|
|
13248
13275
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13249
13276
|
}
|
|
13250
13277
|
|
|
13278
|
+
if (debug) {
|
|
13279
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13280
|
+
}
|
|
13281
|
+
|
|
13251
13282
|
this._createIframe(() => {
|
|
13252
13283
|
this.iframeLoaded = true;
|
|
13253
13284
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -13368,8 +13399,8 @@ class Softphone {
|
|
|
13368
13399
|
}
|
|
13369
13400
|
|
|
13370
13401
|
switch (event.data.type) {
|
|
13371
|
-
case
|
|
13372
|
-
this.
|
|
13402
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13403
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13373
13404
|
break;
|
|
13374
13405
|
case SDK_CALL_ENDED: {
|
|
13375
13406
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13460,8 +13491,14 @@ class Softphone {
|
|
|
13460
13491
|
case BRIDGE_ON_CARD_CANCELED:
|
|
13461
13492
|
this.onCardCanceled();
|
|
13462
13493
|
break;
|
|
13463
|
-
case
|
|
13464
|
-
this.
|
|
13494
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13495
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13496
|
+
break;
|
|
13497
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13498
|
+
this.onCallRejected(event.data.call);
|
|
13499
|
+
break;
|
|
13500
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13501
|
+
this.onCallEstablished(event.data.call);
|
|
13465
13502
|
break;
|
|
13466
13503
|
default:
|
|
13467
13504
|
this.onUnHandledEvent(event);
|