Telephony
Handle Twilio Call
Handle inbound calls from Twilio via WebSocket Media Streams.
Flow:
- Parse Twilio webhook (To, From, CallSid)
- Lookup customer by To number -> sip_number
- Get customer's pipecat_agent_id and AgentToken
- Check agent availability via router API
- If no agent: return hold music TwiML with <Redirect> to re-check
- If agent available: return <Connect><Stream> TwiML
- Twilio opens WebSocket directly to bot -> bot speaks immediately
On hold music redirects (attempt > 1), steps 3-4 (call creation, CNAM, status callback) are skipped since they were already done on the first attempt.
post/telephony/call
Response
Successful Response
{"stackTrail":"paths:/telephony/call:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}
Changes
No recorded changes to this endpoint across all 1 revision of this API.