Bolcho Docs Back to app

Telephony

Phone numbers

Import DIDs (or PBX extensions) onto a SIP trunk, route inbound calls to an assistant, place outbound calls, and release numbers.

GET/telephony/numbers agents:read

List numbers

List all phone numbers with their trunk and routed assistant.

Example request

bash
curl https://api.bolchoai.in/v1/telephony/numbers -H "Authorization: Bearer $VOXA_API_KEY"
POST/telephony/numbers agents:write

Import a number

Attach a DID (or non-E164 extension) from a SIP trunk and optionally route it to an assistant.

Body

trunkId*uuidSIP trunk the number belongs to.
number*stringE.164 number, or any string when allowNonE164 is true.
allowNonE164booleanDisable E.164 validation (e.g. PBX extension 8200).
labelstringFriendly label.
agentIduuidAssistant that answers inbound calls to this number.

Example request

bash
curl -X POST https://api.bolchoai.in/v1/telephony/numbers -H "Authorization: Bearer $VOXA_API_KEY" -H "Content-Type: application/json" \
  -d '{ "trunkId": "'$TRUNK_ID'", "number": "+14155551234", "agentId": "'$AGENT_ID'" }'
POST/telephony/numbers/{id}/route agents:write

Route to assistant

Set (or clear) the assistant that answers inbound calls to this number.

Path parameters

id*uuidNumber id.

Body

agentIduuid | nullAssistant id, or null to unroute.

Example request

bash
curl -X POST https://api.bolchoai.in/v1/telephony/numbers/$ID/route \
  -H "Authorization: Bearer $VOXA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "agentId": "00000000-0000-0000-0000-000000000000"
}'
DELETE/telephony/numbers/{id} agents:write

Release number

Remove the number and re-sync the trunk.

Path parameters

id*uuidNumber id.

Example request

bash
curl -X DELETE https://api.bolchoai.in/v1/telephony/numbers/$ID \
  -H "Authorization: Bearer $VOXA_API_KEY"
POST/telephony/dial calls:write

Place an outbound call

Dial a destination from one of your numbers and connect the assistant the moment the callee answers. Waits for the SIP disposition and returns the call id.

Body

fromNumberId*uuidThe number to call from (must be on an outbound-capable trunk).
to*stringDestination in E.164, e.g. +14155551234.
agentIduuidAssistant to run (defaults to the number's routed assistant).

Example request

bash
curl -X POST https://api.bolchoai.in/v1/telephony/dial -H "Authorization: Bearer $VOXA_API_KEY" -H "Content-Type: application/json" \
  -d '{ "fromNumberId": "'$NUMBER_ID'", "to": "+14155551234", "agentId": "'$AGENT_ID'" }'

Response

json
{ "ok": true, "status": "answered", "callId": "c1…", "to": "+14155551234" }