Skip to main content

A self-hosted automated outbound dialer phone bot

Project description

📞 Autodial PhoneBot

The Ultimate Self-Hosted AI Dialer & Voice Automator

PyPI version License: MIT Python 3.8+


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

Whether you need a dynamic AI receptionist, a high-volume outbound lead qualifier, or a system to navigate complex IVR menus with DTMF tones, Autodial is the ultimate developer tool. It natively bridges Twilio and Telnyx media streams with zero friction.


🚀 Why Autodial?

  • Multi-LLM Cloud & Local Support: Power your conversations with OpenAI, Google Gemini, MistralAI, or keep it 100% private and offline using Ollama.
  • Bidirectional Calling: Trigger 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 Twilio and Telnyx. Drop in your API keys and go.
  • Natural Language CLI: Execute phone calls from your terminal using plain English (autodial call bob and ask...). The CLI automatically extracts parameters using your configured LLM.
  • Local Transcription Engine: Powered by Faster-Whisper (STT). Optimized for GPU (RTX series) with automatic CPU fallback for lightning-fast voice transcription.
  • Intelligent Call Termination: Built-in intent recognition for phrases like "stop calling me" or "goodbye," ensuring polite and immediate hang-ups.
  • Webhooks & Transcripts: Every call generates a detailed JSON transcript. Configure a callback_url to pipe data directly into your CRM.

🛠 Quickstart Installation

Core Requirements

  1. TTS Engine: The piper binary should be in your system PATH, along with its .onnx models.
  2. LLM Provider: An API key for OpenAI/Gemini/Mistral, OR a local Ollama instance serving a chat-ready model (e.g., llama3.2).
  3. Telephony: An active Account SID/API Key, Auth Token, and a verified Phone Number from Twilio or Telnyx.

Install via PyPI

pip install autodial

⚙️ Configuration (.env)

Autodial consumes configuration via environment variables. Create a .env file in the directory where you run the server:

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=openai
LLM_MODEL=gpt-4o

# Cloud API Keys (Required if using cloud provider)
OPENAI_API_KEY=sk-your-key
# GEMINI_API_KEY=AIza...
# MISTRAL_API_KEY=...

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

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

(Note: If using Telnyx, provide your Telnyx API keys within the Twilio env vars for drop-in compatibility).


🖥 1. Start the Server

Launch the Autodial engine. It handles all WebSockets and REST routes.

autodial serve

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


🗣 2. Natural Language CLI

You don't even need 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 configured LLM to instantly extract the target phone number, the conversation context, and the goals, and then dispatches the call automatically.


🐍 3. Full Python Demo (The API Client)

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

demo.py

import time
from autodial import AutodialClient

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

def run_outbound_demo():
    print("📞 Placing intelligent outbound call...")
    
    # Scenario: Appointment Reminder with Guardrails
    response = client.dial(
        target_number="+15551234567",
        context="Reminder for Dr. Smith's dental clinic.",
        goals="Confirm the 2:00 PM slot today. Ask if they need directions.",
        system_instructions="Always be polite. If the user is busy, offer to call back later. Keep responses short.",
        callback_url="https://api.yourclinic.com/webhooks/call-results"
    )
    
    print(f"✅ Call Initiated: {response}")

def run_broadcast_demo():
    print("📢 Initiating Mass Broadcast...")
    
    # Scenario: Emergency Alert Broadcast
    response = 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"
    )
    
    print(f"✅ Broadcast Initiated: {response}")

if __name__ == "__main__":
    run_outbound_demo()
    time.sleep(5)
    run_broadcast_demo()

📞 4. 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 instructions, and the AI answers immediately using your configured LLM_PROVIDER.


📡 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.1.tar.gz (17.2 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.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autodial-0.6.1.tar.gz
  • Upload date:
  • Size: 17.2 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.1.tar.gz
Algorithm Hash digest
SHA256 ad35d14232ab68a7531b3385090f22a979b710c34860628ce9a9ddcd66441b83
MD5 6afe37a6da66b780c957e3bc3c08f760
BLAKE2b-256 cf40fb33bece7c03aceb67144fa6d7caf751b18b84a6145f43d924200314b1e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autodial-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 17.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 04ee7d26bd2c7e5f92d4c36ca32bb590d2fa457f889a693aec791c49709b6be6
MD5 6a50fb854b0045dc654e244383c4e171
BLAKE2b-256 4309c201bf2089c53f20dee34dea75f52b6ebfb27afd09c0eb99f13de379fe69

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