Skip to main content

Overview

Inbound routing connects a phone number to a voice agent so that incoming calls are automatically handled by that agent. Setup differs depending on whether you manage your own Twilio account (BYOT) or use Kejue’s platform-managed numbers.
ModeHow It’s DetectedApprovalSIP Support
BYOT (Self-Serve)Your workspace has its own API key configuredAuto-approvedYes
Platform-ManagedNo API key on workspaceRequires admin approvalNo

Prerequisites

  1. A phone number registered in Kejue with is_inbound enabled
  2. An active voice config (agent) attached to a persona

Setting Up Inbound Routing

1. Configure inbound routing

curl -X PUT https://api.kejue.co/api/v1/phone-numbers/{phone_id}/inbound-routing \
  -H "X-API-Key: kej_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "voice_config_id": "vc_abc123"
  }'
If the voice config hasn’t been deployed yet, the system will auto-deploy it before configuring routing.

2. Handle the response based on your provisioning mode

The response includes a webhook_url and the status is immediately approved:
{
  "phone_id": "phone_123",
  "voice_config_id": "vc_abc123",
  "inbound_routing_status": "approved",
  "webhook_url": "https://api.kejue.co/inbound/vc_abc123/twiml",
  "provisioning": "self_serve"
}
Next step: Set the webhook_url as the Voice URL (HTTP POST) on your Twilio phone number.

How Inbound Calls Work

Incoming call → Twilio sends webhook to Kejue → Kejue looks up your voice config → Your AI agent handles the call
For BYOT, the webhook URL you configure on your Twilio number is:
https://api.kejue.co/inbound/{voice_config_id}/twiml

Removing Inbound Routing

curl -X DELETE https://api.kejue.co/api/v1/phone-numbers/{phone_id}/inbound-routing \
  -H "X-API-Key: kej_live_..."