@wazo/sdk 0.38.2 → 0.38.3

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.
@@ -13856,7 +13856,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13856
13856
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13857
13857
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13858
13858
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13859
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13859
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13860
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13861
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13860
13862
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13861
13863
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13862
13864
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13873,12 +13875,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13873
13875
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13874
13876
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13875
13877
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13878
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13876
13879
 
13877
13880
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13878
13881
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13879
13882
 
13880
13883
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13881
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13884
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13882
13885
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13883
13886
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13884
13887
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13898,10 +13901,13 @@ class Softphone {
13898
13901
  onLinkEnabled(link ) {}
13899
13902
  onIFrameLoaded() {}
13900
13903
 
13901
- onCallAnswered() {}
13902
- onCallMade(call ) {}
13904
+ onCallLocallyAnswered(call ) {}
13905
+ onCallRemotelyAnswered(call ) {}
13906
+ onOutgoingCallMade(call ) {}
13903
13907
  onCallIncoming(call ) {}
13908
+ onCallRejected(call ) {}
13904
13909
  onCallEnded(call , card , direction , fromExtension ) {}
13910
+
13905
13911
  onCardSaved(card ) {}
13906
13912
  onCardCanceled() {}
13907
13913
  onAuthenticated(session ) {}
@@ -13933,7 +13939,18 @@ class Softphone {
13933
13939
  onStopRecording() {}
13934
13940
  onUnHandledEvent(event ) {}
13935
13941
 
13936
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
13942
+ init({
13943
+ url,
13944
+ width,
13945
+ height,
13946
+ server,
13947
+ port,
13948
+ language,
13949
+ wrapUpDuration,
13950
+ enableAgent = true,
13951
+ tenantId,
13952
+ debug = false,
13953
+ } = {}) {
13937
13954
  this.url = url || 'https://softphone.wazo.io';
13938
13955
  this.width = width || 500;
13939
13956
  this.height = height || 600;
@@ -13956,6 +13973,9 @@ class Softphone {
13956
13973
  if (port) {
13957
13974
  config.port = port;
13958
13975
  }
13976
+ if (tenantId) {
13977
+ config.tenantId = tenantId;
13978
+ }
13959
13979
  if (wrapUpDuration) {
13960
13980
  config.wrapUpDuration = wrapUpDuration;
13961
13981
  }
@@ -13966,6 +13986,10 @@ class Softphone {
13966
13986
  this._sendMessage(BRIDGE_ENABLE_AGENT);
13967
13987
  }
13968
13988
 
13989
+ if (debug) {
13990
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
13991
+ }
13992
+
13969
13993
  this._createIframe(() => {
13970
13994
  this.iframeLoaded = true;
13971
13995
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14086,8 +14110,8 @@ class Softphone {
14086
14110
  }
14087
14111
 
14088
14112
  switch (event.data.type) {
14089
- case SDK_ON_CALL_MADE:
14090
- this.onCallMade(event.data.callSession);
14113
+ case SDK_ON_OUTGOING_CALL_MADE:
14114
+ this.onOutgoingCallMade(event.data.callSession);
14091
14115
  break;
14092
14116
  case SDK_CALL_ENDED: {
14093
14117
  const { callSession, content, direction, userExtension } = event.data;
@@ -14178,8 +14202,14 @@ class Softphone {
14178
14202
  case BRIDGE_ON_CARD_CANCELED:
14179
14203
  this.onCardCanceled();
14180
14204
  break;
14181
- case BRIDGE_ON_CALL_ANSWERED:
14182
- this.onCallAnswered();
14205
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14206
+ this.onCallLocallyAnswered(event.data.call);
14207
+ break;
14208
+ case BRIDGE_ON_CALL_REJECTED:
14209
+ this.onCallRejected(event.data.call);
14210
+ break;
14211
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14212
+ this.onCallRemotelyAnswered(event.data.call);
14183
14213
  break;
14184
14214
  default:
14185
14215
  this.onUnHandledEvent(event);
@@ -13937,7 +13937,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13937
13937
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13938
13938
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13939
13939
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13940
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13940
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13941
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13942
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13941
13943
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13942
13944
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13943
13945
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13954,12 +13956,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13954
13956
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13955
13957
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
13956
13958
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
13959
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
13957
13960
 
13958
13961
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
13959
13962
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
13960
13963
 
13961
13964
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
13962
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
13965
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
13963
13966
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
13964
13967
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
13965
13968
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -13979,10 +13982,13 @@ class Softphone {
13979
13982
  onLinkEnabled(link ) {}
13980
13983
  onIFrameLoaded() {}
13981
13984
 
13982
- onCallAnswered() {}
13983
- onCallMade(call ) {}
13985
+ onCallLocallyAnswered(call ) {}
13986
+ onCallRemotelyAnswered(call ) {}
13987
+ onOutgoingCallMade(call ) {}
13984
13988
  onCallIncoming(call ) {}
13989
+ onCallRejected(call ) {}
13985
13990
  onCallEnded(call , card , direction , fromExtension ) {}
13991
+
13986
13992
  onCardSaved(card ) {}
13987
13993
  onCardCanceled() {}
13988
13994
  onAuthenticated(session ) {}
@@ -14014,7 +14020,18 @@ class Softphone {
14014
14020
  onStopRecording() {}
14015
14021
  onUnHandledEvent(event ) {}
14016
14022
 
14017
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
14023
+ init({
14024
+ url,
14025
+ width,
14026
+ height,
14027
+ server,
14028
+ port,
14029
+ language,
14030
+ wrapUpDuration,
14031
+ enableAgent = true,
14032
+ tenantId,
14033
+ debug = false,
14034
+ } = {}) {
14018
14035
  this.url = url || 'https://softphone.wazo.io';
14019
14036
  this.width = width || 500;
14020
14037
  this.height = height || 600;
@@ -14037,6 +14054,9 @@ class Softphone {
14037
14054
  if (port) {
14038
14055
  config.port = port;
14039
14056
  }
14057
+ if (tenantId) {
14058
+ config.tenantId = tenantId;
14059
+ }
14040
14060
  if (wrapUpDuration) {
14041
14061
  config.wrapUpDuration = wrapUpDuration;
14042
14062
  }
@@ -14047,6 +14067,10 @@ class Softphone {
14047
14067
  this._sendMessage(BRIDGE_ENABLE_AGENT);
14048
14068
  }
14049
14069
 
14070
+ if (debug) {
14071
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14072
+ }
14073
+
14050
14074
  this._createIframe(() => {
14051
14075
  this.iframeLoaded = true;
14052
14076
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14167,8 +14191,8 @@ class Softphone {
14167
14191
  }
14168
14192
 
14169
14193
  switch (event.data.type) {
14170
- case SDK_ON_CALL_MADE:
14171
- this.onCallMade(event.data.callSession);
14194
+ case SDK_ON_OUTGOING_CALL_MADE:
14195
+ this.onOutgoingCallMade(event.data.callSession);
14172
14196
  break;
14173
14197
  case SDK_CALL_ENDED: {
14174
14198
  const { callSession, content, direction, userExtension } = event.data;
@@ -14259,8 +14283,14 @@ class Softphone {
14259
14283
  case BRIDGE_ON_CARD_CANCELED:
14260
14284
  this.onCardCanceled();
14261
14285
  break;
14262
- case BRIDGE_ON_CALL_ANSWERED:
14263
- this.onCallAnswered();
14286
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14287
+ this.onCallLocallyAnswered(event.data.call);
14288
+ break;
14289
+ case BRIDGE_ON_CALL_REJECTED:
14290
+ this.onCallRejected(event.data.call);
14291
+ break;
14292
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14293
+ this.onCallRemotelyAnswered(event.data.call);
14264
14294
  break;
14265
14295
  default:
14266
14296
  this.onUnHandledEvent(event);
@@ -13995,7 +13995,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13995
13995
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13996
13996
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13997
13997
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13998
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13998
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13999
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
14000
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13999
14001
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
14000
14002
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
14001
14003
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -14012,12 +14014,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
14012
14014
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
14013
14015
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
14014
14016
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
14017
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
14015
14018
 
14016
14019
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
14017
14020
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
14018
14021
 
14019
14022
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
14020
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
14023
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
14021
14024
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
14022
14025
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
14023
14026
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -14037,10 +14040,13 @@ class Softphone {
14037
14040
  onLinkEnabled(link ) {}
14038
14041
  onIFrameLoaded() {}
14039
14042
 
14040
- onCallAnswered() {}
14041
- onCallMade(call ) {}
14043
+ onCallLocallyAnswered(call ) {}
14044
+ onCallRemotelyAnswered(call ) {}
14045
+ onOutgoingCallMade(call ) {}
14042
14046
  onCallIncoming(call ) {}
14047
+ onCallRejected(call ) {}
14043
14048
  onCallEnded(call , card , direction , fromExtension ) {}
14049
+
14044
14050
  onCardSaved(card ) {}
14045
14051
  onCardCanceled() {}
14046
14052
  onAuthenticated(session ) {}
@@ -14072,7 +14078,18 @@ class Softphone {
14072
14078
  onStopRecording() {}
14073
14079
  onUnHandledEvent(event ) {}
14074
14080
 
14075
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
14081
+ init({
14082
+ url,
14083
+ width,
14084
+ height,
14085
+ server,
14086
+ port,
14087
+ language,
14088
+ wrapUpDuration,
14089
+ enableAgent = true,
14090
+ tenantId,
14091
+ debug = false,
14092
+ } = {}) {
14076
14093
  this.url = url || 'https://softphone.wazo.io';
14077
14094
  this.width = width || 500;
14078
14095
  this.height = height || 600;
@@ -14095,6 +14112,9 @@ class Softphone {
14095
14112
  if (port) {
14096
14113
  config.port = port;
14097
14114
  }
14115
+ if (tenantId) {
14116
+ config.tenantId = tenantId;
14117
+ }
14098
14118
  if (wrapUpDuration) {
14099
14119
  config.wrapUpDuration = wrapUpDuration;
14100
14120
  }
@@ -14105,6 +14125,10 @@ class Softphone {
14105
14125
  this._sendMessage(BRIDGE_ENABLE_AGENT);
14106
14126
  }
14107
14127
 
14128
+ if (debug) {
14129
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14130
+ }
14131
+
14108
14132
  this._createIframe(() => {
14109
14133
  this.iframeLoaded = true;
14110
14134
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14225,8 +14249,8 @@ class Softphone {
14225
14249
  }
14226
14250
 
14227
14251
  switch (event.data.type) {
14228
- case SDK_ON_CALL_MADE:
14229
- this.onCallMade(event.data.callSession);
14252
+ case SDK_ON_OUTGOING_CALL_MADE:
14253
+ this.onOutgoingCallMade(event.data.callSession);
14230
14254
  break;
14231
14255
  case SDK_CALL_ENDED: {
14232
14256
  const { callSession, content, direction, userExtension } = event.data;
@@ -14317,8 +14341,14 @@ class Softphone {
14317
14341
  case BRIDGE_ON_CARD_CANCELED:
14318
14342
  this.onCardCanceled();
14319
14343
  break;
14320
- case BRIDGE_ON_CALL_ANSWERED:
14321
- this.onCallAnswered();
14344
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14345
+ this.onCallLocallyAnswered(event.data.call);
14346
+ break;
14347
+ case BRIDGE_ON_CALL_REJECTED:
14348
+ this.onCallRejected(event.data.call);
14349
+ break;
14350
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14351
+ this.onCallRemotelyAnswered(event.data.call);
14322
14352
  break;
14323
14353
  default:
14324
14354
  this.onUnHandledEvent(event);
@@ -13981,7 +13981,9 @@ const BRIDGE_ON_AGENT_LOGGED_OUT = 'bridge/BRIDGE_ON_AGENT_LOGGED_OUT';
13981
13981
  const BRIDGE_ON_AGENT_PAUSED = 'bridge/BRIDGE_ON_AGENT_PAUSED';
13982
13982
  const BRIDGE_ON_AGENT_RESUMED = 'bridge/BRIDGE_ON_AGENT_RESUMED';
13983
13983
  const BRIDGE_ON_LANGUAGE_CHANGED = 'bridge/BRIDGE_ON_LANGUAGE_CHANGED';
13984
- const BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
13984
+ const BRIDGE_ON_CALL_LOCALLY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_LOCALLY_ACCEPTED';
13985
+ const BRIDGE_ON_CALL_REJECTED = 'bridge/BRIDGE_ON_CALL_REJECTED';
13986
+ const BRIDGE_ON_CALL_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
13985
13987
  const BRIDGE_ON_CALL_HELD = 'bridge/BRIDGE_ON_CALL_HELD';
13986
13988
  const BRIDGE_ON_CALL_RESUMED = 'bridge/BRIDGE_ON_CALL_RESUMED';
13987
13989
  const BRIDGE_ON_CALL_MUTED = 'bridge/BRIDGE_ON_CALL_MUTED';
@@ -13998,12 +14000,13 @@ const BRIDGE_ON_STOP_RECORDING = 'bridge/BRIDGE_ON_STOP_RECORDING';
13998
14000
  const BRIDGE_ON_CARD_CANCELED = 'bridge/BRIDGE_ON_CARD_CANCELED';
13999
14001
  const BRIDGE_ENABLE_AGENT = 'bridge/BRIDGE_ENABLE_AGENT';
14000
14002
  const BRIDGE_SET_CARD_CONTENT = 'bridge/BRIDGE_SET_CARD_CONTENT';
14003
+ const BRIDGE_ENABLE_DEBUG = 'bridge/BRIDGE_ENABLE_DEBUG';
14001
14004
 
14002
14005
  const BRIDGE_INJECT_CSS = 'bridge/BRIDGE_INJECT_CSS';
14003
14006
  const BRIDGE_CUSTOMIZE_APPEARANCE = 'bridge/BRIDGE_CUSTOMIZE_APPEARANCE';
14004
14007
 
14005
14008
  const SDK_CLICK_TO_CALL = 'sdk/CLICK_TO_CALL';
14006
- const SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
14009
+ const SDK_ON_OUTGOING_CALL_MADE = 'sdk/SDK_ON_OUTGOING_CALL_MADE';
14007
14010
  const SDK_CALL_ENDED = 'sdk/ON_CALL_ENDED';
14008
14011
  const SDK_CALL_INCOMING = 'sdk/SDK_CALL_INCOMING';
14009
14012
  const SDK_AUTHENTICATED = 'sdk/SDK_AUTHENTICATED';
@@ -14023,10 +14026,13 @@ class Softphone {
14023
14026
  onLinkEnabled(link ) {}
14024
14027
  onIFrameLoaded() {}
14025
14028
 
14026
- onCallAnswered() {}
14027
- onCallMade(call ) {}
14029
+ onCallLocallyAnswered(call ) {}
14030
+ onCallRemotelyAnswered(call ) {}
14031
+ onOutgoingCallMade(call ) {}
14028
14032
  onCallIncoming(call ) {}
14033
+ onCallRejected(call ) {}
14029
14034
  onCallEnded(call , card , direction , fromExtension ) {}
14035
+
14030
14036
  onCardSaved(card ) {}
14031
14037
  onCardCanceled() {}
14032
14038
  onAuthenticated(session ) {}
@@ -14058,7 +14064,18 @@ class Softphone {
14058
14064
  onStopRecording() {}
14059
14065
  onUnHandledEvent(event ) {}
14060
14066
 
14061
- init({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true } = {}) {
14067
+ init({
14068
+ url,
14069
+ width,
14070
+ height,
14071
+ server,
14072
+ port,
14073
+ language,
14074
+ wrapUpDuration,
14075
+ enableAgent = true,
14076
+ tenantId,
14077
+ debug = false,
14078
+ } = {}) {
14062
14079
  this.url = url || 'https://softphone.wazo.io';
14063
14080
  this.width = width || 500;
14064
14081
  this.height = height || 600;
@@ -14081,6 +14098,9 @@ class Softphone {
14081
14098
  if (port) {
14082
14099
  config.port = port;
14083
14100
  }
14101
+ if (tenantId) {
14102
+ config.tenantId = tenantId;
14103
+ }
14084
14104
  if (wrapUpDuration) {
14085
14105
  config.wrapUpDuration = wrapUpDuration;
14086
14106
  }
@@ -14091,6 +14111,10 @@ class Softphone {
14091
14111
  this._sendMessage(BRIDGE_ENABLE_AGENT);
14092
14112
  }
14093
14113
 
14114
+ if (debug) {
14115
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
14116
+ }
14117
+
14094
14118
  this._createIframe(() => {
14095
14119
  this.iframeLoaded = true;
14096
14120
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -14211,8 +14235,8 @@ class Softphone {
14211
14235
  }
14212
14236
 
14213
14237
  switch (event.data.type) {
14214
- case SDK_ON_CALL_MADE:
14215
- this.onCallMade(event.data.callSession);
14238
+ case SDK_ON_OUTGOING_CALL_MADE:
14239
+ this.onOutgoingCallMade(event.data.callSession);
14216
14240
  break;
14217
14241
  case SDK_CALL_ENDED: {
14218
14242
  const { callSession, content, direction, userExtension } = event.data;
@@ -14303,8 +14327,14 @@ class Softphone {
14303
14327
  case BRIDGE_ON_CARD_CANCELED:
14304
14328
  this.onCardCanceled();
14305
14329
  break;
14306
- case BRIDGE_ON_CALL_ANSWERED:
14307
- this.onCallAnswered();
14330
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
14331
+ this.onCallLocallyAnswered(event.data.call);
14332
+ break;
14333
+ case BRIDGE_ON_CALL_REJECTED:
14334
+ this.onCallRejected(event.data.call);
14335
+ break;
14336
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
14337
+ this.onCallRemotelyAnswered(event.data.call);
14308
14338
  break;
14309
14339
  default:
14310
14340
  this.onUnHandledEvent(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wazo/sdk",
3
- "version": "0.38.2",
3
+ "version": "0.38.3",
4
4
  "description": "Wazo's JavaScript Software Development Kit.",
5
5
  "main": "dist/wazo-sdk.js",
6
6
  "author": "Wazo (http://wazo.io)",
@@ -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 BRIDGE_ON_CALL_ANSWERED = 'bridge/BRIDGE_ON_CALL_ANSWERED';
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_REMOTELY_ACCEPTED = 'bridge/BRIDGE_ON_CALL_REMOTELY_ACCEPTED';
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 SDK_ON_CALL_MADE = 'sdk/SDK_ON_CALL_MADE';
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
- onCallAnswered() {}
60
- onCallMade(call: Object) {}
62
+ onCallLocallyAnswered(call: Object) {}
63
+ onCallRemotelyAnswered(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({ url, width, height, server, port, language, wrapUpDuration, enableAgent = true }: Object = {}) {
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;
@@ -114,6 +131,9 @@ class Softphone {
114
131
  if (port) {
115
132
  config.port = port;
116
133
  }
134
+ if (tenantId) {
135
+ config.tenantId = tenantId;
136
+ }
117
137
  if (wrapUpDuration) {
118
138
  config.wrapUpDuration = wrapUpDuration;
119
139
  }
@@ -124,6 +144,10 @@ class Softphone {
124
144
  this._sendMessage(BRIDGE_ENABLE_AGENT);
125
145
  }
126
146
 
147
+ if (debug) {
148
+ this._sendMessage(BRIDGE_ENABLE_DEBUG);
149
+ }
150
+
127
151
  this._createIframe(() => {
128
152
  this.iframeLoaded = true;
129
153
  this._pendingMessages.forEach(([type, payload]) => this._sendMessage(type, payload));
@@ -244,8 +268,8 @@ class Softphone {
244
268
  }
245
269
 
246
270
  switch (event.data.type) {
247
- case SDK_ON_CALL_MADE:
248
- this.onCallMade(event.data.callSession);
271
+ case SDK_ON_OUTGOING_CALL_MADE:
272
+ this.onOutgoingCallMade(event.data.callSession);
249
273
  break;
250
274
  case SDK_CALL_ENDED: {
251
275
  const { callSession, content, direction, userExtension } = event.data;
@@ -336,8 +360,14 @@ class Softphone {
336
360
  case BRIDGE_ON_CARD_CANCELED:
337
361
  this.onCardCanceled();
338
362
  break;
339
- case BRIDGE_ON_CALL_ANSWERED:
340
- this.onCallAnswered();
363
+ case BRIDGE_ON_CALL_LOCALLY_ACCEPTED:
364
+ this.onCallLocallyAnswered(event.data.call);
365
+ break;
366
+ case BRIDGE_ON_CALL_REJECTED:
367
+ this.onCallRejected(event.data.call);
368
+ break;
369
+ case BRIDGE_ON_CALL_REMOTELY_ACCEPTED:
370
+ this.onCallRemotelyAnswered(event.data.call);
341
371
  break;
342
372
  default:
343
373
  this.onUnHandledEvent(event);