@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/lib/simple/Softphone.js
CHANGED
|
@@ -16,7 +16,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
16
16
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
17
17
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
18
18
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
19
|
-
const
|
|
19
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
20
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
21
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
20
22
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
21
23
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
22
24
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -33,12 +35,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
33
35
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
34
36
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
35
37
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
38
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
36
39
|
|
|
37
40
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
38
41
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
39
42
|
|
|
40
43
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
41
|
-
const
|
|
44
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
42
45
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
43
46
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
44
47
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -58,10 +61,13 @@ class Softphone {
|
|
|
58
61
|
onLinkEnabled(link ) {}
|
|
59
62
|
onIFrameLoaded() {}
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
onCallLocallyAnswered(call ) {}
|
|
65
|
+
onCallEstablished(call ) {}
|
|
66
|
+
onOutgoingCallMade(call ) {}
|
|
63
67
|
onCallIncoming(call ) {}
|
|
68
|
+
onCallRejected(call ) {}
|
|
64
69
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
70
|
+
|
|
65
71
|
onCardSaved(card ) {}
|
|
66
72
|
onCardCanceled() {}
|
|
67
73
|
onAuthenticated(session ) {}
|
|
@@ -93,7 +99,18 @@ class Softphone {
|
|
|
93
99
|
onStopRecording() {}
|
|
94
100
|
onUnHandledEvent(event ) {}
|
|
95
101
|
|
|
96
|
-
init({
|
|
102
|
+
init({
|
|
103
|
+
url,
|
|
104
|
+
width,
|
|
105
|
+
height,
|
|
106
|
+
server,
|
|
107
|
+
port,
|
|
108
|
+
language,
|
|
109
|
+
wrapUpDuration,
|
|
110
|
+
enableAgent = true,
|
|
111
|
+
tenantId,
|
|
112
|
+
debug = false,
|
|
113
|
+
} = {}) {
|
|
97
114
|
this.url = url || 'https://softphone.wazo.io';
|
|
98
115
|
this.width = width || 500;
|
|
99
116
|
this.height = height || 600;
|
|
@@ -105,8 +122,7 @@ class Softphone {
|
|
|
105
122
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
106
123
|
|
|
107
124
|
if (!server) {
|
|
108
|
-
|
|
109
|
-
server = 'stack.dev.wazo.io';
|
|
125
|
+
throw new Error('`server` is not set');
|
|
110
126
|
}
|
|
111
127
|
|
|
112
128
|
const config = { server };
|
|
@@ -116,6 +132,9 @@ class Softphone {
|
|
|
116
132
|
if (port) {
|
|
117
133
|
config.port = port;
|
|
118
134
|
}
|
|
135
|
+
if (tenantId) {
|
|
136
|
+
config.tenantId = tenantId;
|
|
137
|
+
}
|
|
119
138
|
if (wrapUpDuration) {
|
|
120
139
|
config.wrapUpDuration = wrapUpDuration;
|
|
121
140
|
}
|
|
@@ -126,6 +145,10 @@ class Softphone {
|
|
|
126
145
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
127
146
|
}
|
|
128
147
|
|
|
148
|
+
if (debug) {
|
|
149
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
150
|
+
}
|
|
151
|
+
|
|
129
152
|
this._createIframe(() => {
|
|
130
153
|
this.iframeLoaded = true;
|
|
131
154
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -246,8 +269,8 @@ class Softphone {
|
|
|
246
269
|
}
|
|
247
270
|
|
|
248
271
|
switch (event.data.type) {
|
|
249
|
-
case
|
|
250
|
-
this.
|
|
272
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
273
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
251
274
|
break;
|
|
252
275
|
case SDK_CALL_ENDED: {
|
|
253
276
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -338,8 +361,14 @@ class Softphone {
|
|
|
338
361
|
case BRIDGE_ON_CARD_CANCELED:
|
|
339
362
|
this.onCardCanceled();
|
|
340
363
|
break;
|
|
341
|
-
case
|
|
342
|
-
this.
|
|
364
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
365
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
366
|
+
break;
|
|
367
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
368
|
+
this.onCallRejected(event.data.call);
|
|
369
|
+
break;
|
|
370
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
371
|
+
this.onCallEstablished(event.data.call);
|
|
343
372
|
break;
|
|
344
373
|
default:
|
|
345
374
|
this.onUnHandledEvent(event);
|
package/lib/simple/index.js
CHANGED
|
@@ -6306,6 +6306,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6306
6306
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6307
6307
|
if (event.candidate) {
|
|
6308
6308
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6309
|
+
|
|
6310
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6311
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6312
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6313
|
+
ice: event.candidate.candidate,
|
|
6314
|
+
});
|
|
6315
|
+
this.iceGatheringComplete();
|
|
6316
|
+
}
|
|
6309
6317
|
}
|
|
6310
6318
|
};
|
|
6311
6319
|
|
|
@@ -13995,7 +14003,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13995
14003
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13996
14004
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13997
14005
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13998
|
-
const
|
|
14006
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
14007
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
14008
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13999
14009
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
14000
14010
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
14001
14011
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -14012,12 +14022,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
14012
14022
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
14013
14023
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
14014
14024
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
14025
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
14015
14026
|
|
|
14016
14027
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
14017
14028
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
14018
14029
|
|
|
14019
14030
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
14020
|
-
const
|
|
14031
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
14021
14032
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
14022
14033
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
14023
14034
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -14037,10 +14048,13 @@ class Softphone {
|
|
|
14037
14048
|
onLinkEnabled(link ) {}
|
|
14038
14049
|
onIFrameLoaded() {}
|
|
14039
14050
|
|
|
14040
|
-
|
|
14041
|
-
|
|
14051
|
+
onCallLocallyAnswered(call ) {}
|
|
14052
|
+
onCallEstablished(call ) {}
|
|
14053
|
+
onOutgoingCallMade(call ) {}
|
|
14042
14054
|
onCallIncoming(call ) {}
|
|
14055
|
+
onCallRejected(call ) {}
|
|
14043
14056
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
14057
|
+
|
|
14044
14058
|
onCardSaved(card ) {}
|
|
14045
14059
|
onCardCanceled() {}
|
|
14046
14060
|
onAuthenticated(session ) {}
|
|
@@ -14072,7 +14086,18 @@ class Softphone {
|
|
|
14072
14086
|
onStopRecording() {}
|
|
14073
14087
|
onUnHandledEvent(event ) {}
|
|
14074
14088
|
|
|
14075
|
-
init({
|
|
14089
|
+
init({
|
|
14090
|
+
url,
|
|
14091
|
+
width,
|
|
14092
|
+
height,
|
|
14093
|
+
server,
|
|
14094
|
+
port,
|
|
14095
|
+
language,
|
|
14096
|
+
wrapUpDuration,
|
|
14097
|
+
enableAgent = true,
|
|
14098
|
+
tenantId,
|
|
14099
|
+
debug = false,
|
|
14100
|
+
} = {}) {
|
|
14076
14101
|
this.url = url || 'https://softphone.wazo.io';
|
|
14077
14102
|
this.width = width || 500;
|
|
14078
14103
|
this.height = height || 600;
|
|
@@ -14084,8 +14109,7 @@ class Softphone {
|
|
|
14084
14109
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
14085
14110
|
|
|
14086
14111
|
if (!server) {
|
|
14087
|
-
|
|
14088
|
-
server = 'stack.dev.wazo.io';
|
|
14112
|
+
throw new Error('`server` is not set');
|
|
14089
14113
|
}
|
|
14090
14114
|
|
|
14091
14115
|
const config = { server };
|
|
@@ -14095,6 +14119,9 @@ class Softphone {
|
|
|
14095
14119
|
if (port) {
|
|
14096
14120
|
config.port = port;
|
|
14097
14121
|
}
|
|
14122
|
+
if (tenantId) {
|
|
14123
|
+
config.tenantId = tenantId;
|
|
14124
|
+
}
|
|
14098
14125
|
if (wrapUpDuration) {
|
|
14099
14126
|
config.wrapUpDuration = wrapUpDuration;
|
|
14100
14127
|
}
|
|
@@ -14105,6 +14132,10 @@ class Softphone {
|
|
|
14105
14132
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
14106
14133
|
}
|
|
14107
14134
|
|
|
14135
|
+
if (debug) {
|
|
14136
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
14137
|
+
}
|
|
14138
|
+
|
|
14108
14139
|
this._createIframe(() => {
|
|
14109
14140
|
this.iframeLoaded = true;
|
|
14110
14141
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -14225,8 +14256,8 @@ class Softphone {
|
|
|
14225
14256
|
}
|
|
14226
14257
|
|
|
14227
14258
|
switch (event.data.type) {
|
|
14228
|
-
case
|
|
14229
|
-
this.
|
|
14259
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
14260
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
14230
14261
|
break;
|
|
14231
14262
|
case SDK_CALL_ENDED: {
|
|
14232
14263
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -14317,8 +14348,14 @@ class Softphone {
|
|
|
14317
14348
|
case BRIDGE_ON_CARD_CANCELED:
|
|
14318
14349
|
this.onCardCanceled();
|
|
14319
14350
|
break;
|
|
14320
|
-
case
|
|
14321
|
-
this.
|
|
14351
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
14352
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
14353
|
+
break;
|
|
14354
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
14355
|
+
this.onCallRejected(event.data.call);
|
|
14356
|
+
break;
|
|
14357
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
14358
|
+
this.onCallEstablished(event.data.call);
|
|
14322
14359
|
break;
|
|
14323
14360
|
default:
|
|
14324
14361
|
this.onUnHandledEvent(event);
|
|
@@ -6306,6 +6306,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6306
6306
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6307
6307
|
if (event.candidate) {
|
|
6308
6308
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6309
|
+
|
|
6310
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6311
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6312
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6313
|
+
ice: event.candidate.candidate,
|
|
6314
|
+
});
|
|
6315
|
+
this.iceGatheringComplete();
|
|
6316
|
+
}
|
|
6309
6317
|
}
|
|
6310
6318
|
};
|
|
6311
6319
|
|
|
@@ -12864,7 +12872,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
12864
12872
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
12865
12873
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
12866
12874
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
12867
|
-
const
|
|
12875
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
12876
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
12877
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
12868
12878
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
12869
12879
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
12870
12880
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -12881,12 +12891,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
12881
12891
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
12882
12892
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
12883
12893
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
12894
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
12884
12895
|
|
|
12885
12896
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
12886
12897
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
12887
12898
|
|
|
12888
12899
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
12889
|
-
const
|
|
12900
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
12890
12901
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
12891
12902
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
12892
12903
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -12906,10 +12917,13 @@ class Softphone {
|
|
|
12906
12917
|
onLinkEnabled(link ) {}
|
|
12907
12918
|
onIFrameLoaded() {}
|
|
12908
12919
|
|
|
12909
|
-
|
|
12910
|
-
|
|
12920
|
+
onCallLocallyAnswered(call ) {}
|
|
12921
|
+
onCallEstablished(call ) {}
|
|
12922
|
+
onOutgoingCallMade(call ) {}
|
|
12911
12923
|
onCallIncoming(call ) {}
|
|
12924
|
+
onCallRejected(call ) {}
|
|
12912
12925
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
12926
|
+
|
|
12913
12927
|
onCardSaved(card ) {}
|
|
12914
12928
|
onCardCanceled() {}
|
|
12915
12929
|
onAuthenticated(session ) {}
|
|
@@ -12941,7 +12955,18 @@ class Softphone {
|
|
|
12941
12955
|
onStopRecording() {}
|
|
12942
12956
|
onUnHandledEvent(event ) {}
|
|
12943
12957
|
|
|
12944
|
-
init({
|
|
12958
|
+
init({
|
|
12959
|
+
url,
|
|
12960
|
+
width,
|
|
12961
|
+
height,
|
|
12962
|
+
server,
|
|
12963
|
+
port,
|
|
12964
|
+
language,
|
|
12965
|
+
wrapUpDuration,
|
|
12966
|
+
enableAgent = true,
|
|
12967
|
+
tenantId,
|
|
12968
|
+
debug = false,
|
|
12969
|
+
} = {}) {
|
|
12945
12970
|
this.url = url || 'https://softphone.wazo.io';
|
|
12946
12971
|
this.width = width || 500;
|
|
12947
12972
|
this.height = height || 600;
|
|
@@ -12953,8 +12978,7 @@ class Softphone {
|
|
|
12953
12978
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
12954
12979
|
|
|
12955
12980
|
if (!server) {
|
|
12956
|
-
|
|
12957
|
-
server = 'stack.dev.wazo.io';
|
|
12981
|
+
throw new Error('`server` is not set');
|
|
12958
12982
|
}
|
|
12959
12983
|
|
|
12960
12984
|
const config = { server };
|
|
@@ -12964,6 +12988,9 @@ class Softphone {
|
|
|
12964
12988
|
if (port) {
|
|
12965
12989
|
config.port = port;
|
|
12966
12990
|
}
|
|
12991
|
+
if (tenantId) {
|
|
12992
|
+
config.tenantId = tenantId;
|
|
12993
|
+
}
|
|
12967
12994
|
if (wrapUpDuration) {
|
|
12968
12995
|
config.wrapUpDuration = wrapUpDuration;
|
|
12969
12996
|
}
|
|
@@ -12974,6 +13001,10 @@ class Softphone {
|
|
|
12974
13001
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
12975
13002
|
}
|
|
12976
13003
|
|
|
13004
|
+
if (debug) {
|
|
13005
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13006
|
+
}
|
|
13007
|
+
|
|
12977
13008
|
this._createIframe(() => {
|
|
12978
13009
|
this.iframeLoaded = true;
|
|
12979
13010
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -13094,8 +13125,8 @@ class Softphone {
|
|
|
13094
13125
|
}
|
|
13095
13126
|
|
|
13096
13127
|
switch (event.data.type) {
|
|
13097
|
-
case
|
|
13098
|
-
this.
|
|
13128
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13129
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13099
13130
|
break;
|
|
13100
13131
|
case SDK_CALL_ENDED: {
|
|
13101
13132
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13186,8 +13217,14 @@ class Softphone {
|
|
|
13186
13217
|
case BRIDGE_ON_CARD_CANCELED:
|
|
13187
13218
|
this.onCardCanceled();
|
|
13188
13219
|
break;
|
|
13189
|
-
case
|
|
13190
|
-
this.
|
|
13220
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13221
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13222
|
+
break;
|
|
13223
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13224
|
+
this.onCallRejected(event.data.call);
|
|
13225
|
+
break;
|
|
13226
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13227
|
+
this.onCallEstablished(event.data.call);
|
|
13191
13228
|
break;
|
|
13192
13229
|
default:
|
|
13193
13230
|
this.onUnHandledEvent(event);
|
|
@@ -6306,6 +6306,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6306
6306
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6307
6307
|
if (event.candidate) {
|
|
6308
6308
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6309
|
+
|
|
6310
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6311
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6312
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6313
|
+
ice: event.candidate.candidate,
|
|
6314
|
+
});
|
|
6315
|
+
this.iceGatheringComplete();
|
|
6316
|
+
}
|
|
6309
6317
|
}
|
|
6310
6318
|
};
|
|
6311
6319
|
|
|
@@ -12869,7 +12877,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
12869
12877
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
12870
12878
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
12871
12879
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
12872
|
-
const
|
|
12880
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
12881
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
12882
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
12873
12883
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
12874
12884
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
12875
12885
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -12886,12 +12896,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
12886
12896
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
12887
12897
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
12888
12898
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
12899
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
12889
12900
|
|
|
12890
12901
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
12891
12902
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
12892
12903
|
|
|
12893
12904
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
12894
|
-
const
|
|
12905
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
12895
12906
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
12896
12907
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
12897
12908
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -12911,10 +12922,13 @@ class Softphone {
|
|
|
12911
12922
|
onLinkEnabled(link ) {}
|
|
12912
12923
|
onIFrameLoaded() {}
|
|
12913
12924
|
|
|
12914
|
-
|
|
12915
|
-
|
|
12925
|
+
onCallLocallyAnswered(call ) {}
|
|
12926
|
+
onCallEstablished(call ) {}
|
|
12927
|
+
onOutgoingCallMade(call ) {}
|
|
12916
12928
|
onCallIncoming(call ) {}
|
|
12929
|
+
onCallRejected(call ) {}
|
|
12917
12930
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
12931
|
+
|
|
12918
12932
|
onCardSaved(card ) {}
|
|
12919
12933
|
onCardCanceled() {}
|
|
12920
12934
|
onAuthenticated(session ) {}
|
|
@@ -12946,7 +12960,18 @@ class Softphone {
|
|
|
12946
12960
|
onStopRecording() {}
|
|
12947
12961
|
onUnHandledEvent(event ) {}
|
|
12948
12962
|
|
|
12949
|
-
init({
|
|
12963
|
+
init({
|
|
12964
|
+
url,
|
|
12965
|
+
width,
|
|
12966
|
+
height,
|
|
12967
|
+
server,
|
|
12968
|
+
port,
|
|
12969
|
+
language,
|
|
12970
|
+
wrapUpDuration,
|
|
12971
|
+
enableAgent = true,
|
|
12972
|
+
tenantId,
|
|
12973
|
+
debug = false,
|
|
12974
|
+
} = {}) {
|
|
12950
12975
|
this.url = url || 'https://softphone.wazo.io';
|
|
12951
12976
|
this.width = width || 500;
|
|
12952
12977
|
this.height = height || 600;
|
|
@@ -12958,8 +12983,7 @@ class Softphone {
|
|
|
12958
12983
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
12959
12984
|
|
|
12960
12985
|
if (!server) {
|
|
12961
|
-
|
|
12962
|
-
server = 'stack.dev.wazo.io';
|
|
12986
|
+
throw new Error('`server` is not set');
|
|
12963
12987
|
}
|
|
12964
12988
|
|
|
12965
12989
|
const config = { server };
|
|
@@ -12969,6 +12993,9 @@ class Softphone {
|
|
|
12969
12993
|
if (port) {
|
|
12970
12994
|
config.port = port;
|
|
12971
12995
|
}
|
|
12996
|
+
if (tenantId) {
|
|
12997
|
+
config.tenantId = tenantId;
|
|
12998
|
+
}
|
|
12972
12999
|
if (wrapUpDuration) {
|
|
12973
13000
|
config.wrapUpDuration = wrapUpDuration;
|
|
12974
13001
|
}
|
|
@@ -12979,6 +13006,10 @@ class Softphone {
|
|
|
12979
13006
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
12980
13007
|
}
|
|
12981
13008
|
|
|
13009
|
+
if (debug) {
|
|
13010
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13011
|
+
}
|
|
13012
|
+
|
|
12982
13013
|
this._createIframe(() => {
|
|
12983
13014
|
this.iframeLoaded = true;
|
|
12984
13015
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -13099,8 +13130,8 @@ class Softphone {
|
|
|
13099
13130
|
}
|
|
13100
13131
|
|
|
13101
13132
|
switch (event.data.type) {
|
|
13102
|
-
case
|
|
13103
|
-
this.
|
|
13133
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13134
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13104
13135
|
break;
|
|
13105
13136
|
case SDK_CALL_ENDED: {
|
|
13106
13137
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13191,8 +13222,14 @@ class Softphone {
|
|
|
13191
13222
|
case BRIDGE_ON_CARD_CANCELED:
|
|
13192
13223
|
this.onCardCanceled();
|
|
13193
13224
|
break;
|
|
13194
|
-
case
|
|
13195
|
-
this.
|
|
13225
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13226
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13227
|
+
break;
|
|
13228
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13229
|
+
this.onCallRejected(event.data.call);
|
|
13230
|
+
break;
|
|
13231
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13232
|
+
this.onCallEstablished(event.data.call);
|
|
13196
13233
|
break;
|
|
13197
13234
|
default:
|
|
13198
13235
|
this.onUnHandledEvent(event);
|
|
@@ -6306,6 +6306,14 @@ class WazoSessionDescriptionHandler extends sessionDescriptionHandler.SessionDes
|
|
|
6306
6306
|
wazoLogger.trace('onicecandidate', event.candidate ? event.candidate.candidate : { done: true });
|
|
6307
6307
|
if (event.candidate) {
|
|
6308
6308
|
this.gatheredCandidates.push(parseCandidate$1(event.candidate.candidate));
|
|
6309
|
+
|
|
6310
|
+
// When receiving a `srflx` or a `relay` candidate, consider the negotiation done.
|
|
6311
|
+
if (event.candidate.candidate.indexOf('srflx') !== -1 || event.candidate.candidate.indexOf('relay') !== -1) {
|
|
6312
|
+
wazoLogger.info('A valid ice was found, triggering ice gathering complete callback.', {
|
|
6313
|
+
ice: event.candidate.candidate,
|
|
6314
|
+
});
|
|
6315
|
+
this.iceGatheringComplete();
|
|
6316
|
+
}
|
|
6309
6317
|
}
|
|
6310
6318
|
};
|
|
6311
6319
|
|
|
@@ -13148,7 +13156,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
|
|
|
13148
13156
|
const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
|
|
13149
13157
|
const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
|
|
13150
13158
|
const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
|
|
13151
|
-
const
|
|
13159
|
+
const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
|
|
13160
|
+
const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
|
|
13161
|
+
const BRIDGE_ON_CALL_ESTABLISHED = 'bridge/BRIDGE_ON_CALL_ESTABLISHED';
|
|
13152
13162
|
const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
|
|
13153
13163
|
const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
|
|
13154
13164
|
const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
|
|
@@ -13165,12 +13175,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
|
|
|
13165
13175
|
const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
|
|
13166
13176
|
const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
|
|
13167
13177
|
const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
|
|
13178
|
+
const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
|
|
13168
13179
|
|
|
13169
13180
|
const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
|
|
13170
13181
|
const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
|
|
13171
13182
|
|
|
13172
13183
|
const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
|
|
13173
|
-
const
|
|
13184
|
+
const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
|
|
13174
13185
|
const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
|
|
13175
13186
|
const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
|
|
13176
13187
|
const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
|
|
@@ -13190,10 +13201,13 @@ class Softphone {
|
|
|
13190
13201
|
onLinkEnabled(link ) {}
|
|
13191
13202
|
onIFrameLoaded() {}
|
|
13192
13203
|
|
|
13193
|
-
|
|
13194
|
-
|
|
13204
|
+
onCallLocallyAnswered(call ) {}
|
|
13205
|
+
onCallEstablished(call ) {}
|
|
13206
|
+
onOutgoingCallMade(call ) {}
|
|
13195
13207
|
onCallIncoming(call ) {}
|
|
13208
|
+
onCallRejected(call ) {}
|
|
13196
13209
|
onCallEnded(call , card , direction , fromExtension ) {}
|
|
13210
|
+
|
|
13197
13211
|
onCardSaved(card ) {}
|
|
13198
13212
|
onCardCanceled() {}
|
|
13199
13213
|
onAuthenticated(session ) {}
|
|
@@ -13225,7 +13239,18 @@ class Softphone {
|
|
|
13225
13239
|
onStopRecording() {}
|
|
13226
13240
|
onUnHandledEvent(event ) {}
|
|
13227
13241
|
|
|
13228
|
-
init({
|
|
13242
|
+
init({
|
|
13243
|
+
url,
|
|
13244
|
+
width,
|
|
13245
|
+
height,
|
|
13246
|
+
server,
|
|
13247
|
+
port,
|
|
13248
|
+
language,
|
|
13249
|
+
wrapUpDuration,
|
|
13250
|
+
enableAgent = true,
|
|
13251
|
+
tenantId,
|
|
13252
|
+
debug = false,
|
|
13253
|
+
} = {}) {
|
|
13229
13254
|
this.url = url || 'https://softphone.wazo.io';
|
|
13230
13255
|
this.width = width || 500;
|
|
13231
13256
|
this.height = height || 600;
|
|
@@ -13237,8 +13262,7 @@ class Softphone {
|
|
|
13237
13262
|
window.addEventListener('message', this._onMessage.bind(this), false);
|
|
13238
13263
|
|
|
13239
13264
|
if (!server) {
|
|
13240
|
-
|
|
13241
|
-
server = 'stack.dev.wazo.io';
|
|
13265
|
+
throw new Error('`server` is not set');
|
|
13242
13266
|
}
|
|
13243
13267
|
|
|
13244
13268
|
const config = { server };
|
|
@@ -13248,6 +13272,9 @@ class Softphone {
|
|
|
13248
13272
|
if (port) {
|
|
13249
13273
|
config.port = port;
|
|
13250
13274
|
}
|
|
13275
|
+
if (tenantId) {
|
|
13276
|
+
config.tenantId = tenantId;
|
|
13277
|
+
}
|
|
13251
13278
|
if (wrapUpDuration) {
|
|
13252
13279
|
config.wrapUpDuration = wrapUpDuration;
|
|
13253
13280
|
}
|
|
@@ -13258,6 +13285,10 @@ class Softphone {
|
|
|
13258
13285
|
this._sendMessage(BRIDGE_ENABLE_AGENT);
|
|
13259
13286
|
}
|
|
13260
13287
|
|
|
13288
|
+
if (debug) {
|
|
13289
|
+
this._sendMessage(BRIDGE_ENABLE_DEBUG);
|
|
13290
|
+
}
|
|
13291
|
+
|
|
13261
13292
|
this._createIframe(() => {
|
|
13262
13293
|
this.iframeLoaded = true;
|
|
13263
13294
|
this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
|
|
@@ -13378,8 +13409,8 @@ class Softphone {
|
|
|
13378
13409
|
}
|
|
13379
13410
|
|
|
13380
13411
|
switch (event.data.type) {
|
|
13381
|
-
case
|
|
13382
|
-
this.
|
|
13412
|
+
case SDK_ON_OUTGOING_CALL_MADE:
|
|
13413
|
+
this.onOutgoingCallMade(event.data.callSession);
|
|
13383
13414
|
break;
|
|
13384
13415
|
case SDK_CALL_ENDED: {
|
|
13385
13416
|
const { callSession, content, direction, userExtension } = event.data;
|
|
@@ -13470,8 +13501,14 @@ class Softphone {
|
|
|
13470
13501
|
case BRIDGE_ON_CARD_CANCELED:
|
|
13471
13502
|
this.onCardCanceled();
|
|
13472
13503
|
break;
|
|
13473
|
-
case
|
|
13474
|
-
this.
|
|
13504
|
+
case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
|
|
13505
|
+
this.onCallLocallyAnswered(event.data.call);
|
|
13506
|
+
break;
|
|
13507
|
+
case BRIDGE_ON_CALL_REJECTED:
|
|
13508
|
+
this.onCallRejected(event.data.call);
|
|
13509
|
+
break;
|
|
13510
|
+
case BRIDGE_ON_CALL_ESTABLISHED:
|
|
13511
|
+
this.onCallEstablished(event.data.call);
|
|
13475
13512
|
break;
|
|
13476
13513
|
default:
|
|
13477
13514
|
this.onUnHandledEvent(event);
|