Make a Call
Make outbound phone calls using the CloudVNO Voice API.
Make an Outbound Call
call = client.calls.create(
from_="+14155551234",
to="+12125559876",
url="https://yourapp.com/call-handler" # Webhook for call instructions
)
print(f"Call SID: {call.sid}")
const call = await client.calls.create({
from: '+14155551234',
to: '+12125559876',
url: 'https://yourapp.com/call-handler',
});
curl -X POST https://api.cloudvno.com/v1/calls \
-H "Authorization: Bearer YOUR_API_KEY" \
-d from="+14155551234" \
-d to="+12125559876" \
-d url="https://yourapp.com/call-handler"
Call Handler Webhook
When the call connects, CloudVNO fetches your url. Respond with XML:
@app.route("/call-handler", methods=["POST"])
def call_handler():
return Response("""
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="alice">Hello! Thanks for calling. Press 1 for sales, 2 for support.</Say>
<Gather numDigits="1" action="/handle-keypress">
<Say>Please press a key now.</Say>
</Gather>
</Response>
""", mimetype="text/xml")
Call Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
from | string | Yes | Your CloudVNO number (E.164) |
to | string | Yes | Destination number (E.164) |
url | string | Yes | Webhook URL for call instructions |
status_callback | URL | No | Webhook for call status events |
record | boolean | No | Record the entire call |
timeout | integer | No | Seconds to wait for answer (default: 30) |
machine_detection | string | No | Enable to detect answering machines |
Monitor Call Status
call = client.calls(call_sid).fetch()
print(f"Duration: {call.duration}s")
print(f"Status: {call.status}")
print(f"Price: {call.price} {call.price_unit}")