export type CreateApiAgentphoneV1CallsArgs = {body: {agentId: string, toNumber: string, systemPrompt?: string | undefined, initialGreeting?: string | undefined, fromNumberId?: string | undefined, voice?: string | undefined}}; export type CreateApiAgentphoneV1CallsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Make an outbound voice call. Include systemPrompt for autonomous AI conversation, omit for webhook-driven mode. * * POST /agentphone/v1/calls */ export const createApiAgentphoneV1Calls = async (args: CreateApiAgentphoneV1CallsArgs, options?: CreateApiAgentphoneV1CallsOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/agentphone/v1/calls${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };