KI-AGENT: Telefonie-Trunk in Firmeneinstellungen verschieben
This commit is contained in:
@@ -132,6 +132,20 @@ const mcpTokenForm = reactive({
|
||||
name: "Codex MCP Token",
|
||||
expiresAt: ""
|
||||
})
|
||||
const telephonyTrunkLoading = ref(false)
|
||||
const telephonyTrunkSaving = ref(false)
|
||||
const telephonyTrunkForm = reactive({
|
||||
enabled: false,
|
||||
registrar: "tel.t-online.de",
|
||||
sipUser: "",
|
||||
authUser: "",
|
||||
password: "",
|
||||
passwordConfigured: false,
|
||||
clearPassword: false,
|
||||
callerId: "",
|
||||
inboundExtension: "1001",
|
||||
outboundPrefix: "0"
|
||||
})
|
||||
|
||||
const setupPage = async () => {
|
||||
itemInfo.value = auth.activeTenantData
|
||||
@@ -193,6 +207,71 @@ const loadMcpTokens = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const loadTelephonyTrunk = async () => {
|
||||
telephonyTrunkLoading.value = true
|
||||
|
||||
try {
|
||||
const res = await useNuxtApp().$api("/api/telephony/trunk-config")
|
||||
telephonyTrunkForm.enabled = Boolean(res?.enabled)
|
||||
telephonyTrunkForm.registrar = res?.registrar || "tel.t-online.de"
|
||||
telephonyTrunkForm.sipUser = res?.sipUser || ""
|
||||
telephonyTrunkForm.authUser = res?.authUser || ""
|
||||
telephonyTrunkForm.password = ""
|
||||
telephonyTrunkForm.passwordConfigured = Boolean(res?.passwordConfigured)
|
||||
telephonyTrunkForm.clearPassword = false
|
||||
telephonyTrunkForm.callerId = res?.callerId || ""
|
||||
telephonyTrunkForm.inboundExtension = res?.inboundExtension || "1001"
|
||||
telephonyTrunkForm.outboundPrefix = res?.outboundPrefix || "0"
|
||||
} catch (error) {
|
||||
toast.add({ title: "Telefonie-Trunk konnte nicht geladen werden", color: "error" })
|
||||
} finally {
|
||||
telephonyTrunkLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const saveTelephonyTrunk = async () => {
|
||||
if (telephonyTrunkForm.enabled && (!telephonyTrunkForm.sipUser?.trim() || (!telephonyTrunkForm.password?.trim() && !telephonyTrunkForm.passwordConfigured))) {
|
||||
toast.add({
|
||||
title: "Telekom-Zugang unvollständig",
|
||||
description: "Bitte gib mindestens SIP-ID und Kennwort an.",
|
||||
color: "orange"
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
telephonyTrunkSaving.value = true
|
||||
|
||||
try {
|
||||
const res = await useNuxtApp().$api("/api/telephony/trunk-config", {
|
||||
method: "PUT",
|
||||
body: {
|
||||
enabled: telephonyTrunkForm.enabled,
|
||||
registrar: telephonyTrunkForm.registrar,
|
||||
sipUser: telephonyTrunkForm.sipUser,
|
||||
authUser: telephonyTrunkForm.authUser,
|
||||
password: telephonyTrunkForm.password,
|
||||
clearPassword: telephonyTrunkForm.clearPassword,
|
||||
callerId: telephonyTrunkForm.callerId,
|
||||
inboundExtension: telephonyTrunkForm.inboundExtension,
|
||||
outboundPrefix: telephonyTrunkForm.outboundPrefix
|
||||
}
|
||||
})
|
||||
|
||||
telephonyTrunkForm.password = ""
|
||||
telephonyTrunkForm.passwordConfigured = Boolean(res?.passwordConfigured)
|
||||
telephonyTrunkForm.clearPassword = false
|
||||
toast.add({ title: "Telefonie-Trunk gespeichert", color: "success" })
|
||||
} catch (error) {
|
||||
toast.add({
|
||||
title: "Telefonie-Trunk konnte nicht gespeichert werden",
|
||||
description: error?.data?.error || error?.message,
|
||||
color: "error"
|
||||
})
|
||||
} finally {
|
||||
telephonyTrunkSaving.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" })
|
||||
@@ -246,7 +325,10 @@ const deactivateMcpToken = async (token) => {
|
||||
}
|
||||
|
||||
setupPage()
|
||||
onMounted(loadMcpTokens)
|
||||
onMounted(() => {
|
||||
loadMcpTokens()
|
||||
loadTelephonyTrunk()
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -356,6 +438,89 @@ onMounted(loadMcpTokens)
|
||||
</div>
|
||||
<div v-else-if="item.label === 'Integrationen'">
|
||||
<UCard class="mt-5">
|
||||
<div class="mb-8 space-y-6">
|
||||
<div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
|
||||
<div>
|
||||
<h3 class="text-base font-semibold text-highlighted">Telefonie-Trunk</h3>
|
||||
<p class="text-sm text-muted">Konfiguriere den Telekom-Anschluss für externe Anrufe über Asterisk.</p>
|
||||
</div>
|
||||
<UBadge :color="telephonyTrunkForm.enabled ? 'success' : 'neutral'" variant="soft">
|
||||
{{ telephonyTrunkForm.enabled ? "Aktiv" : "Inaktiv" }}
|
||||
</UBadge>
|
||||
</div>
|
||||
|
||||
<UAlert
|
||||
title="Telekom Zugangsdaten"
|
||||
color="neutral"
|
||||
variant="outline"
|
||||
>
|
||||
<template #description>
|
||||
<p class="text-sm">
|
||||
Die SIP-ID ist meistens deine Rufnummer mit Vorwahl ohne Leerzeichen und Sonderzeichen.
|
||||
Falls dein Anschluss die klassischen Zugangsdaten nutzt, kannst du den Auth-User aus
|
||||
Anschlusskennung, Zugangsnummer, #, Mitbenutzernummer und @t-online.de bilden.
|
||||
</p>
|
||||
</template>
|
||||
</UAlert>
|
||||
|
||||
<div class="grid gap-4 md:grid-cols-2">
|
||||
<UFormField label="Trunk aktivieren">
|
||||
<USwitch v-model="telephonyTrunkForm.enabled" />
|
||||
</UFormField>
|
||||
<UFormField label="Registrar">
|
||||
<UInput v-model="telephonyTrunkForm.registrar" placeholder="tel.t-online.de" />
|
||||
</UFormField>
|
||||
<UFormField label="SIP-ID / Rufnummer">
|
||||
<UInput v-model="telephonyTrunkForm.sipUser" placeholder="0301234567" />
|
||||
</UFormField>
|
||||
<UFormField label="Auth-User">
|
||||
<UInput v-model="telephonyTrunkForm.authUser" placeholder="Optional" />
|
||||
</UFormField>
|
||||
<UFormField :label="telephonyTrunkForm.passwordConfigured ? 'Kennwort ersetzen' : 'Kennwort'">
|
||||
<UInput
|
||||
v-model="telephonyTrunkForm.password"
|
||||
type="password"
|
||||
:placeholder="telephonyTrunkForm.passwordConfigured ? 'Bereits gespeichert' : 'Persönliches Kennwort'"
|
||||
/>
|
||||
</UFormField>
|
||||
<UFormField label="Gespeichertes Kennwort löschen">
|
||||
<USwitch
|
||||
v-model="telephonyTrunkForm.clearPassword"
|
||||
:disabled="!telephonyTrunkForm.passwordConfigured"
|
||||
/>
|
||||
</UFormField>
|
||||
<UFormField label="Absendernummer">
|
||||
<UInput v-model="telephonyTrunkForm.callerId" placeholder="Optional, z. B. 0301234567" />
|
||||
</UFormField>
|
||||
<UFormField label="Eingehende Nebenstelle">
|
||||
<UInput v-model="telephonyTrunkForm.inboundExtension" placeholder="1001" />
|
||||
</UFormField>
|
||||
<UFormField label="Ausgehender Prefix">
|
||||
<UInput v-model="telephonyTrunkForm.outboundPrefix" placeholder="0" />
|
||||
</UFormField>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UButton
|
||||
icon="i-heroicons-arrow-path"
|
||||
variant="outline"
|
||||
:loading="telephonyTrunkLoading"
|
||||
@click="loadTelephonyTrunk"
|
||||
>
|
||||
Laden
|
||||
</UButton>
|
||||
<UButton
|
||||
icon="i-heroicons-check"
|
||||
:loading="telephonyTrunkSaving"
|
||||
@click="saveTelephonyTrunk"
|
||||
>
|
||||
Telefonie-Trunk speichern
|
||||
</UButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<USeparator class="mb-8" />
|
||||
|
||||
<div class="space-y-6">
|
||||
<div class="flex flex-col gap-3 md:flex-row md:items-start md:justify-between">
|
||||
<div>
|
||||
|
||||
Reference in New Issue
Block a user