Telephony integration

Wire inbound calls and status callbacks safely.

Inbound voice traffic starts with signed Twilio callbacks. StateSet resolves tenant routing, returns TwiML, opens media streams, and emits operational webhook events.

Inbound call webhook

Configure Twilio Voice webhooks to send inbound calls to /api/v1/incoming-call.

POST https://voice.stateset.app/api/v1/incoming-call
X-Twilio-Signature: ${TWILIO_SIGNATURE}
content-type: application/x-www-form-urlencoded

From=%2B15555555678&To=%2B15555551234&CallSid=CA123

Verification flow

  1. Preserve the exact public URL and form body submitted by Twilio.
  2. Validate X-Twilio-Signature before resolving tenant state.
  3. Issue short-lived stream access for the media stream setup.

WebhookEvent model

{
  "event": "voice.call.completed",
  "tenant_id": "acme-prod",
  "call_sid": "CA123",
  "voice_session_id": "vs_123",
  "created_at": "2026-05-13T18:00:00Z",
  "payload": {
    "duration_seconds": 184,
    "status": "completed"
  }
}

For emitted operational events, use the webhook event catalog to validate payload shape and delivery behavior.