webitel-sdk 0.1.145 → 0.1.146
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 +17 -12
- 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 +22 -17
- 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/socket/client.js +16 -11
- package/esm2015/socket/client.js.map +1 -1
- package/esm5/socket/client.js +21 -16
- package/esm5/socket/client.js.map +1 -1
- package/package.json +1 -1
- package/types/socket/client.d.ts +2 -0
- package/types/socket/client.d.ts.map +1 -1
package/bundles/index.esm.js
CHANGED
|
@@ -25556,7 +25556,7 @@ async function getMediaStream(constraints) {
|
|
|
25556
25556
|
|
|
25557
25557
|
const getVersion = () => {
|
|
25558
25558
|
// @ts-ignore
|
|
25559
|
-
return '"0.1.
|
|
25559
|
+
return '"0.1.146"';
|
|
25560
25560
|
};
|
|
25561
25561
|
var version = getVersion();
|
|
25562
25562
|
|
|
@@ -27188,29 +27188,34 @@ class Client extends EventEmitter {
|
|
|
27188
27188
|
}
|
|
27189
27189
|
async registerCallClient(phone) {
|
|
27190
27190
|
this.phone = phone;
|
|
27191
|
-
this.phone
|
|
27191
|
+
this.subscribePhone(phone);
|
|
27192
|
+
try {
|
|
27193
|
+
const conf = await this.deviceConfig(this.phone.type);
|
|
27194
|
+
await this.phone.register(conf);
|
|
27195
|
+
}
|
|
27196
|
+
catch (e) {
|
|
27197
|
+
// FIXME add handle error
|
|
27198
|
+
this.log.error(e);
|
|
27199
|
+
}
|
|
27200
|
+
}
|
|
27201
|
+
subscribePhone(phone) {
|
|
27202
|
+
phone.on('peerStreams', (session, streams) => {
|
|
27192
27203
|
const call = this.callBySession(session);
|
|
27193
27204
|
if (call && !call.peerStreams.length) {
|
|
27194
27205
|
call.setPeerStreams(streams);
|
|
27195
27206
|
this.eventHandler.emit(WEBSOCKET_EVENT_CALL, CallActions.PeerStream, call);
|
|
27196
27207
|
}
|
|
27197
27208
|
});
|
|
27198
|
-
|
|
27209
|
+
phone.on('localStreams', (session, streams) => {
|
|
27199
27210
|
const call = this.callBySession(session);
|
|
27200
27211
|
if (call && !call.localStreams.length) {
|
|
27201
27212
|
call.setLocalStreams(streams);
|
|
27202
27213
|
this.eventHandler.emit(WEBSOCKET_EVENT_CALL, CallActions.LocalStream, call);
|
|
27203
27214
|
}
|
|
27204
27215
|
});
|
|
27205
|
-
|
|
27206
|
-
|
|
27207
|
-
|
|
27208
|
-
await this.phone.register(conf);
|
|
27209
|
-
}
|
|
27210
|
-
catch (e) {
|
|
27211
|
-
// FIXME add handle error
|
|
27212
|
-
this.log.error(e);
|
|
27213
|
-
}
|
|
27216
|
+
phone.on('newSession', this.onNewCallSession.bind(this));
|
|
27217
|
+
phone.on('registered', () => this.emit('phone_registered', true));
|
|
27218
|
+
phone.on('unregistered', () => this.emit('phone_registered', false));
|
|
27214
27219
|
}
|
|
27215
27220
|
async deviceConfig(name) {
|
|
27216
27221
|
return this.request(WEBSOCKET_DEFAULT_DEVICE_CONFIG, { name });
|