Handle Twilio outbound browser call
curl --request POST \
--url https://your-instance.example.com/api/webhook/calls/twilio/outbound \
--header 'Content-Type: application/json' \
--data '
{
"To": "+14165550100",
"From": "+12362320246",
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5"
}
'import requests
url = "https://your-instance.example.com/api/webhook/calls/twilio/outbound"
payload = {
"To": "+14165550100",
"From": "+12362320246",
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
To: '+14165550100',
From: '+12362320246',
CallSid: 'CA5f7b1c2e8a1d4e0012c3b4a5'
})
};
fetch('https://your-instance.example.com/api/webhook/calls/twilio/outbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/webhook/calls/twilio/outbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'To' => '+14165550100',
'From' => '+12362320246',
'CallSid' => 'CA5f7b1c2e8a1d4e0012c3b4a5'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/webhook/calls/twilio/outbound"
payload := strings.NewReader("{\n \"To\": \"+14165550100\",\n \"From\": \"+12362320246\",\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/webhook/calls/twilio/outbound")
.header("Content-Type", "application/json")
.body("{\n \"To\": \"+14165550100\",\n \"From\": \"+12362320246\",\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/calls/twilio/outbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"To\": \"+14165550100\",\n \"From\": \"+12362320246\",\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\"\n}"
response = http.request(request)
puts response.read_body"<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Dial callerId=\"+12362320246\" record=\"record-from-answer\" recordingStatusCallback=\"/api/webhook/calls/twilio/recording\" recordingStatusCallbackMethod=\"POST\" answerOnBridge=\"true\"><Number statusCallback=\"/api/webhook/calls/twilio/status\" statusCallbackMethod=\"POST\" statusCallbackEvent=\"initiated,ringing,answered,completed\" machineDetection=\"Enable\" machineDetectionTimeout=\"30\" machineDetectionSpeechThreshold=\"2400\" machineDetectionSpeechEndThreshold=\"1200\" machineDetectionSilenceTimeout=\"5000\" amdStatusCallback=\"/api/webhook/calls/twilio/amd\" amdStatusCallbackMethod=\"POST\">+14165550100</Number></Dial></Response>"{
"error": "Webhook processing failed"
}Webhooks
Handle Twilio outbound browser call
Outbound voice webhook hit when an agent’s browser device.connect() places a call. Validates the from/to numbers, creates the outbound Call record, and returns TwiML that bridges the browser leg to the PSTN destination.
POST
/
api
/
webhook
/
calls
/
twilio
/
outbound
Handle Twilio outbound browser call
curl --request POST \
--url https://your-instance.example.com/api/webhook/calls/twilio/outbound \
--header 'Content-Type: application/json' \
--data '
{
"To": "+14165550100",
"From": "+12362320246",
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5"
}
'import requests
url = "https://your-instance.example.com/api/webhook/calls/twilio/outbound"
payload = {
"To": "+14165550100",
"From": "+12362320246",
"CallSid": "CA5f7b1c2e8a1d4e0012c3b4a5"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
To: '+14165550100',
From: '+12362320246',
CallSid: 'CA5f7b1c2e8a1d4e0012c3b4a5'
})
};
fetch('https://your-instance.example.com/api/webhook/calls/twilio/outbound', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://your-instance.example.com/api/webhook/calls/twilio/outbound",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'To' => '+14165550100',
'From' => '+12362320246',
'CallSid' => 'CA5f7b1c2e8a1d4e0012c3b4a5'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://your-instance.example.com/api/webhook/calls/twilio/outbound"
payload := strings.NewReader("{\n \"To\": \"+14165550100\",\n \"From\": \"+12362320246\",\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://your-instance.example.com/api/webhook/calls/twilio/outbound")
.header("Content-Type", "application/json")
.body("{\n \"To\": \"+14165550100\",\n \"From\": \"+12362320246\",\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://your-instance.example.com/api/webhook/calls/twilio/outbound")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"To\": \"+14165550100\",\n \"From\": \"+12362320246\",\n \"CallSid\": \"CA5f7b1c2e8a1d4e0012c3b4a5\"\n}"
response = http.request(request)
puts response.read_body"<?xml version=\"1.0\" encoding=\"UTF-8\"?><Response><Dial callerId=\"+12362320246\" record=\"record-from-answer\" recordingStatusCallback=\"/api/webhook/calls/twilio/recording\" recordingStatusCallbackMethod=\"POST\" answerOnBridge=\"true\"><Number statusCallback=\"/api/webhook/calls/twilio/status\" statusCallbackMethod=\"POST\" statusCallbackEvent=\"initiated,ringing,answered,completed\" machineDetection=\"Enable\" machineDetectionTimeout=\"30\" machineDetectionSpeechThreshold=\"2400\" machineDetectionSpeechEndThreshold=\"1200\" machineDetectionSilenceTimeout=\"5000\" amdStatusCallback=\"/api/webhook/calls/twilio/amd\" amdStatusCallbackMethod=\"POST\">+14165550100</Number></Dial></Response>"{
"error": "Webhook processing failed"
}Body
application/json
Response
TwiML response. Bridges the browser leg to the PSTN destination with answering-machine detection and recording enabled.
The response is of type string.
⌘I