๐ API Reference
REST API endpoints for the SIP AI Assistant
ROBO CODED โ This documentation was made with AI and may not be 100% sane. But the code does work! ๐
๐ API Reference
The SIP AI Assistant exposes a REST API for initiating calls, executing tools, and managing scheduled tasks.
Base URL: http://your-server:8080
Interactive Docs: Visithttp://your-server:8080/docsfor Swagger UI
๐ฅ Health & Status
GET /health
GET /healthCheck service health and SIP registration status.
curl http://localhost:8080/health | jqResponse:
{
"status": "healthy",
"sip_registered": true,
"active_calls": 0
}GET /queue
GET /queueGet call queue status.
curl http://localhost:8080/queue | jqResponse:
{
"enabled": true,
"pending": 2,
"active": 1,
"max_concurrent": 1,
"total_processed": 47
}๐ Outbound Calls
POST /call
POST /callInitiate an outbound notification call.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Message to speak |
extension | string | Yes | Phone number or SIP extension |
callback_url | string | No | Webhook for results |
ring_timeout | integer | No | Seconds to wait (default: 30) |
call_id | string | No | Custom call ID |
choice | object | No | Choice collection config |
๐ค Simple Notification
curl -X POST http://localhost:8080/call \
-H "Content-Type: application/json" \
-d '{
"message": "Hello! This is a reminder about your appointment tomorrow at 2pm.",
"extension": "5551234567"
}' | jqResponse:
{
"call_id": "out-1732945860-1",
"status": "queued",
"message": "Call initiated",
"queue_position": null
}๐ค With Choice Collection
curl -X POST http://localhost:8080/call \
-H "Content-Type: application/json" \
-d '{
"message": "Hello! Your appointment is tomorrow at 2pm.",
"extension": "5551234567",
"callback_url": "https://example.com/webhook",
"choice": {
"prompt": "Say yes to confirm or no to cancel.",
"options": [
{"value": "confirmed", "synonyms": ["yes", "yeah", "confirm"]},
{"value": "cancelled", "synonyms": ["no", "nope", "cancel"]}
],
"timeout_seconds": 15
}
}' | jqGET /call/{call_id}
GET /call/{call_id}Get status of a specific call.
curl http://localhost:8080/call/out-1732945860-1 | jqResponse:
{
"call_id": "out-1732945860-1",
"status": "completed",
"queued_at": "2025-11-30T10:30:00Z",
"started_at": "2025-11-30T10:30:05Z",
"completed_at": "2025-11-30T10:30:45Z",
"duration_seconds": 40,
"choice_response": "confirmed",
"error": null
}๐ง Tools
GET /tools
GET /toolsList all available tools.
curl http://localhost:8080/tools | jqResponse:
[
{
"name": "WEATHER",
"description": "Get current weather conditions",
"parameters": {},
"enabled": true
},
{
"name": "SET_TIMER",
"description": "Set a timer for a specified duration",
"parameters": {
"duration": {"type": "integer", "required": true},
"message": {"type": "string", "required": false}
},
"enabled": true
},
{
"name": "DATETIME",
"description": "Get current date and time",
"parameters": {
"format": {"type": "string", "required": false},
"timezone": {"type": "string", "required": false}
},
"enabled": true
}
]GET /tools/{tool_name}
GET /tools/{tool_name}Get details about a specific tool.
curl http://localhost:8080/tools/WEATHER | jqResponse:
{
"name": "WEATHER",
"description": "Get current weather conditions from the local weather station",
"parameters": {},
"enabled": true
}POST /tools/{tool_name}/execute
POST /tools/{tool_name}/executeExecute a tool and get the result.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
params | object | No | Tool parameters |
speak_result | boolean | No | Speak to active call |
call_id | string | No | Specific call ID |
๐ค๏ธ Execute Weather Tool
curl -X POST http://localhost:8080/tools/WEATHER/execute \
-H "Content-Type: application/json" \
-d '{}' | jqResponse:
{
"success": true,
"tool": "WEATHER",
"message": "At Storm Lake, as of 9:30 pm, it's 44 degrees with foggy conditions. Wind is calm.",
"data": {
"temp_f": 44,
"feels_like_f": 44,
"humidity": 98,
"wind_mph": 0,
"conditions": "foggy"
},
"spoken": false,
"error": null
}๐งฎ Execute Calculator
curl -X POST http://localhost:8080/tools/CALC/execute \
-H "Content-Type: application/json" \
-d '{"params": {"expression": "25 * 4 + 10"}}' | jqResponse:
{
"success": true,
"tool": "CALC",
"message": "The result is 110",
"data": {"result": 110},
"spoken": false,
"error": null
}๐ Execute DateTime
curl -X POST http://localhost:8080/tools/DATETIME/execute \
-H "Content-Type: application/json" \
-d '{"params": {"format": "full", "timezone": "America/New_York"}}' | jqResponse:
{
"success": true,
"tool": "DATETIME",
"message": "It's Saturday, November 30th, 2025 at 6:30:00 PM Eastern Standard Time",
"data": {
"datetime": "2025-11-30T18:30:00-05:00",
"timezone": "America/New_York"
},
"spoken": false,
"error": null
}POST /tools/{tool_name}/call
POST /tools/{tool_name}/callExecute a tool and call someone with the result.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
extension | string | Yes | Phone number to call |
params | object | No | Tool parameters |
prefix | string | No | Message before tool result |
suffix | string | No | Message after tool result |
ring_timeout | integer | No | Ring timeout in seconds |
callback_url | string | No | Webhook for results |
๐ค๏ธ Weather Call
curl -X POST http://localhost:8080/tools/WEATHER/call \
-H "Content-Type: application/json" \
-d '{
"extension": "5551234567",
"prefix": "Good morning! Here is your weather update.",
"suffix": "Have a great day!"
}' | jqResponse:
{
"call_id": "out-1732945860-2",
"status": "initiated",
"tool": "WEATHER",
"tool_success": true,
"tool_message": "At Storm Lake, as of 7:00 am, it's 38 degrees...",
"message": "Calling 5551234567 with WEATHER result"
}Call flow:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ค POST /tools/WEATHER/call โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ 1. ๐ค๏ธ Execute WEATHER tool โ
โ 2. ๐ Dial 5551234567 โ
โ 3. ๐ Ring... ring... ring... โ
โ 4. ๐ฑ Call answered โ
โ 5. ๐ "Good morning! Here is your weather update." โ
โ 6. ๐ "At Storm Lake, it's 38 degrees..." โ
โ 7. ๐ "Have a great day!" โ
โ 8. ๐ด Hangup โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โฐ Scheduled Calls
POST /schedule
POST /scheduleSchedule a call for a future time.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
extension | string | Yes | Phone number to call |
message | string | โ ๏ธ | Static message (or use tool) |
tool | string | โ ๏ธ | Tool to execute at call time |
tool_params | object | No | Parameters for the tool |
delay_seconds | integer | โ ๏ธ | Seconds from now |
at_time | string | โ ๏ธ | ISO datetime or HH:MM |
timezone | string | No | Timezone (default: America/Los_Angeles) |
prefix | string | No | Message before tool result |
suffix | string | No | Message after tool result |
recurring | string | No | daily, weekdays, weekends |
callback_url | string | No | Webhook for results |
Eithermessageortoolrequired. Eitherdelay_secondsorat_timerequired.
โฐ Schedule Weather in 8 Hours
curl -X POST http://localhost:8080/schedule \
-H "Content-Type: application/json" \
-d '{
"extension": "1001",
"tool": "WEATHER",
"delay_seconds": 28800,
"prefix": "Good morning! Here is your weather."
}' | jqResponse:
{
"schedule_id": "a1b2c3d4",
"status": "scheduled",
"extension": "1001",
"scheduled_for": "2025-12-01T07:00:00-08:00",
"delay_seconds": 28800,
"message": "Call scheduled for 2025-12-01T07:00:00-08:00",
"recurring": null
}๐
Daily 7am Weather Call
curl -X POST http://localhost:8080/schedule \
-H "Content-Type: application/json" \
-d '{
"extension": "1001",
"tool": "WEATHER",
"at_time": "07:00",
"timezone": "America/Los_Angeles",
"recurring": "daily",
"prefix": "Good morning!"
}' | jqResponse:
{
"schedule_id": "b2c3d4e5",
"status": "scheduled",
"extension": "1001",
"scheduled_for": "2025-12-01T07:00:00-08:00",
"delay_seconds": 36000,
"message": "Call scheduled for 2025-12-01T07:00:00-08:00",
"recurring": "daily"
}๐ One-time Medication Reminder
curl -X POST http://localhost:8080/schedule \
-H "Content-Type: application/json" \
-d '{
"extension": "5551234567",
"message": "This is your reminder to take your medication.",
"at_time": "2025-12-01T09:00:00",
"timezone": "America/New_York"
}' | jqGET /schedule
GET /scheduleList all scheduled calls.
curl http://localhost:8080/schedule | jqResponse:
[
{
"schedule_id": "a1b2c3d4",
"extension": "1001",
"scheduled_for": "2025-12-01T07:00:00-08:00",
"remaining_seconds": 25200,
"message": null,
"tool": "WEATHER",
"recurring": "daily",
"status": "pending"
},
{
"schedule_id": "b2c3d4e5",
"extension": "5551234567",
"scheduled_for": "2025-12-01T09:00:00-05:00",
"remaining_seconds": 32400,
"message": "Take your medication",
"tool": null,
"recurring": null,
"status": "pending"
}
]GET /schedule/{schedule_id}
GET /schedule/{schedule_id}Get details of a scheduled call.
curl http://localhost:8080/schedule/a1b2c3d4 | jqDELETE /schedule/{schedule_id}
DELETE /schedule/{schedule_id}Cancel a scheduled call.
curl -X DELETE http://localhost:8080/schedule/a1b2c3d4 | jqResponse:
{
"success": true,
"message": "Scheduled call a1b2c3d4 cancelled"
}๐ Speak to Active Call
POST /speak
POST /speakInject a message into an active call.
Query Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Text to speak |
call_id | string | No | Specific call ID |
curl -X POST "http://localhost:8080/speak?message=Attention:%20severe%20weather%20warning" | jqResponse:
{
"success": true,
"message": "Message spoken to call"
}๐ Webhooks
When you provide a callback_url, results are POSTed as JSON.
๐ Outbound Call Webhook
{
"call_id": "out-1732945860-1",
"status": "completed",
"extension": "5551234567",
"duration_seconds": 45.2,
"message_played": true,
"choice_response": "confirmed",
"choice_raw_text": "yes that works",
"error": null
}โฐ Scheduled Call Webhook
{
"schedule_id": "a1b2c3d4",
"status": "completed",
"extension": "1001",
"tool": "WEATHER",
"recurring": "daily",
"timestamp": "2025-12-01T07:00:45Z"
}โ Error Responses
All errors return appropriate HTTP status codes:
| Status | Description |
|---|---|
400 | Bad request (invalid parameters) |
404 | Resource not found |
500 | Internal server error |
Example error:
{
"detail": "Tool 'INVALID' not found. Use GET /tools to list available tools."
}๐ Quick Reference
| Endpoint | Method | Description |
|---|---|---|
/health | GET | ๐ฅ Health check |
/queue | GET | ๐ Queue status |
/call | POST | ๐ Initiate outbound call |
/call/{id} | GET | ๐ Get call status |
/tools | GET | ๐ง List all tools |
/tools/{name} | GET | ๐ง Get tool info |
/tools/{name}/execute | POST | โถ๏ธ Execute tool |
/tools/{name}/call | POST | ๐ Execute tool + call |
/schedule | POST | โฐ Schedule a call |
/schedule | GET | ๐ List scheduled calls |
/schedule/{id} | GET | ๐ Get scheduled call |
/schedule/{id} | DELETE | โ Cancel scheduled call |
/speak | POST | ๐ Speak to active call |
Updated about 1 month ago
