webitel-sdk 0.1.105 → 0.1.108
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/bundles/index.esm.js +26 -11
- package/bundles/index.esm.js.map +1 -1
- package/bundles/index.esm.min.js +1 -1
- package/bundles/index.esm.min.js.map +1 -1
- package/bundles/index.umd.js +34 -15
- package/bundles/index.umd.js.map +1 -1
- package/bundles/index.umd.min.js +1 -1
- package/bundles/index.umd.min.js.map +1 -1
- package/esm2015/enums/queues/queue-type.enum.js +2 -1
- package/esm2015/enums/queues/queue-type.enum.js.map +1 -1
- package/esm2015/socket/call.js +7 -2
- package/esm2015/socket/call.js.map +1 -1
- package/esm2015/socket/client.js +19 -9
- package/esm2015/socket/client.js.map +1 -1
- package/esm5/enums/queues/queue-type.enum.js +2 -1
- package/esm5/enums/queues/queue-type.enum.js.map +1 -1
- package/esm5/socket/call.js +14 -6
- package/esm5/socket/call.js.map +1 -1
- package/esm5/socket/client.js +20 -9
- package/esm5/socket/client.js.map +1 -1
- package/esm5/socket/errors.js.map +1 -1
- package/package.json +1 -1
- package/types/enums/queues/queue-type.enum.d.ts +2 -1
- package/types/enums/queues/queue-type.enum.d.ts.map +1 -1
- package/types/socket/call.d.ts.map +1 -1
- package/types/socket/client.d.ts +2 -1
- package/types/socket/client.d.ts.map +1 -1
- package/types/socket/errors.d.ts.map +1 -1
package/bundles/index.esm.js
CHANGED
|
@@ -23816,8 +23816,13 @@ class Call {
|
|
|
23816
23816
|
/* Call control */
|
|
23817
23817
|
async answer(req) {
|
|
23818
23818
|
if (this.sip && this.client.phone) {
|
|
23819
|
-
|
|
23820
|
-
|
|
23819
|
+
try {
|
|
23820
|
+
const params = await this.client.phone.callOption(req);
|
|
23821
|
+
await this.sip.answer(params);
|
|
23822
|
+
}
|
|
23823
|
+
catch (e) {
|
|
23824
|
+
this.client.handleError(e);
|
|
23825
|
+
}
|
|
23821
23826
|
return true;
|
|
23822
23827
|
}
|
|
23823
23828
|
return false;
|
|
@@ -24296,6 +24301,10 @@ const WEBSOCKET_EVENT_AGENT_STATUS = 'agent_status';
|
|
|
24296
24301
|
const WEBSOCKET_EVENT_CHANNEL_STATUS = 'channel';
|
|
24297
24302
|
const TASK_EVENT = 'task';
|
|
24298
24303
|
const WEBSOCKET_EVENT_SIP = 'sip';
|
|
24304
|
+
var HandleError;
|
|
24305
|
+
(function (HandleError) {
|
|
24306
|
+
HandleError["NotFoundError"] = "NotFoundError";
|
|
24307
|
+
})(HandleError || (HandleError = {}));
|
|
24299
24308
|
var Response;
|
|
24300
24309
|
(function (Response) {
|
|
24301
24310
|
Response["STATUS_FAIL"] = "FAIL";
|
|
@@ -24555,13 +24564,7 @@ class Client extends EventEmitter {
|
|
|
24555
24564
|
await this.phone.call(req);
|
|
24556
24565
|
}
|
|
24557
24566
|
catch (e) {
|
|
24558
|
-
|
|
24559
|
-
case 'NotFoundError':
|
|
24560
|
-
this.emit('error', new DeviceNotFoundError(e));
|
|
24561
|
-
break;
|
|
24562
|
-
default:
|
|
24563
|
-
this.emit('error', e);
|
|
24564
|
-
}
|
|
24567
|
+
this.handleError(e);
|
|
24565
24568
|
}
|
|
24566
24569
|
}
|
|
24567
24570
|
else {
|
|
@@ -24600,8 +24603,9 @@ class Client extends EventEmitter {
|
|
|
24600
24603
|
return this.request(WEBSOCKET_MAKE_USER_CALL, req);
|
|
24601
24604
|
}
|
|
24602
24605
|
async answer(id, req) {
|
|
24603
|
-
|
|
24604
|
-
|
|
24606
|
+
const call = this.callById(id);
|
|
24607
|
+
if (call) {
|
|
24608
|
+
return call.answer(req);
|
|
24605
24609
|
}
|
|
24606
24610
|
}
|
|
24607
24611
|
request(action, data) {
|
|
@@ -24700,6 +24704,17 @@ class Client extends EventEmitter {
|
|
|
24700
24704
|
fileUrlStream(fileId) {
|
|
24701
24705
|
return `${this.basePath}/api/storage/file/${fileId}/stream?access_token=${this._config.token}`;
|
|
24702
24706
|
}
|
|
24707
|
+
handleError(e) {
|
|
24708
|
+
if (e) {
|
|
24709
|
+
switch (e.name) {
|
|
24710
|
+
case HandleError.NotFoundError:
|
|
24711
|
+
this.emit('error', new DeviceNotFoundError(e.message));
|
|
24712
|
+
break;
|
|
24713
|
+
default:
|
|
24714
|
+
this.emit('error', e);
|
|
24715
|
+
}
|
|
24716
|
+
}
|
|
24717
|
+
}
|
|
24703
24718
|
async onMessage(message) {
|
|
24704
24719
|
this.log.debug('receive message: ', message);
|
|
24705
24720
|
if (message.seq_reply > 0) {
|