Voice
Voice calls
Place and receive phone calls, speak text in 100+ languages, play audio and hang up, all driven by events sent to your webhook as the call progresses.
How a call works
- 01You place a call (or someone calls your number). The API answers at once with a call
id. - 02As the call progresses, Pulsr sends events to your webhook:
CALL_RINGING,CALL_ESTABLISHED,CALL_FINISHED… - 03Your handler reacts to each event with actions on the call:
say,play,answer,hangup.
One-time setup
Calls belong to a calls configuration, and events reach you through an event subscription on that configuration. Create both once, from a script or the dashboard.
Place a call
POST/calls/1/calls
Request body
endpointobjectRequired- Who to call.
{ type: "PHONE", phoneNumber }for a phone;WEBRTCandSIPendpoints are also supported. fromstring- The caller ID, one of your voice numbers.
callsConfigurationIdstringRequired- The configuration the call belongs to.
connectTimeoutinteger- Seconds to ring before giving up.
maxDurationinteger- Seconds after which the call is ended.
machineDetection.enabledboolean- Detect answering machines. The result arrives as a
MACHINE_DETECTION_FINISHEDevent. recording.recordingTypestringAUDIOorAUDIO_AND_VIDEOto record the call.customDataobject- Your own key-value pairs, returned in call events.
Get the current state of a call at any time with GET /calls/1/calls/{callId}. You can place up to 6 calls per second.
Call events
Each event is a JSON object with a type, the callId, a timestamp and properties. Ringing and established events include the full call; finished and failed events include a callLog with the duration and the hang-up reason.
| Event | When |
|---|---|
CALL_RECEIVED | Someone is calling one of your numbers. |
CALL_RINGING | The other side is ringing. |
CALL_ESTABLISHED | The call was answered. |
SAY_FINISHED, PLAY_FINISHED | Speech or audio ended, with any keys pressed. |
DTMF_CAPTURED | Keys pressed on the keypad were collected. |
MACHINE_DETECTION_FINISHED | Answering machine detection has a result. |
CALL_FINISHED | The call ended normally. |
CALL_FAILED | The call could not be connected (busy, no answer, rejected…). |
Speak, play and hang up
Actions run on a live call and return { "status": "PENDING" } right away; their end comes as an event. say accepts plain text or SSML and a language code, play takes an audio URL or an uploaded file.
Answer incoming calls
When someone calls your number you receive CALL_RECEIVED. Answer it, then drive the call like an outbound one. This handler answers, speaks a message, then hangs up when the message ends: