@vgroup/dialbox 0.2.61 → 0.2.63
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/esm2020/lib/components/call-progress/call-progress.component.mjs +50 -152
- package/fesm2015/vgroup-dialbox.mjs +50 -154
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +49 -151
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/components/call-progress/call-progress.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -2124,12 +2124,11 @@ class CallProgressComponent {
|
|
|
2124
2124
|
yield this.connectToDevice(tokenData.token, callData);
|
|
2125
2125
|
yield this.pollCallStatus(callAuthId);
|
|
2126
2126
|
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
2127
|
-
var _b;
|
|
2128
2127
|
yield this.addParticipantToCall({
|
|
2129
2128
|
from: callData === null || callData === void 0 ? void 0 : callData.from,
|
|
2130
2129
|
route: "OUTGOING",
|
|
2131
2130
|
participantNumber: callData === null || callData === void 0 ? void 0 : callData.phone,
|
|
2132
|
-
conferenceId:
|
|
2131
|
+
conferenceId: this.conferenceId
|
|
2133
2132
|
});
|
|
2134
2133
|
}), 1000);
|
|
2135
2134
|
// Poll the status for 30-45 seconds
|
|
@@ -2360,191 +2359,88 @@ class CallProgressComponent {
|
|
|
2360
2359
|
this.isAddRemoveParticipant = !this.isAddRemoveParticipant;
|
|
2361
2360
|
this.GetContactsList();
|
|
2362
2361
|
}
|
|
2363
|
-
// async callContact(contact: any) {
|
|
2364
|
-
// console.log('Adding contact to call:', contact);
|
|
2365
|
-
// // Check if there's an active call
|
|
2366
|
-
// if (!this.call || this.call.status() !== 'open') {
|
|
2367
|
-
// console.error('No active call to add participant to');
|
|
2368
|
-
// return;
|
|
2369
|
-
// }
|
|
2370
|
-
// // Get the phone number from the contact
|
|
2371
|
-
// const phoneNumber = contact.numbersList && contact.numbersList[0]?.number;
|
|
2372
|
-
// if (!phoneNumber) {
|
|
2373
|
-
// console.error('No phone number found for contact');
|
|
2374
|
-
// return;
|
|
2375
|
-
// }
|
|
2376
|
-
// try {
|
|
2377
|
-
// // Put current call on hold
|
|
2378
|
-
// if (this.call) {
|
|
2379
|
-
// this.heldCall = this.call;
|
|
2380
|
-
// this.isCallOnHold = true;
|
|
2381
|
-
// this.heldCall.mute(true);
|
|
2382
|
-
// console.log('Current call put on hold');
|
|
2383
|
-
// }
|
|
2384
|
-
// // Close contacts panel
|
|
2385
|
-
// this.showContactsPanel = false;
|
|
2386
|
-
// // Prepare new call data
|
|
2387
|
-
// const newCallData = {
|
|
2388
|
-
// phone: phoneNumber,
|
|
2389
|
-
// from: this.callData.from,
|
|
2390
|
-
// extNum: this.callData.extNum,
|
|
2391
|
-
// name: `${contact.firstName} ${contact.middleName || ''} ${contact.lastName || ''}`.trim(),
|
|
2392
|
-
// img: contact.img || 'assets/images/user.jpg',
|
|
2393
|
-
// displayNum: phoneNumber
|
|
2394
|
-
// };
|
|
2395
|
-
// // Initiate new call
|
|
2396
|
-
// this.showRingAnimation = true;
|
|
2397
|
-
// const payload = {
|
|
2398
|
-
// channelId: environment.channelId,
|
|
2399
|
-
// userId: localStorage.getItem('userId'),
|
|
2400
|
-
// to: phoneNumber,
|
|
2401
|
-
// scope: 'local',
|
|
2402
|
-
// fromNumber: this.callData.from
|
|
2403
|
-
// };
|
|
2404
|
-
// const response = await this.initiateCall(payload);
|
|
2405
|
-
// if (response.status == 200) {
|
|
2406
|
-
// const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
|
|
2407
|
-
// this.getUserInformation(callAuthId);
|
|
2408
|
-
// this.recordCall = recordCall;
|
|
2409
|
-
// const tokenData: any = await this.getOutgoingCallToken(callAuthId);
|
|
2410
|
-
// // Connect to new call
|
|
2411
|
-
// const options: any = {
|
|
2412
|
-
// codecPreferences: ['opus', 'pcmu'],
|
|
2413
|
-
// closeProtection: true,
|
|
2414
|
-
// };
|
|
2415
|
-
// // Reuse existing Device if available; otherwise create and register once
|
|
2416
|
-
// if (!this.device) {
|
|
2417
|
-
// this.device = new Device(tokenData.token.value, options);
|
|
2418
|
-
// await this.device.register();
|
|
2419
|
-
// } else {
|
|
2420
|
-
// // Update token if Device supports it and token changed/rotated
|
|
2421
|
-
// try {
|
|
2422
|
-
// if ((this.device as any).updateToken) {
|
|
2423
|
-
// await (this.device as any).updateToken(tokenData.token.value);
|
|
2424
|
-
// }
|
|
2425
|
-
// } catch (e) {
|
|
2426
|
-
// console.warn('Device updateToken failed, proceeding with existing token', e);
|
|
2427
|
-
// }
|
|
2428
|
-
// }
|
|
2429
|
-
// const newCall = await this.device.connect({
|
|
2430
|
-
// params: {
|
|
2431
|
-
// From: this.callData.from,
|
|
2432
|
-
// To: phoneNumber,
|
|
2433
|
-
// Env: environment.abb,
|
|
2434
|
-
// Token: tokenData.token.id,
|
|
2435
|
-
// Ext: this.callData.extNum
|
|
2436
|
-
// },
|
|
2437
|
-
// rtcConstraints: { audio: { deviceId: 'default' } },
|
|
2438
|
-
// });
|
|
2439
|
-
// // Set new call as active
|
|
2440
|
-
// this.call = newCall;
|
|
2441
|
-
// this.callData = newCallData;
|
|
2442
|
-
// // Setup event listeners for new call
|
|
2443
|
-
// this.setupEventListeners();
|
|
2444
|
-
// // Poll call status
|
|
2445
|
-
// this.pollCallStatus(callAuthId);
|
|
2446
|
-
// console.log('New call initiated to:', phoneNumber);
|
|
2447
|
-
// this.cdr.detectChanges();
|
|
2448
|
-
// } else if (response.status == 201) {
|
|
2449
|
-
// swal("Error", response.message.join("<br/>"), "error");
|
|
2450
|
-
// // Restore held call if new call fails
|
|
2451
|
-
// if (this.heldCall) {
|
|
2452
|
-
// this.call = this.heldCall;
|
|
2453
|
-
// this.heldCall = undefined;
|
|
2454
|
-
// this.isCallOnHold = false;
|
|
2455
|
-
// this.call.mute(false);
|
|
2456
|
-
// }
|
|
2457
|
-
// }
|
|
2458
|
-
// } catch (error) {
|
|
2459
|
-
// console.error('Error adding participant:', error);
|
|
2460
|
-
// this.showRingAnimation = false;
|
|
2461
|
-
// // Restore held call on error
|
|
2462
|
-
// if (this.heldCall) {
|
|
2463
|
-
// this.call = this.heldCall;
|
|
2464
|
-
// this.heldCall = undefined;
|
|
2465
|
-
// this.isCallOnHold = false;
|
|
2466
|
-
// this.call.mute(false);
|
|
2467
|
-
// }
|
|
2468
|
-
// this.handleError(error);
|
|
2469
|
-
// }
|
|
2470
|
-
// }
|
|
2471
|
-
// acceptConcurrentCall(incomingCall: any) {
|
|
2472
|
-
// if (!incomingCall) return;
|
|
2473
|
-
// // Put current call on hold instead of disconnecting
|
|
2474
|
-
// if (this.call) {
|
|
2475
|
-
// this.heldCall = this.call;
|
|
2476
|
-
// this.isCallOnHold = true;
|
|
2477
|
-
// // Mute the held call
|
|
2478
|
-
// this.heldCall.mute(true);
|
|
2479
|
-
// }
|
|
2480
|
-
// incomingCall.accept();
|
|
2481
|
-
// this.call = incomingCall;
|
|
2482
|
-
// this.callData.phone = incomingCall.parameters['From'];
|
|
2483
|
-
// this.callData.name = incomingCall.customParameters?.get('name') || '-';
|
|
2484
|
-
// this.callData.img = incomingCall.customParameters?.get('image') || 'assets/images/user.jpg';
|
|
2485
|
-
// this.isConcurrentIncoming = false;
|
|
2486
|
-
// this.incomingCallDiv = false;
|
|
2487
|
-
// this.disbaleEndCallBtn = false;
|
|
2488
|
-
// // Reset timer for new call
|
|
2489
|
-
// this.stopTimer();
|
|
2490
|
-
// this.startTimer();
|
|
2491
|
-
// this.cdr.detectChanges();
|
|
2492
|
-
// }
|
|
2493
2362
|
callContact(contact) {
|
|
2494
|
-
var _a, _b;
|
|
2363
|
+
var _a, _b, _c;
|
|
2495
2364
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2496
|
-
console.log(
|
|
2365
|
+
console.log('Adding participant:', contact);
|
|
2366
|
+
// Check if there's an active call
|
|
2497
2367
|
if (!this.call || this.call.status() !== 'open') {
|
|
2498
2368
|
console.error('No active call');
|
|
2369
|
+
swal("Error", "No active call found", "error");
|
|
2499
2370
|
return;
|
|
2500
2371
|
}
|
|
2372
|
+
// Get the phone number from the contact
|
|
2501
2373
|
const phoneNumber = (_b = (_a = contact === null || contact === void 0 ? void 0 : contact.numbersList) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.number;
|
|
2502
2374
|
if (!phoneNumber) {
|
|
2503
|
-
console.error(
|
|
2375
|
+
console.error('No phone number found for contact');
|
|
2504
2376
|
return;
|
|
2505
2377
|
}
|
|
2506
2378
|
try {
|
|
2507
|
-
//
|
|
2379
|
+
// Put current call on hold
|
|
2508
2380
|
this.heldCall = this.call;
|
|
2509
2381
|
this.isCallOnHold = true;
|
|
2510
2382
|
this.heldCall.mute(true);
|
|
2383
|
+
// Close contacts panel and show ring animation
|
|
2511
2384
|
this.showContactsPanel = false;
|
|
2512
2385
|
this.showRingAnimation = true;
|
|
2513
|
-
|
|
2386
|
+
// Get the conference ID from the current call or use the stored one
|
|
2387
|
+
const conferenceId = this.conferenceId;
|
|
2388
|
+
if (!conferenceId) {
|
|
2514
2389
|
console.error("No conferenceId found for active call");
|
|
2515
2390
|
swal("Error", "Cannot add participant: conference not found", "error");
|
|
2516
2391
|
this.showRingAnimation = false;
|
|
2517
2392
|
return;
|
|
2518
2393
|
}
|
|
2519
|
-
//
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
});
|
|
2528
|
-
}), 1000);
|
|
2529
|
-
console.log("API Response:", this.conferenceId);
|
|
2394
|
+
// Add participant to the conference
|
|
2395
|
+
yield this.addParticipantToCall({
|
|
2396
|
+
from: (_c = this.callData) === null || _c === void 0 ? void 0 : _c.from,
|
|
2397
|
+
route: "OUTGOING",
|
|
2398
|
+
participantNumber: phoneNumber,
|
|
2399
|
+
conferenceId: conferenceId
|
|
2400
|
+
});
|
|
2401
|
+
console.log("Participant added to conference:", phoneNumber);
|
|
2530
2402
|
this.showRingAnimation = false;
|
|
2531
|
-
|
|
2532
|
-
// UI enters conference mode
|
|
2403
|
+
// Update UI to show conference mode
|
|
2533
2404
|
this.isConference = true;
|
|
2405
|
+
// Show success message
|
|
2406
|
+
swal("Success", "Participant is being added to your call", "success");
|
|
2534
2407
|
}
|
|
2535
|
-
catch (
|
|
2536
|
-
console.error(
|
|
2537
|
-
swal("Error", "Failed to add participant", "error");
|
|
2408
|
+
catch (error) {
|
|
2409
|
+
console.error('Error adding participant:', error);
|
|
2538
2410
|
this.showRingAnimation = false;
|
|
2411
|
+
// Restore held call on error
|
|
2539
2412
|
if (this.heldCall) {
|
|
2540
2413
|
this.call = this.heldCall;
|
|
2541
2414
|
this.heldCall = undefined;
|
|
2542
|
-
this.call.mute(false);
|
|
2543
2415
|
this.isCallOnHold = false;
|
|
2416
|
+
this.call.mute(false);
|
|
2544
2417
|
}
|
|
2418
|
+
this.handleError(error);
|
|
2545
2419
|
}
|
|
2546
2420
|
});
|
|
2547
2421
|
}
|
|
2422
|
+
// acceptConcurrentCall(incomingCall: any) {
|
|
2423
|
+
// if (!incomingCall) return;
|
|
2424
|
+
// // Put current call on hold instead of disconnecting
|
|
2425
|
+
// if (this.call) {
|
|
2426
|
+
// this.heldCall = this.call;
|
|
2427
|
+
// this.isCallOnHold = true;
|
|
2428
|
+
// // Mute the held call
|
|
2429
|
+
// this.heldCall.mute(true);
|
|
2430
|
+
// }
|
|
2431
|
+
// incomingCall.accept();
|
|
2432
|
+
// this.call = incomingCall;
|
|
2433
|
+
// this.callData.phone = incomingCall.parameters['From'];
|
|
2434
|
+
// this.callData.name = incomingCall.customParameters?.get('name') || '-';
|
|
2435
|
+
// this.callData.img = incomingCall.customParameters?.get('image') || 'assets/images/user.jpg';
|
|
2436
|
+
// this.isConcurrentIncoming = false;
|
|
2437
|
+
// this.incomingCallDiv = false;
|
|
2438
|
+
// this.disbaleEndCallBtn = false;
|
|
2439
|
+
// // Reset timer for new call
|
|
2440
|
+
// this.stopTimer();
|
|
2441
|
+
// this.startTimer();
|
|
2442
|
+
// this.cdr.detectChanges();
|
|
2443
|
+
// }
|
|
2548
2444
|
acceptConcurrentCall(incomingCall) {
|
|
2549
2445
|
var _a, _b;
|
|
2550
2446
|
if (!incomingCall)
|