Functions
create-call
fn (request: CreateCallRequest): Call
fn (request: CreateCallRequest, opts: Map): Call
fn (client: ::twilio::api/Client, request: CreateCallRequest): Call
POST /Accounts/{AccountSid}/Calls.json - Initiate an outbound phone call. Provide either Url (TwiML endpoint), Twiml (inline TwiML), or ApplicationSid.
Example: Call with TwiML URL
::calls ::twilio::calls
response ::calls/create-call(::calls/CreateCallRequest({
To: "+15558675310",
From: "+15017122661",
Url: "https://example.com/twiml/greeting.xml",
StatusCallback: "https://example.com/hooks/call-status",
StatusCallbackEvent: ["initiated", "ringing", "answered", "completed"]
}))
response.sid // => "CA..."
response.status // => "queued"
Example: Call with inline TwiML
::calls ::twilio::calls
::twiml ::twilio::twiml
response ::calls/create-call(::calls/CreateCallRequest({
To: "+15558675310",
From: "+15017122661",
Twiml: ::twiml/voice-response([::twiml/say("Hello from Hot!")])
}))
twilio.account.sid, twilio.auth.token
create-call-body
fn (request: CreateCallRequest): Map
The form parameters create-call sends: every set field of the request, unset ones omitted. Exposed for testing.
delete-call
fn (request: DeleteCallRequest): Bool
fn (request: DeleteCallRequest, opts: Map): Bool
fn (client: ::twilio::api/Client, request: DeleteCallRequest): Bool
DELETE /Accounts/{AccountSid}/Calls/{Sid}.json - Delete a call record. The call log is permanently removed.
twilio.account.sid
get-call
fn (request: GetCallRequest): Call
fn (request: GetCallRequest, opts: Map): Call
fn (client: ::twilio::api/Client, request: GetCallRequest): Call
GET /Accounts/{AccountSid}/Calls/{Sid}.json - Get details of a specific call. Returns status, duration, price, and timestamps.
Example
::calls ::twilio::calls
response ::calls/get-call(::calls/GetCallRequest({
sid: "CA1234567890abcdef1234567890abcdef"
}))
response.status // => "completed"
response.duration // => "30"
twilio.account.sid
list-all-calls
fn (request: ListCallsRequest, limit: Int): Vec<Map>
fn (request: ListCallsRequest, limit: Int, opts: Map): Vec<Map>
fn (client: ::twilio::api/Client, request: ListCallsRequest, limit: Int): Vec<Map>
Collect up to limit calls matching request, following Twilio's page links as needed.
twilio.account.sid
list-calls
fn (request: ListCallsRequest): ListCallsResponse
fn (request: ListCallsRequest, opts: Map): ListCallsResponse
fn (client: ::twilio::api/Client, request: ListCallsRequest): ListCallsResponse
GET /Accounts/{AccountSid}/Calls.json - List calls, newest first. Filter by To, From, Status, parent call, or date range. Returns one page; follow it with ::twilio::api/next-page, or use list-all-calls.
twilio.account.sid
list-calls-query
fn (request: ListCallsRequest): Str
The query string list-calls sends. Exposed for testing.
update-call
fn (request: UpdateCallRequest): Call
fn (request: UpdateCallRequest, opts: Map): Call
fn (client: ::twilio::api/Client, request: UpdateCallRequest): Call
POST /Accounts/{AccountSid}/Calls/{Sid}.json - Modify a live call. Set Status: "completed" to hang up (or "canceled" for a queued/ringing call), or provide a new Url/Twiml to redirect it.
Example
::calls ::twilio::calls
::calls/update-call(::calls/UpdateCallRequest({sid: "CA123", Status: "completed"}))
twilio.account.sid
update-call-body
fn (request: UpdateCallRequest): Map
The form parameters update-call sends (the request without its path sid). Exposed for testing.
Types
Call
Call type {
sid: Str?,
account_sid: Str?,
parent_call_sid: Str?,
to: Str?,
to_formatted: Str?,
from: Str?,
from_formatted: Str?,
status: Str?,
start_time: Str?,
end_time: Str?,
duration: Str?,
price: Str?,
price_unit: Str?,
direction: Str?,
answered_by: Str?,
forwarded_from: Str?,
caller_name: Str?,
queue_time: Str?,
api_version: Str?,
uri: Str?,
subresource_uris: Map?,
date_created: Str?,
date_updated: Str?,
phone_number_sid: Str?
}
A Call resource. duration and price are set once the call completes.
CreateCallRequest
CreateCallRequest type {
To: Str,
From: Str,
Url: Str?,
Twiml: Str?,
ApplicationSid: Str?,
Method: Str?,
FallbackUrl: Str?,
FallbackMethod: Str?,
StatusCallback: Str?,
StatusCallbackEvent: Vec<Str>?,
StatusCallbackMethod: Str?,
SendDigits: Str?,
Timeout: Int?,
TimeLimit: Int?,
Record: Bool?,
RecordingChannels: Str?,
RecordingTrack: Str?,
RecordingStatusCallback: Str?,
RecordingStatusCallbackMethod: Str?,
RecordingStatusCallbackEvent: Vec<Str>?,
MachineDetection: Str?,
MachineDetectionTimeout: Int?,
MachineDetectionSpeechThreshold: Int?,
MachineDetectionSpeechEndThreshold: Int?,
MachineDetectionSilenceTimeout: Int?,
AsyncAmd: Bool?,
AsyncAmdStatusCallback: Str?,
AsyncAmdStatusCallbackMethod: Str?,
Trim: Str?,
CallerId: Str?,
CallReason: Str?,
SipAuthUsername: Str?,
SipAuthPassword: Str?,
Byoc: Str?
}
Parameters of POST /Calls.json. To and From are required, plus
exactly one of Url (a TwiML endpoint), Twiml (inline TwiML, e.g.
from ::twilio::twiml), or ApplicationSid. Vec fields
(StatusCallbackEvent, RecordingStatusCallbackEvent) are sent as
repeated parameters.
DeleteCallRequest
DeleteCallRequest type {
sid: Str
}
GetCallRequest
GetCallRequest type {
sid: Str
}
ListCallsRequest
ListCallsRequest type {
To: Str?,
From: Str?,
ParentCallSid: Str?,
Status: Str?,
StartTime: Str?,
StartTimeBefore: Str?,
StartTimeAfter: Str?,
EndTime: Str?,
EndTimeBefore: Str?,
EndTimeAfter: Str?,
PageSize: Int?,
Page: Int?,
PageToken: Str?
}
Filters for GET /Calls.json. StartTime/EndTime match one day
(YYYY-MM-DD); the ...Before/...After fields send Twilio's
inclusive StartTime<, StartTime>, EndTime<, EndTime> range
filters.
ListCallsResponse
ListCallsResponse type {
calls: Vec<Map>?,
end: Int?,
first_page_uri: Str?,
next_page_uri: Str?,
page: Int?,
page_size: Int?,
previous_page_uri: Str?,
start: Int?,
uri: Str?
}
UpdateCallRequest
UpdateCallRequest type {
sid: Str,
Url: Str?,
Method: Str?,
Status: Str?,
FallbackUrl: Str?,
FallbackMethod: Str?,
StatusCallback: Str?,
StatusCallbackMethod: Str?,
Twiml: Str?,
TimeLimit: Int?
}