Call status callbacks
When you place a call with a StatusCallback URL — or an application has one
configured — SIPRTC notifies that URL as the call moves through its
lifecycle.
Choosing events
Section titled “Choosing events”StatusCallbackEvent is a space-separated list of the events you want:
| Event | Sent when | CallStatus |
|---|---|---|
initiated |
SIPRTC starts the call | initiated |
ringing |
the far end starts ringing or sends early media | ringing |
answered |
the call is answered | in-progress |
completed |
the call ends, whatever the reason | see below |
- initiatedSequenceNumber 1
- ringing2
- in-progress3 · the answered event
- completed4 · always sent
A call that is never answered still gets its final event, with CallStatus busy, no-answer, canceled or failed.
The final event is always sent. Its CallStatus says how the call ended:
CallStatus |
Meaning |
|---|---|
completed |
The call was answered and has ended normally. |
busy |
The far end was busy or rejected the call. |
no-answer |
The far end rang but nobody answered before the timeout. |
canceled |
The call was cancelled before it was answered — for example a parallel <Dial> leg that lost to another leg. |
failed |
The call could not be connected: invalid or unallocated number, no route, carrier failure. |
timeout |
The call reached its maximum allowed duration. |
Request format
Section titled “Request format”SIPRTC uses the method in StatusCallbackMethod (default POST):
POST— the parameters are a JSON object in the body (Content-Type: application/json).GET— the parameters are query-string parameters.
To protect your endpoint, put credentials in the URL
(https://user:secret@example.com/status): SIPRTC sends them as HTTP Basic
authentication and removes them from the URL. Always use HTTPS.
Parameters
Section titled “Parameters”Parameters that have no value for a given event are omitted.
| Parameter | Description |
|---|---|
AccountSid |
Your account’s Auth ID. |
CallSid |
The call’s unique identifier. |
ParentCallSid |
For a leg created by <Dial> or a transfer, the call that created it. |
CallStatus |
The status this event reports (tables above). |
SequenceNumber |
Position of this event in the call’s lifecycle: 1 initiated, 2 ringing, 3 answered, 4 completed. |
Direction |
inbound or outbound. |
From, To |
The calling and called party, as E.164 numbers or SIP URIs. |
Caller, Called |
The caller ID and the dialled destination as seen by the network. |
InitiationTime, RingTime, AnswerTime, HangupTime |
When the call was created, started ringing, was answered and ended, in UTC. Absent until they happen. |
CallDuration |
Billable seconds. Only on the final event. |
Timestamp |
When the event was raised, in UTC. |
CallbackSource |
Always call-progress-events for these callbacks. |
ApiVersion |
Always v1. |
RecordingUrl |
URL of the call recording, when the call was recorded. |
Events for media streams started on the call carry additional Stream*
parameters; see stream status callbacks.
Ordering and duplicates
Section titled “Ordering and duplicates”Callbacks are sent concurrently, so they can arrive out of order — ringing
before initiated, for instance. Order them by SequenceNumber, not by
arrival time.
Each status is delivered once per call. If your endpoint fails and the
callback is retried, the retry carries the same SequenceNumber, so it is safe
to de-duplicate on CallSid + SequenceNumber.
Retries
Section titled “Retries”Your endpoint has 10 seconds to respond.
| Your response | What SIPRTC does |
|---|---|
2xx |
Delivered. |
4xx other than 408 and 429 |
Treated as final: logged and not retried. Fix your endpoint. |
408, 429, any 5xx, a timeout or a connection failure |
Retried — by default after about 5 seconds, 30 seconds, 2 minutes and 10 minutes — and then no further attempts are made. |
Respond quickly and do slow work asynchronously; a callback that times out is retried and so arrives again.