@vgroup/dialbox 0.2.65 → 0.2.66
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 +27 -12
- package/esm2020/lib/service/extension.service.mjs +9 -1
- package/fesm2015/vgroup-dialbox.mjs +38 -13
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +34 -11
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/components/call-progress/call-progress.component.d.ts +1 -0
- package/lib/service/extension.service.d.ts +1 -0
- package/package.json +1 -1
|
@@ -604,6 +604,14 @@ class ExtensionService {
|
|
|
604
604
|
console.log(payload, 'payload');
|
|
605
605
|
return this.http.post(environment.apiUrl + '/utilities/ext/ur/add/participant', payload, httpOptions);
|
|
606
606
|
}
|
|
607
|
+
holdParticipant(payload) {
|
|
608
|
+
const headers = new HttpHeaders({
|
|
609
|
+
'Content-Type': 'application/json',
|
|
610
|
+
'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token')
|
|
611
|
+
});
|
|
612
|
+
const httpOptions = { headers };
|
|
613
|
+
return this.http.post(environment.apiUrl + '/utilities/ext/ur/hold/participant', payload, httpOptions);
|
|
614
|
+
}
|
|
607
615
|
// getAllParticipants(id:any, payload: any) {
|
|
608
616
|
// const params = {
|
|
609
617
|
// "conferenceId": payload.conferenceId,
|
|
@@ -2124,12 +2132,20 @@ class CallProgressComponent {
|
|
|
2124
2132
|
yield this.connectToDevice(tokenData.token, callData);
|
|
2125
2133
|
yield this.pollCallStatus(callAuthId);
|
|
2126
2134
|
setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2135
|
+
try {
|
|
2136
|
+
const addRes = yield this.addParticipantToCall({
|
|
2137
|
+
from: callData === null || callData === void 0 ? void 0 : callData.from,
|
|
2138
|
+
route: "OUTGOING",
|
|
2139
|
+
participantNumber: callData === null || callData === void 0 ? void 0 : callData.phone,
|
|
2140
|
+
conferenceId: this.conferenceId
|
|
2141
|
+
});
|
|
2142
|
+
// Save participantId for the active leg so we can hold/unhold later
|
|
2143
|
+
this.callData = Object.assign(Object.assign({}, this.callData), { participantId: addRes === null || addRes === void 0 ? void 0 : addRes.participantId });
|
|
2144
|
+
console.log('Initial participantId:', addRes === null || addRes === void 0 ? void 0 : addRes.participantId);
|
|
2145
|
+
}
|
|
2146
|
+
catch (e) {
|
|
2147
|
+
console.error('Error adding initial participant:', e);
|
|
2148
|
+
}
|
|
2133
2149
|
}), 1000);
|
|
2134
2150
|
// Poll the status for 30-45 seconds
|
|
2135
2151
|
}
|
|
@@ -2152,6 +2168,11 @@ class CallProgressComponent {
|
|
|
2152
2168
|
return yield this.extensionService.initiateCall(payload).toPromise();
|
|
2153
2169
|
});
|
|
2154
2170
|
}
|
|
2171
|
+
onholdOrUnholdParticipant(payload) {
|
|
2172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2173
|
+
return yield this.extensionService.holdParticipant(payload).toPromise();
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2155
2176
|
addParticipantToCall(payload) {
|
|
2156
2177
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2157
2178
|
return yield this.extensionService.addParticipant(payload).toPromise();
|
|
@@ -2360,13 +2381,12 @@ class CallProgressComponent {
|
|
|
2360
2381
|
this.GetContactsList();
|
|
2361
2382
|
}
|
|
2362
2383
|
callContact(contact) {
|
|
2363
|
-
var _a, _b, _c;
|
|
2384
|
+
var _a, _b, _c, _d;
|
|
2364
2385
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2365
2386
|
console.log('Adding participant:', contact);
|
|
2366
2387
|
// Check if there's an active call
|
|
2367
2388
|
if (!this.call || this.call.status() !== 'open') {
|
|
2368
2389
|
console.error('No active call');
|
|
2369
|
-
swal("Error", "No active call found", "error");
|
|
2370
2390
|
return;
|
|
2371
2391
|
}
|
|
2372
2392
|
// Get the phone number from the contact
|
|
@@ -2376,6 +2396,11 @@ class CallProgressComponent {
|
|
|
2376
2396
|
return;
|
|
2377
2397
|
}
|
|
2378
2398
|
try {
|
|
2399
|
+
yield this.onholdOrUnholdParticipant({
|
|
2400
|
+
participantId: (_c = this.callData) === null || _c === void 0 ? void 0 : _c.participantId,
|
|
2401
|
+
conferenceId: this.conferenceId,
|
|
2402
|
+
hold: true
|
|
2403
|
+
});
|
|
2379
2404
|
// Put current call on hold
|
|
2380
2405
|
this.heldCall = this.call;
|
|
2381
2406
|
this.isCallOnHold = true;
|
|
@@ -2392,16 +2417,16 @@ class CallProgressComponent {
|
|
|
2392
2417
|
return;
|
|
2393
2418
|
}
|
|
2394
2419
|
// Add participant to the conference
|
|
2395
|
-
yield this.addParticipantToCall({
|
|
2396
|
-
from: (
|
|
2420
|
+
const addRes = yield this.addParticipantToCall({
|
|
2421
|
+
from: (_d = this.callData) === null || _d === void 0 ? void 0 : _d.from,
|
|
2397
2422
|
route: "OUTGOING",
|
|
2398
2423
|
participantNumber: phoneNumber,
|
|
2399
2424
|
conferenceId: conferenceId
|
|
2400
2425
|
});
|
|
2401
|
-
|
|
2426
|
+
// Save the new participant's id for future actions (hold/unhold/remove)
|
|
2427
|
+
this.callData = Object.assign(Object.assign({}, this.callData), { lastAddedParticipantId: addRes === null || addRes === void 0 ? void 0 : addRes.participantId });
|
|
2428
|
+
console.log("Participant added to conference:", phoneNumber, 'id:', addRes === null || addRes === void 0 ? void 0 : addRes.participantId);
|
|
2402
2429
|
this.showRingAnimation = false;
|
|
2403
|
-
// Show success message
|
|
2404
|
-
swal("Success", "Participant is being added to your call", "success");
|
|
2405
2430
|
}
|
|
2406
2431
|
catch (error) {
|
|
2407
2432
|
console.error('Error adding participant:', error);
|