The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.
TypeScript ai-receptionistanswering-serviceappointment-bookinglivekitlocal-firstmcpopen-sourceself-hostedsiptelephonytypescriptvoice-agentvoice-ai
// The parts the list and the open call share: the call's status and whom it went to.
import type { Call } from '@linedesk/db/types'
import { useT } from '@linedesk/i18n/react'
import { formatPhone } from '../inbox-model.ts'
import { useRows } from '../store.tsx'
import { parseTs, shortDuration } from '../time.ts'
import { Badge } from '../ui/kit.tsx'
import { LiveIndicator } from '../ui/LiveIndicator.tsx'
import { isLive } from './model.ts'
/** Live with its clock, or how it ended: not answered (nobody spoke to the assistant), or its length. */
export function OutboundStatus({ call, answered }: { call: Call; answered: boolean }) {
const t = useT()
if (isLive(call)) return <LiveIndicator since={parseTs(call.started_at)} />
if (!answered) return <Badge>{t('call.outbound.status.notAnswered')}</Badge>
return <Badge>{t('call.outbound.status.ended', { duration: shortDuration(call.duration_sec ?? 0) })}</Badge>
}
/** Whom the call went to: the contact's name, else the number. */
export function useCalleeName(call: Call): string {
const contacts = useRows('contacts')
const contact = call.contact_id ? contacts.find(c => c.id === call.contact_id) : undefined
return (!contact?.deleted_at && contact?.name) || formatPhone(call.to_number)
}