aiStop

View as MarkdownOpen in Claude

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 a 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

1import { RestClient } from "@signalwire/sdk";
2
3const client = new RestClient({
4 project: "your-project-id",
5 token: "your-api-token",
6 host: "your-space.signalwire.com"
7});
8
9// Stop AI and then play a goodbye message
10await client.calling.aiStop("call-id-xxx", { control_id: "ctrl-id" });
11await client.calling.play("call-id-xxx", {
12 play: [{ type: "tts", text: "Thank you for calling. Goodbye!" }]
13});
14await client.calling.end("call-id-xxx", { reason: "hangup" });