Powered by OpenAI Realtime API
When someone calls your number and no outbound call is pending, the AI will pick up and follow this script.
POST /api/call
{
"name": "Anubhav", // customer name
"number": "9876543210", // customer phone
"context": "Full script/briefing...", // what the agent should do
"agent_name": "Gunjan", // optional, default "Maya"
"language": "Bengali", // optional, default "English"
"voice": "alloy", // optional
"caller_id": "+918012345678", // optional — outgoing number
"custom_var1": "dealer_123", // optional — passed back in callback
"custom_var2": "nissan_campaign", // optional
"custom_var3": "fb_lead", // optional
"analytics_schema": "interest_level: 1-5
callback_requested: yes/no", // optional
"statuses": [ // optional — classify into one of these
{"id": 30, "status": "Hot", "code": "hot", "description": "Strong intent"},
{"id": 31, "status": "Warm", "code": "warm", "description": "Interested, needs follow-up"},
{"id": 32, "status": "Cold", "code": "cold", "description": "Not interested"}
],
"callback_url": "https://your-crm.com/webhook/result" // optional — POST here when done
}
Response: { "code": "ABC123" }
GET /api/call/ABC123
Response (running):
{ "code": "ABC123", "status": "running", "name": "Anubhav", "number": "+919876543210" }
Response (complete):
{
"code": "ABC123",
"status": "complete",
"transcript": [
{"role": "agent", "text": "...", "time": "..."},
{"role": "customer", "text": "...", "time": "..."}
],
"summary": "...",
"outcome": "interested",
"sentiment": "positive",
"duration_seconds": 45,
"direction": "outbound",
"caller_id": "+918012345678",
"agent_name": "Gunjan",
"language": "Bengali",
"status_id": 30,
"analytics_fields": { "interest_level": "4", "callback_requested": "yes" },
"custom_var1": "dealer_123", "custom_var2": "nissan_campaign", "custom_var3": "fb_lead"
}
Callback (if callback_url was set):
POST callback_url → { "data": { "code": "...", "status_id": 30, "outcome": "...", "summary": "...", "custom_var1": "...", ... } }
GET /api/inbound
Response:
{ "enabled": true, "agent_name": "Maya", "context": "...", "updated_at": "..." }
POST /api/inbound
{ "enabled": true, "agent_name": "Maya", "context": "Your script here..." }
Response: { "status": "saved", ... }
When inbound is enabled, any call that doesn't match a pending outbound will use the configured script. Inbound calls appear in history with direction: "inbound".