Skip to content

Voice API

Create calls, control them live and build IVR flows.

The Voice API models a phone call as a REST resource. You create a call, receive events as its state changes and issue verbs against it while it is live.

Create an outbound call

create-call.sh

curl https://api.gtalk2voip.com/v1/calls \
  -H "Authorization: Bearer $GTALK2VOIP_API_KEY" \
  -d to="+14155550134" \
  -d from="+14155550100" \
  -d webhook_url="https://example.com/events"

Control a live call

Verbs are POSTs on the call resource. They queue in order and each returns the updated call object.

verbs.sh

# Play audio, then collect digits
curl https://api.gtalk2voip.com/v1/calls/call_9f4e2a/play \
  -d url="https://example.com/menu.mp3"

curl https://api.gtalk2voip.com/v1/calls/call_9f4e2a/gather \
  -d max_digits=1 -d timeout=5

# Transfer to a queue
curl https://api.gtalk2voip.com/v1/calls/call_9f4e2a/transfer \
  -d target="queue:support"

Inbound calls

Point a number's voice_url at your endpoint. The platform POSTs the incoming call and follows the instructions you return: answer, reject, route to an agent or run a flow.

inbound-response.json

{
  "action": "answer",
  "agent": "ai-receptionist",
  "fallback": { "action": "transfer", "target": "queue:reception" }
}

Recording and transcription

  • Set record=true on creation, or POST /record while live.
  • Set transcribe=true to receive transcript.completed webhooks with speaker-labelled text.
  • Recordings are encrypted at rest; retention follows the policy on your account.