Skip to content

ozoid/asterisk_assistant

Repository files navigation

Asterisk AI Assistant

An AI assistant for your telephone line.

Technologies used:

  • FreePBX 17.0.24 (Asterisk 22.6.0)
  • FastAPI
  • Vosk STT
  • Google TTS
  • Gemini 3.0
  • langChain
  • Redis
  • Green-API (WhatsApp)
  • Home Assistant

The AI will decide on what the caller wants and take one of the following actions:

  • Forward call to Voicemail
  • Forward call to Mobile Phone
  • Take a WhatsApp Message and send to a number
  • Take and schedule a meeting appointment
  • Take a message and send to email
  • Respond to a greeting
  • Toggle the Light Switch via Home Assistant
  • Respond to any other question

Meeting Appointments:

The AI will request a date, time, meeting type (online, physical), email address and physical address through a series of questions. Once all the data is gathered, the final details are read back to the caller.

Installation

  1. Copy into /var/lib/asterisk/agi-bin/ai
  2. Create a Custom Destination: ai-entry,s,1
  3. Add the following to your /etc/asterisk/extensions_custom.conf
[ai-entry]
  exten => s,1,NoOp(AI Entry Point)
    same => n,Progress()
    same => n,AGI(ai/ai_answer.py,${CALLERID(num)},${CALLERID(name)})
    same => n,Hangup()
  1. Reload your Dial Plans: asterisk -rx "dialplan reload"

  2. ensure you have the following variables set in a local .env file:

GEMINI_API_KEY - for the llm HA_URL, HA_TOKEN - for HomeAssistant WA_TOKEN, WA_MOBILE, WA_INSTANCE - for WhatsApp MOBILE_NUM - for forward to mobile SMTP_SERVER, SMTP_PORT, SMTP_USER, SMTP_PASS - for email and meetings

  1. Run the app.py (FastAPI) with uvicorn in a separate process (or separate machine): uvicorn app:app --host 127.0.0.1 --port 8000

  2. Use your Custom Destination in an IVR or elsewhere.

Next Steps

Real-time chat (audio streaming)

About

FreePBX/Asterisk AI Assistant

Resources

License

Stars

Watchers

Forks

Contributors

Languages