To end a live call, send POST/v1/calls/{CallSid} with {"status": "completed"}, or send DELETE/v1/calls/{CallSid}. Both hang up the call immediately, whether it is still ringing or already answered. A call that has already ended returns 409 CALL_ENDED.
End a call#
curl -X POST https://voice-api.edesy.in/v1/calls/CA_6f1c2d3e-0000-4000-8000-000000000000 \
-H "Authorization: Bearer $EDESY_KEY" \
-H "Content-Type: application/json" \
-d '{ "status": "completed" }'
Or:
curl -X DELETE https://voice-api.edesy.in/v1/calls/CA_6f1c2d3e-0000-4000-8000-000000000000 \
-H "Authorization: Bearer $EDESY_KEY"
Request body (POST)#
| Field | Type | Description |
|---|---|---|
status |
string | completed or canceled. Both end the call |
url |
string (URL) | Twilio-style live redirect to a new instruction URL. Accepted; see the note below |
method |
string | GET or POST for url |
Mid-call redirect with url is not covered by these docs yet. To change what a live call does, end it and place a new call, or run the conversation from your server with Conversation Relay or Media Streams, where your code stays in control for the whole call.
Responses#
| Request | Success |
|---|---|
POST/v1/calls/{CallSid} |
200 with the call object in data |
DELETE/v1/calls/{CallSid} |
204 with no body |
The final status, duration and price arrive in your status callback and on GET/v1/calls/{CallSid} a moment later.
Errors#
| HTTP | Code | Cause |
|---|---|---|
| 400 | VALIDATION_ERROR |
Invalid body |
| 404 | NOT_FOUND |
No such call in this workspace |
| 409 | CALL_ENDED |
The call has already ended |
A bot on a media stream can also end the call itself by sending {"type": "disconnect"}, and a Conversation Relay bot by sending {"type": "end"}.