Skip to content

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.

Outbound AI calls over MCP and API: call.dial (PR 1969)

Tim Gutberlet7be05003f723
diff --git a/apps/agent/src/call-session.ts b/apps/agent/src/call-session.ts
index 08667e61..c287d3c8 100644
--- a/apps/agent/src/call-session.ts
+++ b/apps/agent/src/call-session.ts
@@ -17,6 +17,8 @@ import {
type ReportVoiceFailureData,
callStart,
callStartTest,
+ callStartOutbound,
+ type OutboundDialMetadata,
ASSISTANT_CALL_DEFAULT_MINUTES,
type PromptOverrides,
type KeySource,
@@ -136,6 +138,10 @@ export interface CallSession {
* limit line, and its opening says it is a demo (demoLines, in the call's main language). Missing on every other call.
*/
demo?: boolean
+ /** An outbound call call.dial started: whom the assistant phoned and why (outboundInstructions). Missing otherwise. */
+ outbound?: { to: string; goal: string }
+ /** An outbound call: the longest it may last, the outbound minutes the API left it (call.startOutbound). */
+ outboundMaxMinutes?: number
/**
* The workspace's country (ISO 3166-1 alpha-2): the region phone numbers the caller says are read in ("0151…" in
* Germany). Missing: 'US'.
@@ -171,6 +177,8 @@ export type CallTimings = Omit<z.input<typeof callRecordTimings.input>, 'callId'
type StartData = Pick<CallSession, 'callId' | 'workspaceId' | 'assistant' | 'contact'> & {
callToken?: string
+ /** call.startOutbound: the outbound minutes this call may use. */
+ outboundMaxMinutes?: number
/** `partner`: the call runs on the partner's own provider keys (S7); missing or null: the install's. */
keys?: 'partner' | null
blocked?: boolean
@@ -308,6 +316,7 @@ export type CallOrigin =
spamLikely?: boolean
}
| ({ kind: 'test'; room: string } & TestMetadata)
+ | ({ kind: 'outbound'; room: string } & OutboundDialMetadata)
/**
* The call test's simulated on-call person and the number it stands in for (transfer is on for the test).
@@ -417,11 +426,17 @@ export async function startCall(api: ApiClient, origin: CallOrigin): Promise<Cal
...(origin.attestation ? { attestation: origin.attestation } : {}),
...(origin.spamLikely ? { spamLikely: true } : {}),
})
- : await api.run(
- callStartTest,
- { room: origin.room, ...(origin.assistantId ? { assistantId: origin.assistantId } : {}) },
- { workspaceId: origin.workspaceId },
- )
+ : origin.kind === 'outbound'
+ ? await api.run(
+ callStartOutbound,
+ { room: origin.room, assistantId: origin.assistantId, to: origin.to },
+ { workspaceId: origin.workspaceId },
+ )
+ : await api.run(
+ callStartTest,
+ { room: origin.room, ...(origin.assistantId ? { assistantId: origin.assistantId } : {}) },
+ { workspaceId: origin.workspaceId },
+ )
const started = data as StartData
const {
callId,
@@ -475,7 +490,24 @@ export async function startCall(api: ApiClient, origin: CallOrigin): Promise<Cal
// The recording notice is part of the greeting text (LIN-819): the agent adds nothing.
// A public demo call says that it is one right after the greeting.
const demo = origin.kind === 'test' && origin.demo === true
- const greeted = forHours(inMainLanguage(configured), businessHours)
+ // An outbound call says the first sentence call.dial gave, in its language if it gave one, at any hour.
+ const dialled =
+ origin.kind === 'outbound' && configured
+ ? {
+ ...configured,
+ greeting: origin.firstSentence,
+ greeting_outside: null,
+ ...(origin.language
+ ? {
+ languages: {
+ ...(configured.languages ?? { mode: 'english' as const, allowed: [] }),
+ main: origin.language,
+ },
+ }
+ : {}),
+ }
+ : configured
+ const greeted = forHours(inMainLanguage(dialled), businessHours)
const assistant = demo ? withDemoOpening(greeted) : greeted
// A test room (the web app's test call, a call test): there is no caller ID, and the prompt says so (B4).
const played = origin.kind === 'test' ? origin.caller : undefined
@@ -507,7 +539,13 @@ export async function startCall(api: ApiClient, origin: CallOrigin): Promise<Cal
country: started.workspaceCountry ?? 'US',
teamLanguage: callLanguageOf(assistant, started.workspaceLanguage),
promptOverrides: started.promptOverrides ?? {},
- businessNumber: origin.kind === 'phone' ? origin.to : null,
+ businessNumber: origin.kind === 'phone' ? origin.to : origin.kind === 'outbound' ? origin.from : null,
+ ...(origin.kind === 'outbound'
+ ? {
+ outbound: { to: origin.to, goal: origin.goal },
+ ...(started.outboundMaxMinutes ? { outboundMaxMinutes: started.outboundMaxMinutes } : {}),
+ }
+ : {}),
...(origin.kind === 'test' && origin.realtimeModel && !billed ? { realtimeModel: origin.realtimeModel } : {}),
// Changes no price: the call keeps its level, only the model's connection never opens.
...(origin.kind === 'test' && origin.realtimeUnreachable ? { realtimeUnreachable: true } : {}),
@@ -582,6 +620,32 @@ export function callOrigin(jobMetadata: string, attributes: Record<string, strin
}
}
+/** Whom to phone and why, from the dispatch call.dial signed (apps/api/src/outbound-call.ts); null for any other room. */
+export function parseOutboundMetadata(metadata: string): OutboundDialMetadata | null {
+ if (!metadata) return null
+ try {
+ const m = JSON.parse(metadata) as Partial<OutboundDialMetadata>
+ if (m.source !== 'outbound') return null
+ const text = (v: unknown): v is string => typeof v === 'string' && v.length > 0
+ if (!text(m.workspaceId) || !text(m.assistantId) || !text(m.to) || !text(m.from) || !text(m.goal)) return null
+ if (!text(m.firstSentence)) return null
+ return {
+ source: 'outbound',
+ workspaceId: m.workspaceId,
+ assistantId: m.assistantId,
+ to: m.to,
+ from: m.from,
+ goal: m.goal,
+ firstSentence: m.firstSentence,
+ ...(typeof m.language === 'string' && (languageCodes as string[]).includes(m.language)
+ ? { language: m.language }
+ : {}),
+ }
+ } catch {
+ return null
+ }
+}
+
/** The workspace (and the assistant picked in the web app) of a test room the API signed, or null for any other room. */
export function parseTestMetadata(metadata: string): TestMetadata | null {
if (!metadata) return null
diff --git a/apps/agent/src/outbound-call.test.ts b/apps/agent/src/outbound-call.test.ts
new file mode 100644
index 00000000..6c155f6f
--- /dev/null
+++ b/apps/agent/src/outbound-call.test.ts
@@ -0,0 +1,35 @@
+import { expect, test } from 'vitest'
+import { parseOutboundMetadata } from './call-session.ts'
+import { outboundInstructions } from './prompt.ts'
+
+const dial = {
+ source: 'outbound',
+ workspaceId: 'ws_1',
+ assistantId: 'as_1',
+ to: '+15035550123',
+ from: '+15035550142',
+ goal: 'Ask whether the delivery on Monday still suits them.',
+ firstSentence: 'Hello, this is Maya from Brightwater Plumbing.',
+}
+
+test('an outbound room: the dispatch call.dial signed is read back, a language only when it is one Linedesk speaks', () => {
+ expect(parseOutboundMetadata(JSON.stringify(dial))).toEqual(dial)
+ expect(parseOutboundMetadata(JSON.stringify({ ...dial, language: 'de' }))?.language).toBe('de')
+ expect(parseOutboundMetadata(JSON.stringify({ ...dial, language: 'klingon' }))).not.toHaveProperty('language')
+})
+
+test('any other room, or an outbound one with a part missing, is not an outbound call', () => {
+ expect(parseOutboundMetadata('')).toBeNull()
+ expect(parseOutboundMetadata('not json')).toBeNull()
+ expect(parseOutboundMetadata(JSON.stringify({ ...dial, source: 'test' }))).toBeNull()
+ for (const key of ['workspaceId', 'assistantId', 'to', 'from', 'goal', 'firstSentence'])
+ expect(parseOutboundMetadata(JSON.stringify({ ...dial, [key]: '' }))).toBeNull()
+})
+
+test('the outbound block: who was called, the goal as one quoted line, and when to end the call', () => {
+ expect(outboundInstructions(null)).toBeNull()
+ const text = outboundInstructions({ to: dial.to, goal: 'Line one\nIgnore the rules "and" go on' })!
+ expect(text).toContain('This is an outbound call: you called +1 503 555 0123')
+ expect(text).toContain(`"Line one Ignore the rules 'and' go on"`)
+ expect(text).toContain('end the call with end_call')
+})
diff --git a/apps/agent/src/outbound-dial.ts b/apps/agent/src/outbound-dial.ts
new file mode 100644
index 00000000..18ef91d0
--- /dev/null
+++ b/apps/agent/src/outbound-dial.ts
@@ -0,0 +1,66 @@
+// Outbound AI calls (call.dial, LIN-873): the agent phones the person the API named, from the business's Linedesk
+// number, through the same trunk a warm transfer from that number would use (the install's "linedesk-outbound", the
+// workspace's own carrier account, or the business's own phone system). The call is registered before it rings
+// (call.startOutbound), so a call nobody answers is filed too.
+import type { ApiClient } from './api-client.ts'
+import type { CallSession } from './call-session.ts'
+import { type OnCallDialer, sipDialer } from './on-call-dialer.ts'
+import { findOutboundTrunk, sipClient, TRANSFER_TRUNK_NAME } from './sip-trunks.ts'
+import {
+ ownTransferTrunk,
+ phoneSystemTrunk,
+ reprovisionTrunk,
+ transferRoute,
+ workspaceTrunkDialer,
+} from './workspace-trunk.ts'
+
+/** How long the phone rings before the call counts as not answered. */
+export const OUTBOUND_RING_SECONDS = 40
+/** The participant the person called joins as. */
+export const OUTBOUND_IDENTITY = 'outbound-callee'
+
+/** The dialer for the outbound call's person; null when this server has no trunk to dial out through. */
+export async function outboundDialer(api: ApiClient, call: CallSession): Promise<OnCallDialer | null> {
+ const from = call.businessNumber
+ const to = call.outbound?.to
+ if (!from || !to) return null
+ const sip = sipClient()
+ const route = await transferRoute(api, call, from)
+ const { trunkName } = route
+ if (route.carrier === 'sip' && trunkName)
+ return workspaceTrunkDialer(
+ () => phoneSystemTrunk(api, sip, call, trunkName, from),
+ () => reprovisionTrunk(api, call, from),
+ trunkId => sipDialer({ sip, trunkId, to, from }),
+ )
+ if (route.carrier !== 'default' && trunkName)
+ return workspaceTrunkDialer(
+ () => ownTransferTrunk(api, sip, call, trunkName, from),
+ () => reprovisionTrunk(api, call),
+ trunkId => sipDialer({ sip, trunkId, to, from }),
+ )
+ const trunkId = await findOutboundTrunk(sip, TRANSFER_TRUNK_NAME)
+ return trunkId ? sipDialer({ sip, trunkId, to, from }) : null
+}
+
+/**
+ * Rings the person and resolves once they answered; rejects when nobody answered, the line was busy or the carrier
+ * refused the call. `maxCallSeconds`: the assistant's longest call.
+ */
+export async function dialOutbound(
+ api: ApiClient,
+ call: CallSession,
+ room: string,
+ maxCallSeconds: number | undefined,
+ signal: AbortSignal,
+): Promise<void> {
+ const dialer = await outboundDialer(api, call)
+ if (!dialer) throw new Error(`no outbound trunk: run setup-sip --outbound`)
+ await dialer.dial({
+ room,
+ identity: OUTBOUND_IDENTITY,
+ signal,
+ ringSeconds: OUTBOUND_RING_SECONDS,
+ ...(maxCallSeconds ? { maxCallSeconds } : {}),
+ })
+}
diff --git a/apps/agent/src/worker.ts b/apps/agent/src/worker.ts
index acdb0489..1b213d51 100644
--- a/apps/agent/src/worker.ts
+++ b/apps/agent/src/worker.ts
@@ -46,7 +46,15 @@ import {
import { onceEachStage, watchVoicePipeline } from './voice-failures.ts'
import { retryEmptyReplies } from './empty-reply.ts'
import { GREETING_WAIT_MS, lookUpCaller, PERSONAL_GREETING_WAIT_MS, within } from './caller-lookup.ts'
-import { callLimitOf, callOrigin, parseTestMetadata, startCall, type CallSession } from './call-session.ts'
+import {
+ callLimitOf,
+ callOrigin,
+ parseOutboundMetadata,
+ parseTestMetadata,
+ startCall,
+ type CallSession,
+} from './call-session.ts'
+import { dialOutbound } from './outbound-dial.ts'
import { earlyOrigin, livekitParticipants } from './early-origin.ts'
import {
type AgentConfig,
@@ -129,7 +137,7 @@ import {
import { lineAudio, playLine, unansweredLine } from './busy-line.ts'
import { realtimeLineSpeaker, type SayFixedLine } from './realtime-lines.ts'
import { promisesUrgent, urgentFlagger } from './urgent-promise.ts'
-import { buildInstructions, collectLanguageRule, spokenLanguageRule } from './prompt.ts'
+import { buildInstructions, collectLanguageRule, outboundInstructions, spokenLanguageRule } from './prompt.ts'
import { shopifyContext, shopifyInstructions } from './shopify-tools.ts'
import {
describeRecording,
@@ -251,6 +259,8 @@ async function greet(
return `cached${without}`
}
session.say(text)
+ // An outbound call's first sentence is written per call: said live, never stored as the assistant's greeting.
+ if (call.outbound) return `live${without}`
const voiceOfGreeting = createTts(
config.tts,
call.assistant?.voice,
@@ -703,6 +713,7 @@ async function converse(
),
spokenLanguageRule(callAssistant, spokenNow()),
shopifyInstructions(call.shopify ?? null, store.context),
+ outboundInstructions(call.outbound),
notes?.current(),
]
.filter(Boolean)
@@ -951,9 +962,12 @@ async function entry(ctx: JobContext) {
return runAsOnCallResponder(ctx, responder)
}
const api = apiClientFromEnv()
+ // An outbound call call.dial started (LIN-873): registered first, then the person is dialled; it goes on like any
+ // call once they answer. Nobody answering ends it (filed with what happened).
+ const outbound = parseOutboundMetadata(ctx.job.metadata)
// The call is registered while the agent joins the room when its origin is known already;
// a failure there is not final: it is registered again the normal way after joining.
- const early = registerEarly(ctx, api)
+ const early = outbound ? Promise.resolve(null) : registerEarly(ctx, api)
await ctx.connect()
setup.mark('connected')
// When the agent's audio goes out and is subscribed: on a phone call that is when LiveKit SIP answers (setup-timing.ts).
@@ -964,7 +978,34 @@ async function entry(ctx: JobContext) {
// A test call's caller may be our own test-caller agent (no-phone call test), which LiveKit's own wait skips.
// Nothing below waits for the caller, unless the call could not be registered without them.
const isTest = parseTestMetadata(ctx.job.metadata) !== null
- const callerJoined = (isTest ? waitForCounterpart(ctx) : ctx.waitForParticipant()).then(caller => {
+ const dialled = outbound ? await startCall(api, { kind: 'outbound', room: ctx.room.name ?? '', ...outbound }) : null
+ if (dialled?.blocked) {
+ // Not dialled: the API filed it (over the spending cap, every line busy, refused by billing).
+ await ctx.deleteRoom()
+ return ctx.shutdown('outbound call refused by the API')
+ }
+ const dialCancel = new AbortController()
+ ctx.addShutdownCallback(async () => dialCancel.abort())
+ const answered = dialled
+ ? dialOutbound(
+ api,
+ dialled,
+ ctx.room.name ?? '',
+ Math.min(
+ callLimitOf(dialled, { callLimit: '', testCallLimit: '' }).ms / 1000,
+ (dialled.outboundMaxMinutes ?? Number.POSITIVE_INFINITY) * 60,
+ ),
+ dialCancel.signal,
+ )
+ : null
+ // The person is in the call only once they picked up: the greeting must not play into the ringing.
+ const callerJoined = (
+ isTest
+ ? waitForCounterpart(ctx)
+ : answered
+ ? answered.then(() => ctx.waitForParticipant())
+ : ctx.waitForParticipant()
+ ).then(caller => {
setup.mark('caller')
return caller
})
@@ -972,6 +1013,7 @@ async function entry(ctx: JobContext) {
const lineOpen = phoneLineOpen(ctx.room, callerJoined).then(() => setup.mark('line open'))
callerJoined.catch(() => {}) // a caller who never comes: the session closes with the room; awaited below where needed
const registered =
+ dialled ??
(await early) ??
(await startCall(api, callOrigin(ctx.job.metadata, (await callerJoined).attributes, ctx.room.name ?? '')))
setup.mark('registered')
@@ -1074,7 +1116,23 @@ async function entry(ctx: JobContext) {
}
const finishOnce = once(finish, `could not finish call ${call.callId}`)
ctx.addShutdownCallback(finishOnce)
+ // Nobody answered the outbound call (no answer, busy, refused): it is filed with the reason, and the room closes.
+ answered?.catch(async e => {
+ log.record('system', `Outbound call not answered: ${e instanceof Error ? e.message : String(e)}`)
+ await finishOnce()
+ await ctx.deleteRoom()
+ ctx.shutdown('outbound call not answered')
+ })
try {
+ // An outbound call talks only once the person picked up; nobody answering is handled above.
+ if (
+ answered &&
+ !(await answered.then(
+ () => true,
+ () => false,
+ ))
+ )
+ return
await converse(
ctx,
callerJoined,
diff --git a/apps/api/src/handlers.ts b/apps/api/src/handlers.ts
index b7da9b2c..587bbd7d 100644
--- a/apps/api/src/handlers.ts
+++ b/apps/api/src/handlers.ts
@@ -1,4 +1,5 @@
// Server side of the registry. Patch actions run generically; the rest have a handler here.
+import { DIALS_PER_DAY, DIALS_PER_MINUTE, outboundCallHandlers, outboundCallPreparers } from './outbound-call.ts'
import {
type CallQuality,
raisesLevel,
@@ -141,7 +142,13 @@ import {
tryLockWorkspaceCarrier,
} from './workspace-carrier.ts'
import { refreshTransferTrunk, transferTrunkHandlers } from './transfer-trunk.ts'
-import { outboundHandlers, outboundRefusal, syncInstallDestinations } from './outbound-policy.ts'
+import {
+ numberRoute,
+ outboundHandlers,
+ outboundRefusal,
+ syncInstallDestinations,
+ transferMinutesAllowed,
+} from './outbound-policy.ts'
import { switchOffLoopingTransfers } from './transfer-loops.ts'
import { impersonationHandlers } from './impersonation.ts'
import type { Actor } from './context.ts'
@@ -476,6 +483,8 @@ type OpenCall = {
spamLikely?: boolean
/** The call test's new caller (call.newCallerForTest): answered as if the number were new. */
newCaller?: boolean
+ /** `out`: the assistant phoned `from` (call.dial); stored as from the business number to them. */
+ direction?: 'in' | 'out'
}
/**
@@ -502,7 +511,18 @@ function withCallToken<R extends { data: { callId: string; workspaceId: string }
async function openCall(
{ tx, now }: Pick<HandlerCtx, 'tx' | 'now'>,
workspace_id: string,
- { from, to, room, source = 'phone', label, assistant, attestation, spamLikely, newCaller = false }: OpenCall,
+ {
+ from,
+ to,
+ room,
+ source = 'phone',
+ label,
+ assistant,
+ attestation,
+ spamLikely,
+ newCaller = false,
+ direction = 'in',
+ }: OpenCall,
) {
const [workspace] = await tx
.select({ disabledAt: organization.disabledAt })
@@ -565,8 +585,10 @@ async function openCall(
id,
workspace_id,
contact_id: contact?.row.id ?? null,
- from_number: from,
- to_number: to,
+ // `from` is always the other party here (their contact): an outbound call is stored the other way round.
+ from_number: direction === 'out' ? to : from,
+ to_number: direction === 'out' ? from : to,
+ direction,
source,
started_at: now,
room: room ?? id,
@@ -1067,6 +1089,7 @@ function usageLevelChange(stored: LevelFields, after: LevelFields): UsageLevelCh
/** Actions with work before their transaction (handler-context.ts, Preparer). */
export const preparers: Record<string, Preparer> = {
+ ...outboundCallPreparers(),
...voicePreparers,
...authenticatorPreparers,
...stripeEventPreparers,
@@ -1362,6 +1385,7 @@ const handlers: Record<string, Handler> = {
...forwardingCheckHandlers(queueForwardingCheck),
...transferTrunkHandlers(),
...outboundHandlers(),
+ ...outboundCallHandlers,
...liveCallHandlers(),
...apiKeyHandlers,
...personalKeyHandlers,
@@ -1496,6 +1520,70 @@ const handlers: Record<string, Handler> = {
)
},
+ // An outbound call call.dial started: the workspace is the agent's x-workspace-id from the dispatch the API signed,
+ // and the number it calls from must still be one of that workspace's. A room is one call.
+ 'call.startOutbound': async ({ tx, actor, now }, input) => {
+ if (!actor.workspaceId) throw new Reject('no workspace (send x-workspace-id)')
+ const assistant = await assistantIn(tx, actor.workspaceId, input.assistantId)
+ const [number] = await tx
+ .select({ e164: phone_numbers.e164 })
+ .from(phone_numbers)
+ .where(eq(phone_numbers.workspace_id, actor.workspaceId))
+ .orderBy(asc(phone_numbers.created_at))
+ if (!number) throw Reject.t('server.api.dial.noNumber')
+ const [own] = await tx
+ .select({ e164: phone_numbers.e164 })
+ .from(phone_numbers)
+ .where(and(eq(phone_numbers.workspace_id, actor.workspaceId), eq(phone_numbers.assistant_id, input.assistantId)))
+ .orderBy(asc(phone_numbers.created_at))
+ .limit(1)
+ const business = (own ?? number).e164
+ // Checked again here, where the call is filed: the API decides at dial time, as for transfers.
+ if (!isE164(input.to)) throw Reject.t('server.api.dial.invalidNumber')
+ const route = await numberRoute(tx, actor.workspaceId, business)
+ const refusal = await outboundRefusal(tx, actor.workspaceId, input.to, 'call', { strict: true, route })
+ if (refusal) throw new Reject(refusal)
+ // One outbound call of the workspace at a time reads its counts and minutes (the transfers' lock and order).
+ await tx.execute(sql`select pg_advisory_xact_lock(hashtext(${`transfer:${actor.workspaceId}`}))`)
+ await tx.execute(sql`select pg_advisory_xact_lock(hashtext(${`outbound-room:${input.room}`}))`)
+ const [used] = await tx
+ .select({ id: calls.id })
+ .from(calls)
+ .where(and(eq(calls.workspace_id, actor.workspaceId), eq(calls.room, input.room)))
+ .limit(1)
+ if (used) throw Reject.t('server.api.dial.roomUsed')
+ // The lasting limits (the API's in-memory ones only filter early): calls started in the last minute and day.
+ const startedSince = async (ms: number) =>
+ (
+ await tx
+ .select({ n: sql<number>`count(*)::int` })
+ .from(calls)
+ .where(
+ and(
+ eq(calls.workspace_id, actor.workspaceId!),
+ eq(calls.direction, 'out'),
+ eq(calls.source, 'phone'),
+ gte(calls.started_at, new Date(Date.parse(now) - ms).toISOString()),
+ ),
+ )
+ )[0]?.n ?? 0
+ if ((await startedSince(60_000)) >= DIALS_PER_MINUTE || (await startedSince(24 * 3600_000)) >= DIALS_PER_DAY)
+ throw Reject.t('server.api.dial.tooMany')
+ // The outbound minutes left (workspace and, on the install's route, the install): transfers and these calls together.
+ const outboundMaxMinutes = await transferMinutesAllowed(tx, actor.workspaceId, now, route)
+ const opened = withCallToken(
+ await openCall({ tx, now }, actor.workspaceId, {
+ from: input.to,
+ to: business,
+ room: input.room,
+ label: input.to,
+ assistant,
+ direction: 'out',
+ }),
+ )
+ return { ...opened, data: { ...opened.data, outboundMaxMinutes } }
+ },
+
'call.findForTest': async ({ tx, now, calendars }, input) => {
const [number] = await tx.select().from(phone_numbers).where(eq(phone_numbers.e164, input.to))
if (!number) throw Reject.t('server.api.numberNotSetUp', { number: input.to })
diff --git a/apps/api/src/mcp.ts b/apps/api/src/mcp.ts
index 0331035d..93095278 100644
--- a/apps/api/src/mcp.ts
+++ b/apps/api/src/mcp.ts
@@ -132,7 +132,7 @@ function registerAction(server: McpServer, def: ActionDef, actor: Actor, persona
destructiveHint: def.readOnly ? false : personal ? true : Boolean(def.destructive),
// Only this install's data: the tools do not reach out to the open web. feedback.send is the one exception: it
// sends the report to the Linedesk team, outside this install.
- openWorldHint: def.name === 'feedback.send',
+ openWorldHint: def.name === 'feedback.send' || def.name === 'call.dial',
},
},
((raw: unknown) =>
diff --git a/apps/api/src/outbound-call.ts b/apps/api/src/outbound-call.ts
new file mode 100644
index 00000000..24e0f729
--- /dev/null
+++ b/apps/api/src/outbound-call.ts
@@ -0,0 +1,114 @@
+// Outbound AI calls (call.dial, LIN-873): an agent connected over MCP or the API asks the assistant to phone someone.
+// The API checks the request and starts the voice agent in a new room through a LiveKit agent dispatch whose
+// metadata says whom to call and why. The metadata is set here with the install's LiveKit key, so nobody else can
+// write it. The agent registers the call (call.startOutbound) and dials out through the same trunk as warm transfers
+// (apps/agent/src/outbound-dial.ts); from there on it is an ordinary call: transcript, summary, call-end webhook.
+import { type OutboundDialMetadata, isE164 } from '@linedesk/actions'
+import { assistants, phone_numbers } from '@linedesk/db'
+import { and, asc, eq } from 'drizzle-orm'
+import { randomUUID } from 'node:crypto'
+import { assistantForNumber } from './assistants.ts'
+import { db } from './db.ts'
+import { type Handler, type Preparer, Reject } from './handler-context.ts'
+import { livekitToken } from './livekit-status.ts'
+import { numberRoute, outboundRefusal } from './outbound-policy.ts'
+import { createRateLimiter } from './rate-limit.ts'
+
+type Env = Record<string, string | undefined>
+
+/** The voice agent's name (apps/agent/src/env.ts); it only joins rooms it is dispatched to by name. */
+const AGENT_NAME = 'linedesk'
+/** Outbound calls one workspace may start: a few a minute, more over the day (each costs money and reaches a person). */
+export const DIALS_PER_MINUTE = 5
+export const DIALS_PER_DAY = 200
+const perMinute = createRateLimiter({ max: DIALS_PER_MINUTE, windowMs: 60_000 })
+const perDay = createRateLimiter({ max: DIALS_PER_DAY, windowMs: 24 * 3600_000 })
+
+export type DialResult = { room: string; to: string; from: string; assistantId: string }
+
+/** Starts the agent in `room` with `metadata` (LiveKit AgentDispatchService, which creates the room). */
+export type Dispatcher = (room: string, metadata: OutboundDialMetadata) => Promise<void>
+
+export function livekitDispatcher(env: Env = process.env, doFetch: typeof fetch = fetch): Dispatcher | null {
+ const { LIVEKIT_URL: url, LIVEKIT_API_KEY: key, LIVEKIT_API_SECRET: secret } = env
+ if (!url || !key || !secret) return null
+ const base = `${url.replace(/^ws/, 'http').replace(/\/$/, '')}/twirp`
+ return async (room, metadata) => {
+ const token = livekitToken(key, secret, { video: { roomAdmin: true, roomCreate: true, room } })
+ const res = await doFetch(`${base}/livekit.AgentDispatchService/CreateDispatch`, {
+ method: 'POST',
+ body: JSON.stringify({ room, agent_name: AGENT_NAME, metadata: JSON.stringify(metadata) }),
+ headers: { authorization: `Bearer ${token}`, 'content-type': 'application/json' },
+ signal: AbortSignal.timeout(10_000),
+ })
+ // i18n-ignore: a log and command-log line for the operator, never shown in the app
+ if (!res.ok) throw new Error(`LiveKit CreateDispatch answered HTTP ${res.status}`)
+ }
+}
+
+/** The assistant that calls and the number it calls from: its own number, else the workspace's first one. */
+async function caller(workspaceId: string, assistantId: string | undefined) {
+ const numbers = await db
+ .select({ e164: phone_numbers.e164, assistant_id: phone_numbers.assistant_id })
+ .from(phone_numbers)
+ .where(eq(phone_numbers.workspace_id, workspaceId))
+ .orderBy(asc(phone_numbers.created_at))
+ if (assistantId) {
+ const [own] = await db
+ .select({ id: assistants.id })
+ .from(assistants)
+ .where(and(eq(assistants.id, assistantId), eq(assistants.workspace_id, workspaceId)))
+ if (!own) throw Reject.t('server.api.assistantNotFound')
+ const number = numbers.find(n => n.assistant_id === assistantId) ?? numbers[0]
+ return number ? { assistantId, from: number.e164 } : null
+ }
+ const number = numbers[0]
+ if (!number) return null
+ const assistant = await assistantForNumber(db, workspaceId, number.assistant_id)
+ return assistant ? { assistantId: assistant.id, from: number.e164 } : null
+}
+
+type Deps = { env?: Env; dispatch?: Dispatcher | null; now?: () => number }
+
+export function outboundCallPreparers(deps: () => Deps = () => ({})): Record<string, Preparer> {
+ return {
+ 'call.dial': async ({ actor }, input): Promise<DialResult> => {
+ const { env = process.env, dispatch = livekitDispatcher(env), now = Date.now } = deps()
+ const workspaceId = actor.workspaceId
+ if (!workspaceId) throw new Reject('no workspace (send x-workspace-id)')
+ if (!dispatch) throw Reject.t('server.api.dial.unavailable')
+ const to = input.to.replace(/[\s().-]/g, '')
+ if (!isE164(to)) throw Reject.t('server.api.dial.invalidNumber')
+ const from = await caller(workspaceId, input.assistantId)
+ if (!from) throw Reject.t('server.api.dial.noNumber')
+ if (to === from.from) throw Reject.t('server.api.dial.ownNumber')
+ const refusal = await outboundRefusal(db, workspaceId, to, 'call', {
+ strict: true,
+ env,
+ route: await numberRoute(db, workspaceId, from.from),
+ })
+ if (refusal) throw new Reject(refusal)
+ const at = now()
+ if (perMinute.full(workspaceId, at) || perDay.full(workspaceId, at)) throw Reject.t('server.api.dial.tooMany')
+ perMinute(workspaceId, at)
+ perDay(workspaceId, at)
+ const room = `outbound-${randomUUID()}`
+ await dispatch(room, {
+ source: 'outbound',
+ workspaceId,
+ assistantId: from.assistantId,
+ to,
+ from: from.from,
+ goal: input.goal,
+ firstSentence: input.first_sentence,
+ ...(input.language ? { language: input.language } : {}),
+ })
+ return { room, to, from: from.from, assistantId: from.assistantId }
+ },
+ }
+}
+
+export const outboundCallHandlers: Record<string, Handler> = {
+ // Everything happened in the preparer (the dispatch is a network call, kept out of the transaction).
+ 'call.dial': async ({ prepared }) => ({ rows: {}, data: prepared as DialResult }),
+}
diff --git a/apps/api/src/outbound-policy.ts b/apps/api/src/outbound-policy.ts
index 2a0b225a..a37c1b04 100644
--- a/apps/api/src/outbound-policy.ts
+++ b/apps/api/src/outbound-policy.ts
@@ -169,7 +169,23 @@ export async function transferMinutesUsed(
gte(calls.transfer_at, since),
),
)
- return (row?.seconds ?? 0) / 60
+ // Outbound AI calls (call.dial) go out through the same carrier accounts and count the same way, from their start.
+ const outInstall = sql`not exists (select 1 from ${phone_numbers} where ${phone_numbers.e164} = ${calls.from_number} and ${phone_numbers.workspace_id} = ${calls.workspace_id} and ${phone_numbers.carrier_account} <> 'install')`
+ const [out] = await tx
+ .select({
+ seconds: sql<number>`coalesce(sum(greatest(0, extract(epoch from (coalesce(${calls.ended_at}, ${now}::timestamptz) - ${calls.started_at})))), 0)::float`,
+ })
+ .from(calls)
+ .where(
+ and(
+ workspaceId ? eq(calls.workspace_id, workspaceId) : undefined,
+ route === 'install' ? outInstall : undefined,
+ eq(calls.source, 'phone'),
+ eq(calls.direction, 'out'),
+ gte(calls.started_at, since),
+ ),
+ )
+ return ((row?.seconds ?? 0) + (out?.seconds ?? 0)) / 60
}
/**
diff --git a/apps/api/test/outbound-calls.test.ts b/apps/api/test/outbound-calls.test.ts
new file mode 100644
index 00000000..300ec8d4
--- /dev/null
+++ b/apps/api/test/outbound-calls.test.ts
@@ -0,0 +1,84 @@
+// Outbound AI calls (call.dial, LIN-873): an owner's or admin's key asks the assistant to phone someone; the API starts
+// the agent through a LiveKit dispatch, and the agent registers the call as outbound (call.startOutbound).
+import { calls } from '@linedesk/db'
+import { eq } from 'drizzle-orm'
+import { afterAll, beforeAll, expect, test, vi } from 'vitest'
+import { db } from '../src/db.ts'
+import { act, addMember, agent, createWorkspace, randomNumber, type User, type Workspace } from './helpers.ts'
+
+const LIVEKIT = {
+ LIVEKIT_URL: 'ws://livekit.internal:7880',
+ LIVEKIT_API_KEY: 'test-key',
+ LIVEKIT_API_SECRET: 'test-secret-test-secret-test-secret',
+}
+const saved = { ...process.env }
+const realFetch = globalThis.fetch
+/** The dispatches the API sent to LiveKit. */
+const dispatched: { url: string; body: Record<string, string> }[] = []
+
+let ws: Workspace
+let member: User
+beforeAll(async () => {
+ Object.assign(process.env, LIVEKIT)
+ vi.spyOn(globalThis, 'fetch').mockImplementation(async (url, init) => {
+ if (String(url).startsWith('http://livekit.internal:7880/')) {
+ dispatched.push({ url: String(url), body: JSON.parse(String(init?.body)) })
+ return new Response('{}', { status: 200 })
+ }
+ return realFetch(url, init)
+ })
+ ws = await createWorkspace('Brightwater Plumbing & Heating')
+ member = await addMember(ws.id, 'member')
+})
+afterAll(() => {
+ vi.restoreAllMocks()
+ process.env = saved
+})
+
+const goal = 'Ask whether the appointment on Monday at 9 still suits them.'
+const firstSentence = 'Hello, this is Maya from Brightwater Plumbing.'
+
+test('an owner has the assistant phone a number: the agent is dispatched with whom to call and why', async () => {
+ const to = randomNumber()
+ const { status, body } = await act(ws.owner, 'call.dial', { to, goal, first_sentence: firstSentence, language: 'en' })
+ expect(status).toBe(200)
+ expect(body.data).toMatchObject({ to, from: ws.number, assistantId: ws.assistant.id })
+ expect(body.data.room).toMatch(/^outbound-/)
+ const sent = dispatched.at(-1)!
+ expect(sent.url).toBe('http://livekit.internal:7880/twirp/livekit.AgentDispatchService/CreateDispatch')
+ expect(sent.body.room).toBe(body.data.room)
+ expect(sent.body.agent_name).toBe('linedesk')
+ expect(JSON.parse(sent.body.metadata!)).toEqual({
+ source: 'outbound',
+ workspaceId: ws.id,
+ assistantId: ws.assistant.id,
+ to,
+ from: ws.number,
+ goal,
+ firstSentence,
+ language: 'en',
+ })
+})
+
+test('a member may not start outbound calls, and numbers the workspace may not call are refused', async () => {
+ const before = dispatched.length
+ expect((await act(member, 'call.dial', { to: randomNumber(), goal, first_sentence: firstSentence })).status).toBe(403)
+ // A country the workspace has no number in and the install does not allow.
+ expect((await act(ws.owner, 'call.dial', { to: '+33612345678', goal, first_sentence: firstSentence })).status).toBe(
+ 409,
+ )
+ expect((await act(ws.owner, 'call.dial', { to: '911', goal, first_sentence: firstSentence })).status).toBe(409)
+ expect((await act(ws.owner, 'call.dial', { to: ws.number, goal, first_sentence: firstSentence })).status).toBe(409)
+ expect(dispatched.length).toBe(before)
+})
+
+test('the agent registers the dialled call once, as outbound from the business number to the person', async () => {
+ const to = randomNumber()
+ const room = `outbound-test-${Date.now()}`
+ const { status, body } = await act(agent(ws.id), 'call.startOutbound', { room, assistantId: ws.assistant.id, to })
+ expect(status).toBe(200)
+ const [call] = await db.select().from(calls).where(eq(calls.id, body.data.callId))
+ expect(call).toMatchObject({ direction: 'out', from_number: ws.number, to_number: to, room, workspace_id: ws.id })
+ const again = await act(agent(ws.id), 'call.startOutbound', { room, assistantId: ws.assistant.id, to })
+ expect(again.status).toBe(409)
+})
diff --git a/docs/api.md b/docs/api.md
index 0071721e..7b41188f 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -34,6 +34,15 @@ To publish another action, add `public: true` to its `defineAction` and make sur
- Not destructive: `call_markDone` (the call stays, under done, and `call_markNotDone` brings it back; it is the main thing an assistant does with the inbox) and `contact_update` (clearing a field with null is no worse than overwriting it with other text, which is the tool's purpose; flagging it would leave member keys no way to keep contacts up to date). A run over many calls is bounded by one message per request and the key's rate limit.
- **Clients:** both the current protocol (2026-07-28) and 2025-era clients, which are served statelessly.
+## Outbound calls (call.dial)
+
+An AI agent with a workspace key (owner or admin role) or a personal key asks the assistant to phone someone: `call.dial` (`call_dial` over MCP, `POST /v1/actions/call.dial`), public, `settings:write` (`packages/actions/src/calls.ts`, `apps/api/src/outbound-call.ts`, `apps/agent/src/outbound-dial.ts`).
+
+- **Input:** `to` (E.164, a country the workspace may call: the countries of its numbers plus the install's `OUTBOUND_COUNTRIES` or Server admin's list, as for transfers; no emergency, premium or service numbers), `goal` (10 to 4000 characters: what to find out, pass on or arrange), `first_sentence` (what the assistant says when the person picks up), optional `language` (a language code; missing: the assistant's main language) and `assistantId` (missing: the one answering the workspace's first number). Answers `data: { room, to, from, assistantId }`.
+- **How it runs:** the API starts the voice agent in a new room (`outbound-<uuid>`) through LiveKit's `AgentDispatchService/CreateDispatch`, with whom to call and why in the dispatch metadata (set with the install's LiveKit key, so no client can write it). The agent registers the call (`call.startOutbound`, agent only: direction `out`, `from_number` the business number, `to_number` the person), then dials through the same trunk a warm transfer from that number uses and shows the business number. Only after the pickup does the assistant speak: the first sentence, then the conversation with the goal added to its instructions for this call (`outboundInstructions`). Nobody answering, busy or refused: the call is filed with a system line and the room closes.
+- **Limits:** 5 a minute and 200 a day per workspace (`DIALS_PER_MINUTE`, `DIALS_PER_DAY`), besides the workspace's spending cap, billing and live-call limit, which apply as for any phone call.
+- **After the call:** like every call: `calls_list` and `calls_get` (transcript, summary), the call-end webhook (`direction: "out"`), the inbox.
+
## Feedback to the Linedesk team
`feedback.send` (`packages/actions/src/feedback.ts`, `apps/api/src/feedback.ts`) sends a bug report, a feature request or setup feedback to the people who make Linedesk: from Help in the app, an MCP client (`feedback_send`), a workspace or personal key over `POST /v1/actions/feedback.send`, or the CLI. Every member, key and MCP client may send it (`call:read`, `public`).
diff --git a/integrations/zapier/generated/actions.json b/integrations/zapier/generated/actions.json
index 0bf85e44..3b9f71dd 100644
--- a/integrations/zapier/generated/actions.json
+++ b/integrations/zapier/generated/actions.json
@@ -378,6 +378,77 @@
}
]
},
+ {
+ "name": "call.dial",
+ "key": "call_dial",
+ "kind": "create",
+ "label": "Dial Call",
+ "noun": "Call",
+ "description": "Have the assistant phone someone now: it calls `to` (E.164, in a country the workspace may call, see outbound.countries) from its own Linedesk number and works towards `goal` (what to find out, pass on or arrange, and when to end the call; in full sentences). `first_sentence`: the first thing it says when the person picks up, in the call's language (e.g. \"Hello, this is Maya from Brightwater Plumbing, I'm calling about your appointment tomorrow.\"). `language`: the language it speaks on this call (a language code, e.g. de or en; missing: the assistant's main language). `assistantId`: which assistant calls (missing: the one answering the workspace's first number). The answer has the call's `room`; the call shows up in calls_list (direction out) once it rings, with its transcript and summary after it ends, and the call-end webhook is sent like for every call.",
+ "permission": "settings:write",
+ "destructive": true,
+ "fields": [
+ {
+ "key": "to",
+ "label": "To",
+ "type": "string",
+ "required": true
+ },
+ {
+ "key": "goal",
+ "label": "Goal",
+ "type": "text",
+ "required": true
+ },
+ {
+ "key": "first_sentence",
+ "label": "First_sentence",
+ "type": "string",
+ "required": true
+ },
+ {
+ "key": "language",
+ "label": "Language",
+ "type": "string",
+ "required": false,
+ "choices": [
+ "en",
+ "es",
+ "fr",
+ "de",
+ "it",
+ "pt",
+ "nl",
+ "ru",
+ "hi",
+ "ja",
+ "zh",
+ "ko",
+ "pl",
+ "tr",
+ "vi",
+ "id",
+ "sv",
+ "ar",
+ "uk",
+ "ro",
+ "cs",
+ "el",
+ "da",
+ "fi",
+ "no",
+ "hu"
+ ]
+ },
+ {
+ "key": "assistantId",
+ "label": "Assistant",
+ "type": "string",
+ "required": false,
+ "dynamic": "assistants"
+ }
+ ]
+ },
{
"name": "contact.update",
"key": "contact_update",
diff --git a/packages/actions/src/call-prompt.ts b/packages/actions/src/call-prompt.ts
index f345d532..8a52ab14 100644
--- a/packages/actions/src/call-prompt.ts
+++ b/packages/actions/src/call-prompt.ts
@@ -559,3 +559,17 @@ export function buildInstructions(
/** Starts the part of the instructions about this call (time, hours now, the caller, who can be reached). */
export const CALL_HEADING = PROMPT_TEXTS['call.heading'].text
+
+/**
+ * An outbound call (call.dial, LIN-873): the assistant phoned the person, so it says why it calls instead of asking how
+ * it can help, and works towards the goal the business gave over the API. The goal is the business's own instruction
+ * (an owner's or admin's key), like the instructions it wrote; fenced so it stays one block.
+ */
+export function outboundInstructions(outbound: { to: string; goal: string } | null | undefined): string | null {
+ if (!outbound) return null
+ return [
+ `This is an outbound call: you called ${displayNumber(outbound.to)} for the business. The person did not call you, so do not ask how you can help; say why you are calling.`,
+ `The goal of this call, from the business:\n${quotedData(outbound.goal, 4000)}`,
+ 'Work towards this goal and keep the call short; do not offer other help. When the goal is reached, or the person does not want to talk or asks you to stop, thank them, say goodbye and end the call with end_call. If you reach a voicemail or an answering machine, leave one short message that says who is calling and why, then end the call with end_call at once, without waiting for an answer.',
+ ].join('\n')
+}
diff --git a/packages/actions/src/calls.ts b/packages/actions/src/calls.ts
index 6ce737e6..568cb933 100644
--- a/packages/actions/src/calls.ts
+++ b/packages/actions/src/calls.ts
@@ -3,6 +3,7 @@ import { z } from 'zod'
import { defineAction, type PatchSpec } from './define.ts'
import { behaviourOn } from './assistant-prompt.ts'
import type { Call } from '@linedesk/db/types'
+import { type Language, languageCodes } from './languages.ts'
const callId = z.object({ callId: z.string().min(1) })
type CallId = z.infer<typeof callId>
@@ -247,6 +248,60 @@ export const callStartTest = defineAction({
permission: 'agent',
secretResult: ['callToken'],
})
+/** Most a `call.dial` goal may hold: the assistant reads it with its instructions for that one call. */
+export const DIAL_GOAL_MAX = 4000
+/** Most the first sentence of a dialled call may hold. */
+export const DIAL_FIRST_SENTENCE_MAX = 500
+
+/**
+ * An outbound AI call: the assistant phones `to` from its own Linedesk number and works towards `goal`. The call is
+ * filed like any other (direction out). Owners and admins only: it costs money and reaches people outside the business.
+ */
+export const callDial = defineAction({
+ name: 'call.dial',
+ // i18n-ignore: API and MCP docs for agents and developers, not shown in the app
+ description:
+ "Have the assistant phone someone now: it calls `to` (E.164, in a country the workspace may call, see outbound.countries) from its own Linedesk number and works towards `goal` (what to find out, pass on or arrange, and when to end the call; in full sentences). `first_sentence`: the first thing it says when the person picks up, in the call's language (e.g. \"Hello, this is Maya from Brightwater Plumbing, I'm calling about your appointment tomorrow.\"). `language`: the language it speaks on this call (a language code, e.g. de or en; missing: the assistant's main language). `assistantId`: which assistant calls (missing: the one answering the workspace's first number). The answer has the call's `room`; the call shows up in calls_list (direction out) once it rings, with its transcript and summary after it ends, and the call-end webhook is sent like for every call.",
+ input: z.object({
+ to: z.string().trim().min(3).max(20),
+ goal: z.string().trim().min(10).max(DIAL_GOAL_MAX),
+ first_sentence: z.string().trim().min(1).max(DIAL_FIRST_SENTENCE_MAX),
+ language: z.enum(languageCodes as [Language, ...Language[]]).optional(),
+ assistantId: z.string().min(1).optional(),
+ }),
+ permission: 'settings:write',
+ public: true,
+ // It reaches a person outside the business: MCP clients ask first, and only admin keys get it.
+ destructive: true,
+ logged: 'ids',
+})
+
+/** What the voice agent reads from the job metadata of a room `call.dial` started (apps/api/src/outbound-call.ts). */
+export type OutboundDialMetadata = {
+ source: 'outbound'
+ workspaceId: string
+ assistantId: string
+ to: string
+ from: string
+ goal: string
+ firstSentence: string
+ language?: Language
+}
+
+export const callStartOutbound = defineAction({
+ name: 'call.startOutbound',
+ // i18n-ignore: API and MCP docs for agents and developers, not shown in the app
+ description:
+ "Register an outbound call that call.dial started, before the agent dials. The workspace is the agent's x-workspace-id, the assistant and the numbers come from the dispatch the API signed; a room is one call.",
+ input: z.object({
+ room: z.string().min(1).max(128),
+ assistantId: z.string().min(1),
+ to: z.string().min(3),
+ }),
+ permission: 'agent',
+ secretResult: ['callToken'],
+ logged: 'ids',
+})
/** For the phone-to-phone call test: the newest call from `from` to `to` since a moment, and how far it got. */
export const callFindForTest = defineAction({
name: 'call.findForTest',
diff --git a/packages/actions/src/index.ts b/packages/actions/src/index.ts
index 74fca213..fd1ce1b6 100644
--- a/packages/actions/src/index.ts
+++ b/packages/actions/src/index.ts
@@ -164,6 +164,8 @@ const all = [
calls.callTakeMessage,
calls.callFlagUrgent,
calls.callStartTest,
+ calls.callDial,
+ calls.callStartOutbound,
calls.callFindForTest,
calls.callListNumbers,
calls.callNewCallerForTest,
diff --git a/packages/actions/src/outbound.ts b/packages/actions/src/outbound.ts
index 20271d3e..25603aab 100644
--- a/packages/actions/src/outbound.ts
+++ b/packages/actions/src/outbound.ts
@@ -40,7 +40,7 @@ export type OutboundReason =
export type OutboundProblem = { reason: OutboundReason; message: string; country: string | null }
/** What the call is for, which the messages name: a transfer, or the forwarding check calling the business number. */
-export type OutboundUse = 'transfer' | 'check'
+export type OutboundUse = 'transfer' | 'check' | 'call'
/**
* libphonenumber's number types Linedesk calls. VoIP too: many business lines are VoIP-typed numbers in their country
diff --git a/packages/i18n/locales/en/common.json b/packages/i18n/locales/en/common.json
index 461b5584..fbb9fc19 100644
--- a/packages/i18n/locales/en/common.json
+++ b/packages/i18n/locales/en/common.json
@@ -98,21 +98,21 @@
"load.slowHint": "This takes longer than usual. It shows here by itself as soon as it arrives.",
"load.unreachable": "Can't reach the server. Retrying…",
"outbound.problem.areaCode": "Enter the number with its area code, like {example}.",
- "outbound.problem.country": "Only numbers in {countries} {use, select, transfer {can take transferred calls} other {can be checked}}. Ask your server admin to allow other countries.",
+ "outbound.problem.country": "Only numbers in {countries} {use, select, transfer {can take transferred calls} call {can be called} other {can be checked}}. Ask your server admin to allow other countries.",
"outbound.problem.countryCode": "Enter the number with its country code, like {example}.",
- "outbound.problem.emergency": "Emergency numbers {use, select, transfer {cannot take transferred calls} other {cannot be checked}}.",
+ "outbound.problem.emergency": "Emergency numbers {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}.",
"outbound.problem.invalid": "This doesn't look like a phone number.",
"outbound.problem.invalidIn": "This doesn't look like a phone number in {where}.",
- "outbound.problem.noCountry": "No number {use, select, transfer {can take transferred calls} other {can be checked}} yet: connect a phone number first, or ask your server admin to allow countries.",
- "outbound.problem.nonGeographic": "Numbers without a country (like +800 or satellite phones) {use, select, transfer {cannot take transferred calls} other {cannot be checked}}.",
- "outbound.problem.notCallable": "Only mobiles and landlines {use, select, transfer {can take transferred calls} other {can be checked}}. Enter a mobile or landline.",
- "outbound.problem.personal": "Personal (follow-me) numbers {use, select, transfer {cannot take transferred calls} other {cannot be checked}}. Enter a mobile or landline.",
- "outbound.problem.premium": "Premium-rate numbers {use, select, transfer {cannot take transferred calls} other {cannot be checked}}.",
- "outbound.problem.premiumNanp": "Premium-rate and personal numbers (900, 976, 500, 700) {use, select, transfer {cannot take transferred calls} other {cannot be checked}}.",
- "outbound.problem.service": "Service numbers (like 411) {use, select, transfer {cannot take transferred calls} other {cannot be checked}}.",
- "outbound.problem.sharedCost": "Shared-cost service numbers {use, select, transfer {cannot take transferred calls} other {cannot be checked}}. Enter a mobile or landline.",
- "outbound.problem.short": "Short and service numbers {use, select, transfer {cannot take transferred calls} other {cannot be checked}}. Enter a mobile or landline with its area code.",
- "outbound.problem.tollFree": "Toll-free numbers {use, select, transfer {cannot take transferred calls} other {cannot be checked}}. Enter a mobile or landline.",
+ "outbound.problem.noCountry": "No number {use, select, transfer {can take transferred calls} call {can be called} other {can be checked}} yet: connect a phone number first, or ask your server admin to allow countries.",
+ "outbound.problem.nonGeographic": "Numbers without a country (like +800 or satellite phones) {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}.",
+ "outbound.problem.notCallable": "Only mobiles and landlines {use, select, transfer {can take transferred calls} call {can be called} other {can be checked}}. Enter a mobile or landline.",
+ "outbound.problem.personal": "Personal (follow-me) numbers {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}. Enter a mobile or landline.",
+ "outbound.problem.premium": "Premium-rate numbers {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}.",
+ "outbound.problem.premiumNanp": "Premium-rate and personal numbers (900, 976, 500, 700) {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}.",
+ "outbound.problem.service": "Service numbers (like 411) {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}.",
+ "outbound.problem.sharedCost": "Shared-cost service numbers {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}. Enter a mobile or landline.",
+ "outbound.problem.short": "Short and service numbers {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}. Enter a mobile or landline with its area code.",
+ "outbound.problem.tollFree": "Toll-free numbers {use, select, transfer {cannot take transferred calls} call {cannot be called} other {cannot be checked}}. Enter a mobile or landline.",
"phone.countries": "Countries",
"phone.countryCode": "Country code: {country}",
"phone.countryInSentence": "{the, select, yes {the {country}} other {{country}}}",
diff --git a/packages/i18n/locales/en/server.json b/packages/i18n/locales/en/server.json
index 20a38a51..6ed9b004 100644
--- a/packages/i18n/locales/en/server.json
+++ b/packages/i18n/locales/en/server.json
@@ -136,6 +136,12 @@
"api.checkout.trialRechargeChanged": "Your trial or auto-recharge changed since this page loaded. Reload it and try again.",
"api.checkout.unavailable": "Checkout is not available right now. The server admins were told; try again later.",
"api.confirmEmailForTransfer": "Confirm your email first: this version puts calls through to a number",
+ "api.dial.invalidNumber": "Enter the number to call in E.164, with its country code, like +4930123456.",
+ "api.dial.noNumber": "The workspace has no phone number to call from yet: connect one first.",
+ "api.dial.ownNumber": "The assistant cannot call its own number.",
+ "api.dial.roomUsed": "This outbound call was registered already.",
+ "api.dial.tooMany": "Too many outbound calls at once: try again in a minute.",
+ "api.dial.unavailable": "Outbound calls are not set up on this server (LiveKit is missing).",
"api.email.resend.failed": "Resend failed on its side (HTTP {status}). If it stays, check status.resend.com.",
"api.email.resend.keyRefused": "Resend refused the API key (HTTP {status}). Enter a valid key under Server admin › Providers › Resend.",
"api.email.resend.keyRestricted": "The Resend API key may not do this (HTTP {status}). Use a key with Sending access on All domains.",
diff --git a/packages/i18n/server-text-baseline.json b/packages/i18n/server-text-baseline.json
index 578416b4..7b37a96a 100644
--- a/packages/i18n/server-text-baseline.json
+++ b/packages/i18n/server-text-baseline.json
@@ -4,7 +4,7 @@
"apps/api/src/admin-handlers.ts": 13,
"apps/api/src/admin-passkey-codes.ts": 2,
"apps/api/src/admin-second-factor.ts": 4,
- "apps/api/src/after-call-transcript.ts": 10,
+ "apps/api/src/after-call-transcript.ts": 9,
"apps/api/src/agent-setup.ts": 14,
"apps/api/src/api-keys.ts": 2,
"apps/api/src/app-connections.ts": 11,
@@ -90,7 +90,7 @@
"apps/api/src/seed.ts": 10,
"apps/api/src/self-serve.ts": 2,
"apps/api/src/setup-code.ts": 1,
- "apps/api/src/setup-mcp.ts": 82,
+ "apps/api/src/setup-mcp.ts": 80,
"apps/api/src/setup.ts": 5,
"apps/api/src/sign-in-limits.ts": 5,
"apps/api/src/signup-gate.ts": 1,
@@ -122,7 +122,7 @@
"apps/api/src/workspace-delete.ts": 8,
"apps/api/src/workspace-icon.ts": 3,
"apps/api/src/workspace-settings.ts": 8,
- "packages/actions/src/admin.ts": 243,
+ "packages/actions/src/admin.ts": 225,
"packages/actions/src/agent-setup.ts": 18,
"packages/actions/src/agent-token.ts": 1,
"packages/actions/src/api-keys.ts": 3,
@@ -167,7 +167,7 @@
"packages/actions/src/records.ts": 1,
"packages/actions/src/rights.ts": 1,
"packages/actions/src/sample.ts": 2,
- "packages/actions/src/settings.ts": 39,
+ "packages/actions/src/settings.ts": 37,
"packages/actions/src/signup.ts": 1,
"packages/actions/src/star.ts": 1,
"packages/actions/src/system-prompt.ts": 4,