@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
|
@@ -603,6 +603,14 @@ class ExtensionService {
|
|
|
603
603
|
console.log(payload, 'payload');
|
|
604
604
|
return this.http.post(environment.apiUrl + '/utilities/ext/ur/add/participant', payload, httpOptions);
|
|
605
605
|
}
|
|
606
|
+
holdParticipant(payload) {
|
|
607
|
+
const headers = new HttpHeaders({
|
|
608
|
+
'Content-Type': 'application/json',
|
|
609
|
+
'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token')
|
|
610
|
+
});
|
|
611
|
+
const httpOptions = { headers };
|
|
612
|
+
return this.http.post(environment.apiUrl + '/utilities/ext/ur/hold/participant', payload, httpOptions);
|
|
613
|
+
}
|
|
606
614
|
// getAllParticipants(id:any, payload: any) {
|
|
607
615
|
// const params = {
|
|
608
616
|
// "conferenceId": payload.conferenceId,
|
|
@@ -2119,12 +2127,20 @@ class CallProgressComponent {
|
|
|
2119
2127
|
await this.connectToDevice(tokenData.token, callData);
|
|
2120
2128
|
await this.pollCallStatus(callAuthId);
|
|
2121
2129
|
setTimeout(async () => {
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2130
|
+
try {
|
|
2131
|
+
const addRes = await this.addParticipantToCall({
|
|
2132
|
+
from: callData?.from,
|
|
2133
|
+
route: "OUTGOING",
|
|
2134
|
+
participantNumber: callData?.phone,
|
|
2135
|
+
conferenceId: this.conferenceId
|
|
2136
|
+
});
|
|
2137
|
+
// Save participantId for the active leg so we can hold/unhold later
|
|
2138
|
+
this.callData = { ...this.callData, participantId: addRes?.participantId };
|
|
2139
|
+
console.log('Initial participantId:', addRes?.participantId);
|
|
2140
|
+
}
|
|
2141
|
+
catch (e) {
|
|
2142
|
+
console.error('Error adding initial participant:', e);
|
|
2143
|
+
}
|
|
2128
2144
|
}, 1000);
|
|
2129
2145
|
// Poll the status for 30-45 seconds
|
|
2130
2146
|
}
|
|
@@ -2144,6 +2160,9 @@ class CallProgressComponent {
|
|
|
2144
2160
|
async initiateCall(payload) {
|
|
2145
2161
|
return await this.extensionService.initiateCall(payload).toPromise();
|
|
2146
2162
|
}
|
|
2163
|
+
async onholdOrUnholdParticipant(payload) {
|
|
2164
|
+
return await this.extensionService.holdParticipant(payload).toPromise();
|
|
2165
|
+
}
|
|
2147
2166
|
async addParticipantToCall(payload) {
|
|
2148
2167
|
return await this.extensionService.addParticipant(payload).toPromise();
|
|
2149
2168
|
}
|
|
@@ -2343,7 +2362,6 @@ class CallProgressComponent {
|
|
|
2343
2362
|
// Check if there's an active call
|
|
2344
2363
|
if (!this.call || this.call.status() !== 'open') {
|
|
2345
2364
|
console.error('No active call');
|
|
2346
|
-
swal("Error", "No active call found", "error");
|
|
2347
2365
|
return;
|
|
2348
2366
|
}
|
|
2349
2367
|
// Get the phone number from the contact
|
|
@@ -2353,6 +2371,11 @@ class CallProgressComponent {
|
|
|
2353
2371
|
return;
|
|
2354
2372
|
}
|
|
2355
2373
|
try {
|
|
2374
|
+
await this.onholdOrUnholdParticipant({
|
|
2375
|
+
participantId: this.callData?.participantId,
|
|
2376
|
+
conferenceId: this.conferenceId,
|
|
2377
|
+
hold: true
|
|
2378
|
+
});
|
|
2356
2379
|
// Put current call on hold
|
|
2357
2380
|
this.heldCall = this.call;
|
|
2358
2381
|
this.isCallOnHold = true;
|
|
@@ -2369,16 +2392,16 @@ class CallProgressComponent {
|
|
|
2369
2392
|
return;
|
|
2370
2393
|
}
|
|
2371
2394
|
// Add participant to the conference
|
|
2372
|
-
await this.addParticipantToCall({
|
|
2395
|
+
const addRes = await this.addParticipantToCall({
|
|
2373
2396
|
from: this.callData?.from,
|
|
2374
2397
|
route: "OUTGOING",
|
|
2375
2398
|
participantNumber: phoneNumber,
|
|
2376
2399
|
conferenceId: conferenceId
|
|
2377
2400
|
});
|
|
2378
|
-
|
|
2401
|
+
// Save the new participant's id for future actions (hold/unhold/remove)
|
|
2402
|
+
this.callData = { ...this.callData, lastAddedParticipantId: addRes?.participantId };
|
|
2403
|
+
console.log("Participant added to conference:", phoneNumber, 'id:', addRes?.participantId);
|
|
2379
2404
|
this.showRingAnimation = false;
|
|
2380
|
-
// Show success message
|
|
2381
|
-
swal("Success", "Participant is being added to your call", "success");
|
|
2382
2405
|
}
|
|
2383
2406
|
catch (error) {
|
|
2384
2407
|
console.error('Error adding participant:', error);
|