Skip to navigation

Stop an active AI session on a call. The AI agent is disconnected but the call itself remains active, allowing further call control operations.

Request

idstringRequiredformat: "uuid"
The unique identifying ID of an existing call.
paramsobjectRequired
An object of parameters that will be utilized by the active command.

Response

Call LegobjectRequired
Returned when the call is a standard PSTN, SIP, or WebRTC call.
OR
Fabric Subscriber Device LegobjectRequired

Returned when the call is a Fabric subscriber device leg. The status field is always null for this type.

Example

import { RestClient } from "@signalwire/sdk";
const client = new RestClient({
project: "your-project-id",
token: "your-api-token",
host: "your-space.signalwire.com"
});
// Stop the AI agent running on the call, then play a goodbye message under a new control ID
await client.calling.aiStop("call-id-xxx", "agent-1");
await client.calling.play("call-id-xxx", [
{ type: "tts", params: { text: "Thank you for calling. Goodbye!" } },
], { control_id: "goodbye-1" });
await client.calling.end("call-id-xxx", { reason: "hangup" });