KI-AGENT: Asterisk-Trunk aus FEDEO anwenden
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script setup>
|
||||
const toast = useToast()
|
||||
const {
|
||||
loading,
|
||||
statusLoading,
|
||||
@@ -20,7 +21,55 @@ const {
|
||||
testWebSocket,
|
||||
} = useTelephonySoftphone()
|
||||
|
||||
onMounted(loadTelephony)
|
||||
const trunkStatus = ref(null)
|
||||
const trunkStatusLoading = ref(false)
|
||||
const trunkApplying = ref(false)
|
||||
|
||||
const loadTrunkStatus = async () => {
|
||||
trunkStatusLoading.value = true
|
||||
|
||||
try {
|
||||
trunkStatus.value = await useNuxtApp().$api("/api/telephony/trunk-status")
|
||||
} catch (error) {
|
||||
trunkStatus.value = {
|
||||
reachable: false,
|
||||
registered: false,
|
||||
hasRegistration: false,
|
||||
message: error?.data?.error || error?.message || "Trunk-Status konnte nicht geladen werden."
|
||||
}
|
||||
} finally {
|
||||
trunkStatusLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const applyTrunk = async () => {
|
||||
trunkApplying.value = true
|
||||
|
||||
try {
|
||||
const res = await useNuxtApp().$api("/api/telephony/trunk-config/apply", {
|
||||
method: "POST"
|
||||
})
|
||||
trunkStatus.value = res?.status || trunkStatus.value
|
||||
toast.add({
|
||||
title: res?.warning ? "Trunk-Konfiguration geschrieben" : "Trunk angewendet",
|
||||
description: res?.warning || (res?.status?.registered ? "Telekom-Registration ist aktiv." : "Asterisk wurde neu geladen."),
|
||||
color: res?.warning ? "orange" : "success"
|
||||
})
|
||||
} catch (error) {
|
||||
toast.add({
|
||||
title: "Trunk konnte nicht angewendet werden",
|
||||
description: error?.data?.error || error?.message,
|
||||
color: "error"
|
||||
})
|
||||
} finally {
|
||||
trunkApplying.value = false
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await loadTelephony()
|
||||
await loadTrunkStatus()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -143,6 +192,33 @@ onMounted(loadTelephony)
|
||||
:description="config?.external?.callerIdConfigured ? 'Konfiguriert' : 'Optional'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="mt-4 grid gap-3 lg:grid-cols-[1fr_auto] lg:items-center">
|
||||
<UAlert
|
||||
:color="trunkStatus?.registered ? 'success' : (trunkStatus?.reachable ? 'warning' : 'neutral')"
|
||||
:icon="trunkStatus?.registered ? 'i-heroicons-check-circle' : (trunkStatus?.reachable ? 'i-heroicons-exclamation-triangle' : 'i-heroicons-signal-slash')"
|
||||
:title="trunkStatus?.registered ? 'Telekom-Trunk registriert' : (trunkStatus?.hasRegistration ? 'Telekom-Trunk nicht registriert' : 'Keine Telekom-Registration aktiv')"
|
||||
:description="trunkStatus?.message || (trunkStatus?.reachable ? 'Asterisk-AMI ist erreichbar.' : 'Asterisk-AMI ist noch nicht erreichbar.')"
|
||||
/>
|
||||
<div class="flex flex-wrap gap-2 lg:justify-end">
|
||||
<UButton
|
||||
icon="i-heroicons-signal"
|
||||
variant="outline"
|
||||
:loading="trunkStatusLoading"
|
||||
@click="loadTrunkStatus"
|
||||
>
|
||||
Status prüfen
|
||||
</UButton>
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-path-rounded-square"
|
||||
variant="soft"
|
||||
:loading="trunkApplying"
|
||||
@click="applyTrunk"
|
||||
>
|
||||
Trunk anwenden
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
</UCard>
|
||||
|
||||
<div class="grid gap-4 lg:grid-cols-[1.1fr_0.9fr]">
|
||||
|
||||
@@ -134,6 +134,7 @@ const mcpTokenForm = reactive({
|
||||
})
|
||||
const telephonyTrunkLoading = ref(false)
|
||||
const telephonyTrunkSaving = ref(false)
|
||||
const telephonyTrunkApplying = ref(false)
|
||||
const telephonyTrunkForm = reactive({
|
||||
enabled: false,
|
||||
registrar: "tel.t-online.de",
|
||||
@@ -272,6 +273,30 @@ const saveTelephonyTrunk = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const applyTelephonyTrunk = async () => {
|
||||
telephonyTrunkApplying.value = true
|
||||
|
||||
try {
|
||||
const res = await useNuxtApp().$api("/api/telephony/trunk-config/apply", {
|
||||
method: "POST"
|
||||
})
|
||||
|
||||
toast.add({
|
||||
title: res?.warning ? "Trunk-Konfiguration geschrieben" : "Telefonie-Trunk angewendet",
|
||||
description: res?.warning || (res?.status?.registered ? "Telekom-Registration ist aktiv." : "Asterisk wurde neu geladen."),
|
||||
color: res?.warning ? "orange" : "success"
|
||||
})
|
||||
} catch (error) {
|
||||
toast.add({
|
||||
title: "Telefonie-Trunk konnte nicht angewendet werden",
|
||||
description: error?.data?.error || error?.message,
|
||||
color: "error"
|
||||
})
|
||||
} finally {
|
||||
telephonyTrunkApplying.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const createMcpToken = async () => {
|
||||
if (!mcpTokenForm.name?.trim()) {
|
||||
toast.add({ title: "Name fehlt", description: "Bitte gib einen Namen für den Token an.", color: "orange" })
|
||||
@@ -516,6 +541,15 @@ onMounted(() => {
|
||||
>
|
||||
Telefonie-Trunk speichern
|
||||
</UButton>
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-path-rounded-square"
|
||||
color="primary"
|
||||
variant="soft"
|
||||
:loading="telephonyTrunkApplying"
|
||||
@click="applyTelephonyTrunk"
|
||||
>
|
||||
In Asterisk anwenden
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user