Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.astradial.com/llms.txt

Use this file to discover all available pages before exploring further.

The originate-to-AI endpoint lets you make a phone call to someone and connect them to an AI voice bot. This is useful for automated outreach, appointment reminders, surveys, and follow-up calls.

Endpoint

POST /api/v1/calls/originate-to-ai

Authentication

Requires an API key with calls.originate_ai permission.

Request body

{
  "to": "9944421125",
  "caller_id": "+918065978015",
  "ai_agent_app": "ai_agent",
  "wss_url": "wss://gateway.astradial.com/ws/{orgId}/{botId}?key={apiKey}",
  "timeout": 30,
  "variables": {
    "guest_name": "John Doe",
    "room_number": "305",
    "purpose": "wake_up_call"
  }
}
FieldTypeRequiredDescription
tostringYesPhone number to call
caller_idstringNoCaller ID shown to the person being called
ai_agent_appstringNoThe ARI application name (default: “ai_agent”)
wss_urlstringYesWebSocket URL for the AI bot
timeoutnumberNoSeconds to wait for answer (default: 30)
variablesobjectNoCustom variables passed to the bot

Example: wake-up call

curl -X POST https://your-server:8000/api/v1/calls/originate-to-ai \
  -H "X-API-Key: ak_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "9944421125",
    "caller_id": "+918065978015",
    "wss_url": "wss://gateway.astradial.com/ws/org123/bot456?key=ak_abc123",
    "variables": {
      "guest_name": "John Doe",
      "purpose": "wake_up_call"
    }
  }'

Example: using an extension with a bot

If you have a user configured with AI routing, you can call through that extension:
curl -X POST https://your-server:8000/api/v1/calls/originate-to-ai \
  -H "X-API-Key: ak_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "9944421125",
    "caller_id": "+918065978015",
    "wss_url": "wss://your-server:7860/ws/org123/bot456?key=ak_abc123"
  }'

How it works

  1. Astradial dials the phone number
  2. When the person answers, the call connects to the AI bot via WebSocket
  3. The bot follows its conversation flow
  4. Variables you pass are available to the bot for personalized responses
  5. The bot can transfer to a human, create tickets, or end the conversation

Response

{
  "status": "success",
  "message": "Call originated",
  "channel_id": "PJSIP/trunk-00000005"
}

Use with workflows

You can also originate AI calls from workflows. In the workflow editor, add a Place Call action node and select a bot. The workflow passes trigger data as variables to the bot.