Skip to content

Commit

Permalink
Add ability to disable outbounds using attrs on the portal object (#1284
Browse files Browse the repository at this point in the history
)
  • Loading branch information
tabiodun authored Nov 4, 2024
1 parent 40a5cc3 commit eb1962c
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/phone/PhoneOverlay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,8 @@ const {
:calls="callHistory"
:table-body-style="{ height: '30rem' }"
@row-click="
({ mobile }) => {
setManualOutbound(mobile);
({ phone_number }) => {
setManualOutbound(phone_number);
}
"
></CallHistory>
Expand Down
31 changes: 31 additions & 0 deletions src/hooks/useConnectFirst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,22 @@ export default function useConnectFirst(context: {
}

async function dialManualOutbound(number: string) {
const portalResponse = await axios.get(
`${import.meta.env.VITE_APP_API_BASE_URL}/portals/current`,
{
headers: {
Authorization: null,
},
},
);

const portal = portalResponse?.data;

if (portal?.attr?.disable_outbound_calls) {
$toasted.warning(t('~~Outbound Calls are currently disabled'));
return;
}

await loginPhone(true, 'WORKING');
dialing.value = true;
try {
Expand All @@ -261,6 +277,21 @@ export default function useConnectFirst(context: {
}

async function dialNextOutbound() {
const portalResponse = await axios.get(
`${import.meta.env.VITE_APP_API_BASE_URL}/portals/current`,
{
headers: {
Authorization: null,
},
},
);

const portal = portalResponse?.data;

if (portal?.attr?.disable_outbound_calls) {
throw new Error(t('~~Outbound Calls are currently disabled'));
}

dialing.value = true;
try {
const outbound = await PhoneOutbound.api().getNextOutbound({
Expand Down

0 comments on commit eb1962c

Please sign in to comment.