Skip to main content

A self-hosted automated outbound dialer phone bot

Project description

📞 Autodial PhoneBot: Self-Hosted AI Dialer

PyPI version License: MIT

Autodial is a production-grade, self-hosted outbound and inbound phone automation engine. It leverages state-of-the-art Local Speech-to-Text (STT), Large Language Models (LLM), and Local Text-to-Speech (TTS) to create intelligent, human-like phone interactions.

Built for high-performance automation, Autodial can handle inbound calls gracefully, navigate IVR menus, handle complex DTMF interactions, execute mass broadcasts, and notify your external systems via webhooks upon call conclusion. It natively supports both Twilio and Telnyx.


🚀 Key Features

  • Bidirectional Calling: Make automated outbound calls via Python or handle inbound calls instantly by pointing your Twilio/Telnyx webhook to the /incoming endpoint.
  • Provider Agnostic: Native auto-detection and WebSocket formatting for both Twilio and Telnyx media streams. Fixes all edge-case payload validation errors out of the box.
  • Multi-Concurrent Interaction: Built on FastAPI and Python's asyncio, handling dozens of simultaneous Media Streams with low overhead.
  • Local Transcription Engine: Powered by Faster-Whisper (STT). Optimized for GPU (RTX series) with automatic CPU fallback.
  • Dynamic AI Personalities: Inject per-call context, goals, and keywords. The AI intelligently adapts its persona and strategy for every unique target.
  • Developer-Defined Guardrails: Set strict system_instructions to keep calls on track and ensure brand-safe communication.
  • Intelligent Call Termination: Built-in intent recognition for phrases like "stop calling me" or "goodbye," ensuring polite and immediate hang-ups.
  • Broadcast & Direct Messaging: Need to send a simple notification? Use Broadcast Mode to play a direct message and disconnect immediately.
  • Automated Call Logs & Webhooks: Every call generates a detailed JSON transcript. Configure a callback_url to receive data as soon as the session ends.

🛠 Prerequisites & Installation

Core Requirements

  1. Ollama: Serving a chat-ready model (e.g., llama3.2) at a reachable URL.
  2. Piper TTS: The piper binary should be in your system PATH, along with its .onnx models.
  3. Twilio or Telnyx: An active Account SID/API Key, Auth Token, and a verified Phone Number.

System Install

pip install autodial

⚙️ Configuration

Autodial consumes configuration via environment variables. Create a .env file in your execution directory:

PORT=8000
TWILIO_ACCOUNT_SID=your_sid_here
TWILIO_AUTH_TOKEN=your_token_here
TWILIO_PHONE_NUMBER=+1234567890

# --- LLM Provider Selection ---
# Options: ollama (default), openai, gemini, mistral
LLM_PROVIDER=ollama
LLM_MODEL=llama3.2:3b

# Local Ollama URL (used if provider is ollama)
OLLAMA_CHAT_URL=http://localhost:11434/api/chat

# Cloud API Keys (Required depending on provider choice)
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=AIza...
MISTRAL_API_KEY=...

# --- Local TTS Settings ---
PIPER_MODEL=./en_US-lessac-medium.onnx

🖥 Start the Server

Launch the Autodial engine with a single command:

autodial

Note: The server will initialize Whisper on your GPU if available (CUDA), otherwise it fallbacks to CPU.


🗣 Natural Language CLI

You don't have to write Python code to place intelligent calls. Autodial includes a powerful NLP-driven CLI that translates plain English into API actions!

Ensure your Autodial server is running in the background, then simply type:

autodial call bob at 613-444-0101 and ask how his day is going

The CLI uses your local LLM to instantly extract the target phone number, the conversation context, and the goals, and then dispatches the call automatically.


🐍 Python Client Usage

The library includes a professional AutodialClient to make programmatic orchestration seamless.

from autodial import AutodialClient

# Connect to your Autodial instance
client = AutodialClient("http://localhost:8000")

# Scenario: Appointment Reminder with Guardrails
client.dial(
    target_number="+15551234567",
    context="Reminder for Dr. Smith's clinic",
    goals="Confirm the 2:00 PM slot today",
    system_instructions="Always be polite. If the user is busy, offer to call back later.",
    callback_url="https://api.yourclinic.com/webhooks/call-results"
)

# Scenario: Emergency Alert Broadcast
client.broadcast(
    numbers=["+15550001", "+15550002", "+15550003"],
    message="This is an automated alert from the city. Please evacuate immediately.",
    callback_url="https://api.city.gov/logs"
)

📞 Handling Inbound Calls (Bidirectional)

Autodial isn't just for outbound dialing. It exposes an /incoming REST endpoint that automatically generates the required TwiML/TeXML to connect callers to your AI bot.

Setup Instructions:

  1. Log in to your Twilio or Telnyx Console.
  2. Navigate to your active Phone Number settings.
  3. Find the Webhook URL for incoming calls.
  4. Set it to POST https://your-autodial-server.com/incoming

When a user dials your number, the provider hits the endpoint, receives the Media Stream instruction, and the AI connects automatically using the base SYSTEM_PROMPT.


📡 API Reference

POST /dial

Initiates a single interactive AI session.

Parameter Type Description
to_number string Required. The target phone number in E.164 format.
context string Detailed background info for the AI to understand the call's nature.
goals string Specific outcomes or data points the AI should strive to achieve.
keywords string Focus phrases for the transcription engine to prioritize.
system_instructions string High-priority guardrails and behavioral rules for the session.
callback_url string POST endpoint to receive the final JSON transcript and status.

POST /incoming

A webhook endpoint for Twilio/Telnyx. Do not call this manually. It automatically returns <Connect><Stream .../> XML to start a bidirectional session.


🛡 License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❤️ by the Autodial Maintainers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autodial-0.6.0.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autodial-0.6.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file autodial-0.6.0.tar.gz.

File metadata

  • Download URL: autodial-0.6.0.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for autodial-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b0cc9f8eb8fd465c872c8a8e7d6c233b994af9c1260b6fe4804809a86b9341a1
MD5 0a6686d36ef206f1ecb17d4e97928cbf
BLAKE2b-256 ddc2fee97424894935ecca13dfb5c5515f55e84eda8d36f795e829e5e34b95b7

See more details on using hashes here.

File details

Details for the file autodial-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: autodial-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for autodial-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16775bb13aa567e210038ed26dda7692621789912b046387b70bcd2214eae90a
MD5 12c0daec10327727a4a9601aadd0a044
BLAKE2b-256 b728423c06d1a8d0215f1109343660010574df525d121f70d941b05e8353db3a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page