@vgroup/dialbox 0.2.4 → 0.2.6
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.
|
@@ -2328,7 +2328,22 @@ class CallProgressComponent {
|
|
|
2328
2328
|
codecPreferences: ['opus', 'pcmu'],
|
|
2329
2329
|
closeProtection: true,
|
|
2330
2330
|
};
|
|
2331
|
-
|
|
2331
|
+
// Reuse existing Device if available; otherwise create and register once
|
|
2332
|
+
if (!this.device) {
|
|
2333
|
+
this.device = new Device(tokenData.token.value, options);
|
|
2334
|
+
await this.device.register();
|
|
2335
|
+
}
|
|
2336
|
+
else {
|
|
2337
|
+
// Update token if Device supports it and token changed/rotated
|
|
2338
|
+
try {
|
|
2339
|
+
if (this.device.updateToken) {
|
|
2340
|
+
await this.device.updateToken(tokenData.token.value);
|
|
2341
|
+
}
|
|
2342
|
+
}
|
|
2343
|
+
catch (e) {
|
|
2344
|
+
console.warn('Device updateToken failed, proceeding with existing token', e);
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2332
2347
|
const newCall = await this.device.connect({
|
|
2333
2348
|
params: {
|
|
2334
2349
|
From: this.callData.from,
|