REST ClientCalling

ai_stop

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

from signalwire.rest import RestClient
client = RestClient(
project="your-project-id",
token="your-api-token",
host="your-space.signalwire.com",
)
# Stop AI and then play a goodbye message
client.calling.ai_stop(call_id="call-id-xxx", control_id="ctrl-id")
client.calling.play(
call_id="call-id-xxx",
play=[{"type": "tts", "text": "Thank you for calling. Goodbye!"}]
)
client.calling.end(call_id="call-id-xxx", reason="hangup")