REST ClientCalling

collect

View as MarkdownOpen in Claude

Start collecting user input on an active call. Supports DTMF digit collection and speech recognition. Returns a control_id for managing the collection.

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

Examples

Collect DTMF Digits

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9# Collect DTMF digits
10result = client.calling.collect(
11 call_id="call-id-xxx",
12 digits={"max": 4, "terminators": "#", "digit_timeout": 5.0},
13 initial_timeout=10.0,
14)

Collect Speech

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9result = client.calling.collect(
10 call_id="call-id-xxx",
11 speech={
12 "end_silence_timeout": 1.0,
13 "language": "en-US",
14 },
15)

Collect Both

1from signalwire.rest import RestClient
2
3client = RestClient(
4 project="your-project-id",
5 token="your-api-token",
6 host="your-space.signalwire.com",
7)
8
9result = client.calling.collect(
10 call_id="call-id-xxx",
11 digits={"max": 1, "terminators": "#"},
12 speech={"end_silence_timeout": 2.0},
13 initial_timeout=15.0,
14)