/** * Calling API namespace — REST-based call control via command dispatch. * * All commands are sent as POST /api/calling/calls with a command field. */ import type { HttpClient } from '../HttpClient.js'; import { BaseResource } from '../base/BaseResource.js'; /** * REST call control — all 37 commands dispatched via a single POST endpoint. * * Access via `client.calling.*`. Every method issues one command against a live * call by ID and returns the platform's JSON response. * * Every command method shares the same shape: * * - First argument (when present) is the target call's ID. * - Second argument is a platform-shaped `params` object — see the * [Calling API reference](https://developer.signalwire.com/rest/signalwire-rest/endpoints/calling/) * for the fields each command accepts. * - The method returns the JSON-decoded platform response. * - Throws {@link RestError} on any non-2xx HTTP response. * * @example Play audio on an active call * ```ts * await client.calling.play(callId, { * play: [{ type: 'audio', url: 'https://cdn.example.com/hold.mp3' }], * }); * ``` * * @example Start and stop recording * ```ts * const rec = await client.calling.record(callId, { record: { audio: {} } }); * // ... later ... * await client.calling.recordStop(callId, { control_id: rec.control_id }); * ``` */ export declare class CallingNamespace extends BaseResource { constructor(http: HttpClient); private _execute; /** * Place an outbound call. * * @param params - Platform-shaped dial parameters (from, to, timeout, etc.). * Defaults to `{}`. * @returns The dial command response, typically containing a new `call_id`. * @throws {RestError} On any non-2xx HTTP response. */ dial(params?: any): Promise; /** * Update properties on an in-progress call. * * @param params - Platform-shaped update parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ update(params?: any): Promise; /** * Gracefully end a call. * * @param callId - Target call's ID. * @param params - Platform-shaped end parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ end(callId: string, params?: any): Promise; /** * Transfer a call to another destination. * * @param callId - Target call's ID. * @param params - Platform-shaped transfer parameters (`to`, `from`, etc.). * Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ transfer(callId: string, params?: any): Promise; /** * Drop one leg from a call without ending the other. * * @param callId - Target call's ID. * @param params - Platform-shaped disconnect parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ disconnect(callId: string, params?: any): Promise; /** * Start media playback on a call. * * @param callId - Target call's ID. * @param params - Playback parameters — see `Play` action schema. Defaults to `{}`. * @returns The play command response, containing a `control_id` used to * pause / resume / stop the playback later. * @throws {RestError} On any non-2xx HTTP response. */ play(callId: string, params?: any): Promise; /** * Pause active playback. * * @param callId - Target call's ID. * @param params - Must include `control_id` from the matching `play()` call. * Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ playPause(callId: string, params?: any): Promise; /** * Resume paused playback. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ playResume(callId: string, params?: any): Promise; /** * Stop active playback. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ playStop(callId: string, params?: any): Promise; /** * Adjust the playback volume. * * @param callId - Target call's ID. * @param params - `control_id` plus `volume` (integer dB). Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ playVolume(callId: string, params?: any): Promise; /** * Start recording a call. * * @param callId - Target call's ID. * @param params - Recording parameters (`record` config, callbacks, etc.). * Defaults to `{}`. * @returns The record command response containing a `control_id`. * @throws {RestError} On any non-2xx HTTP response. */ record(callId: string, params?: any): Promise; /** * Pause an active recording. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ recordPause(callId: string, params?: any): Promise; /** * Resume a paused recording. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ recordResume(callId: string, params?: any): Promise; /** * Stop and finalise a recording. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The final recording metadata. * @throws {RestError} On any non-2xx HTTP response. */ recordStop(callId: string, params?: any): Promise; /** * Collect DTMF / speech input from the caller. * * @param callId - Target call's ID. * @param params - Collect configuration (`digits`, `speech`, timeouts, etc.). * Defaults to `{}`. * @returns The collect command response containing a `control_id`. * @throws {RestError} On any non-2xx HTTP response. */ collect(callId: string, params?: any): Promise; /** * Stop an in-progress collect operation. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ collectStop(callId: string, params?: any): Promise; /** * Start input timers for a collect operation (useful when `initial_timeout` * should be reset after media finishes playing). * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ collectStartInputTimers(callId: string, params?: any): Promise; /** * Run answering-machine / fax / DTMF detection. * * @param callId - Target call's ID. * @param params - Detect configuration. Defaults to `{}`. * @returns The detect command response containing a `control_id`. * @throws {RestError} On any non-2xx HTTP response. */ detect(callId: string, params?: any): Promise; /** * Stop an active detect operation. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ detectStop(callId: string, params?: any): Promise; /** * Start a media tap (mirror audio to an external URI). * * @param callId - Target call's ID. * @param params - Tap configuration (`uri`, `direction`, `codec`, etc.). * Defaults to `{}`. * @returns The tap command response containing a `control_id`. * @throws {RestError} On any non-2xx HTTP response. */ tap(callId: string, params?: any): Promise; /** * Stop an active media tap. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ tapStop(callId: string, params?: any): Promise; /** * Start an outbound media stream (typically to a WebSocket endpoint). * * @param callId - Target call's ID. * @param params - Stream configuration. Defaults to `{}`. * @returns The stream command response containing a `control_id`. * @throws {RestError} On any non-2xx HTTP response. */ stream(callId: string, params?: any): Promise; /** * Stop an outbound media stream. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ streamStop(callId: string, params?: any): Promise; /** * Enable noise reduction on the call. * * @param callId - Target call's ID. * @param params - Denoise configuration. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ denoise(callId: string, params?: any): Promise; /** * Disable noise reduction. * * @param callId - Target call's ID. * @param params - Platform-shaped parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ denoiseStop(callId: string, params?: any): Promise; /** * Start real-time transcription on the call. * * @param callId - Target call's ID. * @param params - Transcription configuration. Defaults to `{}`. * @returns The transcribe command response containing a `control_id`. * @throws {RestError} On any non-2xx HTTP response. */ transcribe(callId: string, params?: any): Promise; /** * Stop real-time transcription. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The final transcription metadata. * @throws {RestError} On any non-2xx HTTP response. */ transcribeStop(callId: string, params?: any): Promise; /** * Send a message into an active AI agent session. * * @param callId - Target call's ID. * @param params - AI message payload. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ aiMessage(callId: string, params?: any): Promise; /** * Put the AI session on hold (pause turn-taking). * * @param callId - Target call's ID. * @param params - Platform-shaped parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ aiHold(callId: string, params?: any): Promise; /** * Resume an AI session that was on hold. * * @param callId - Target call's ID. * @param params - Platform-shaped parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ aiUnhold(callId: string, params?: any): Promise; /** * Terminate the active AI session on a call. * * @param callId - Target call's ID. * @param params - Platform-shaped parameters. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ aiStop(callId: string, params?: any): Promise; /** * Start live transcription that emits events as speech is recognised. * * @param callId - Target call's ID. * @param params - Configuration (languages, model, partials, etc.). * Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ liveTranscribe(callId: string, params?: any): Promise; /** * Start live translation between two languages. * * @param callId - Target call's ID. * @param params - Configuration (`source_lang`, `target_lang`, etc.). * Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ liveTranslate(callId: string, params?: any): Promise; /** * Stop a send-fax operation mid-stream. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ sendFaxStop(callId: string, params?: any): Promise; /** * Stop a receive-fax operation mid-stream. * * @param callId - Target call's ID. * @param params - Must include `control_id`. Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ receiveFaxStop(callId: string, params?: any): Promise; /** * Send a SIP REFER to transfer a call outside the platform. * * @param callId - Target call's ID. * @param params - REFER parameters (`refer_to`, etc.). Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ refer(callId: string, params?: any): Promise; /** * Emit a custom user event on the call for your webhooks. * * @param callId - Target call's ID. * @param params - Event payload — freeform data delivered to your webhook. * Defaults to `{}`. * @returns The platform's response. * @throws {RestError} On any non-2xx HTTP response. */ userEvent(callId: string, params?: any): Promise; }