// Integrations → Caller ID (plan step 3.5): the call log (GET /api/phone/calls, kept on the // server, so it survives a reload and shows calls taken while the manager was closed), new calls // live, a tap opens the caller's card; and how to connect the phone system (the UCM Action URL). import { useCallback, useEffect, useState } from 'react' import { PhoneIncoming } from 'lucide-react' import { errorMessage } from '@xenia/api' import { useFormat, useTranslation } from '@xenia/i18n' import { EmptyState, Spinner } from '@xenia/ui' import client from '../api/client' import { useLiveEvent } from '../live/useLiveEvent' import usePhoneStore from '../store/phoneStore' export default function PhonePage() { const { t } = useTranslation('manager') const { formatDateTime } = useFormat() const setActiveCall = usePhoneStore(s => s.setActiveCall) const [calls, setCalls] = useState(null) const [error, setError] = useState(null) const load = useCallback(async () => { try { setCalls((await client.get('/api/phone/calls', { params: { limit: 100 } })).data.calls); setError(null) } catch (err) { setError(errorMessage(err, t)) } }, [t]) useEffect(() => { load() }, [load]) useLiveEvent('call_incoming', load) useLiveEvent('ready', load) const hook = `${window.location.protocol}//${window.location.hostname}/api/phone/call-event?caller=\${CALLERID}&ext=\${EXTEN}` return (
{t('calls.intro')}
{t('calls.setupBody')}
{hook}
{t('calls.setupSecret')}