Skip to content

Commit eb1962c

Browse files
authored
Add ability to disable outbounds using attrs on the portal object (#1284)
1 parent 40a5cc3 commit eb1962c

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

src/components/phone/PhoneOverlay.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ const {
486486
:calls="callHistory"
487487
:table-body-style="{ height: '30rem' }"
488488
@row-click="
489-
({ mobile }) => {
490-
setManualOutbound(mobile);
489+
({ phone_number }) => {
490+
setManualOutbound(phone_number);
491491
}
492492
"
493493
></CallHistory>

src/hooks/useConnectFirst.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,22 @@ export default function useConnectFirst(context: {
241241
}
242242

243243
async function dialManualOutbound(number: string) {
244+
const portalResponse = await axios.get(
245+
`${import.meta.env.VITE_APP_API_BASE_URL}/portals/current`,
246+
{
247+
headers: {
248+
Authorization: null,
249+
},
250+
},
251+
);
252+
253+
const portal = portalResponse?.data;
254+
255+
if (portal?.attr?.disable_outbound_calls) {
256+
$toasted.warning(t('~~Outbound Calls are currently disabled'));
257+
return;
258+
}
259+
244260
await loginPhone(true, 'WORKING');
245261
dialing.value = true;
246262
try {
@@ -261,6 +277,21 @@ export default function useConnectFirst(context: {
261277
}
262278

263279
async function dialNextOutbound() {
280+
const portalResponse = await axios.get(
281+
`${import.meta.env.VITE_APP_API_BASE_URL}/portals/current`,
282+
{
283+
headers: {
284+
Authorization: null,
285+
},
286+
},
287+
);
288+
289+
const portal = portalResponse?.data;
290+
291+
if (portal?.attr?.disable_outbound_calls) {
292+
throw new Error(t('~~Outbound Calls are currently disabled'));
293+
}
294+
264295
dialing.value = true;
265296
try {
266297
const outbound = await PhoneOutbound.api().getNextOutbound({

0 commit comments

Comments
 (0)