diff --git a/src/components/phone/GeneralStats.vue b/src/components/phone/GeneralStats.vue
index 512d95ccd..ded554358 100644
--- a/src/components/phone/GeneralStats.vue
+++ b/src/components/phone/GeneralStats.vue
@@ -119,19 +119,19 @@
}}
{{ agentsAvailable || 0 }}
-
- {{ $t('phoneDashboard.total_people_waiting') }}({{
- $t(queue.language)
- }})
- {{ queue.inQueue || 0 }}
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -236,10 +236,6 @@ export default defineComponent({
() => agentStats.value,
(agents) => {
if (agents) {
- agentsOnline.value = agents.filter((agent) =>
- ['ENGAGED', 'TRANSITIONING'].includes(agent.state),
- ).length;
-
agentsAvailable.value = agents.filter((agent) =>
['AVAILABLE', 'WORKING'].includes(agent.state),
).length;
@@ -247,6 +243,13 @@ export default defineComponent({
},
);
+ watch(
+ () => stats.value.active,
+ () => {
+ agentsOnline.value = Number(stats.value.active) || 0;
+ },
+ );
+
const columns = ref(
makeTableColumns([
['id', '0.5fr', t('phoneDashboard.id')],
diff --git a/src/hooks/useConnectFirst.ts b/src/hooks/useConnectFirst.ts
index 9b78fbaf7..f337c4c79 100644
--- a/src/hooks/useConnectFirst.ts
+++ b/src/hooks/useConnectFirst.ts
@@ -243,7 +243,9 @@ export default function useConnectFirst(context: {
userId: currentUser?.value?.id,
language: currentUser?.value?.primary_language,
});
- await createOutboundCall(outbound, number);
+ if (outbound) {
+ await createOutboundCall(outbound, number);
+ }
} catch (error) {
$toasted.error(getErrorMessage(error));
} finally {
diff --git a/src/main.ts b/src/main.ts
index dbdc1735b..08946c282 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -67,7 +67,10 @@ axios.defaults.withCredentials = true;
axios.interceptors.response.use(
(response) => response,
(error) => {
- if (error instanceof AxiosError && error.response?.status === 400) {
+ if (
+ error instanceof AxiosError &&
+ [400, 408, 409, 422, 502].includes(error.response?.status as number)
+ ) {
return getAndToastWarningMessage(error);
}
},
diff --git a/src/pages/phone/PhoneSystem.vue b/src/pages/phone/PhoneSystem.vue
index 848cdd94c..630d7c24a 100644
--- a/src/pages/phone/PhoneSystem.vue
+++ b/src/pages/phone/PhoneSystem.vue
@@ -866,6 +866,8 @@ export default defineComponent({
const {
isOnCall,
+ isTakingCalls,
+ isTransitioning,
caller,
stats,
currentIncidentId,
@@ -1282,7 +1284,7 @@ export default defineComponent({
return response.results;
}
- async function onLoggedIn() {
+ async function onLoggedIn(forceOutbound = false) {
if (
allowCallType.value === AllowedCallType.BOTH &&
Number(stats.value.inQueue || stats.value.routing || 0) === 0
@@ -1305,6 +1307,18 @@ export default defineComponent({
} catch {
await setAway();
}
+ } else if (
+ forceOutbound &&
+ remainingCallbacks.value + remainingCalldowns.value > 0
+ ) {
+ if (isTakingCalls.value && !isOnCall.value && !isTransitioning.value) {
+ await setWorking();
+ try {
+ await dialNextOutbound();
+ } catch {
+ await setAvailable();
+ }
+ }
} else {
await setAvailable();
}
@@ -1505,6 +1519,12 @@ export default defineComponent({
}
await init();
+
+ setInterval(() => {
+ if (isTakingCalls.value && !isOnCall.value && !isTransitioning.value) {
+ onLoggedIn(true);
+ }
+ }, 20_000);
});
return {