Giter Club home page Giter Club logo

asterisk's Introduction

OpenAI-Powered Asterisk Voice Assistant

Welcome to the OpenAI-Powered Asterisk Voice Assistant project! This project integrates OpenAI's language models with an Asterisk-based telephony system to create an AI-powered voice assistant. The assistant can interact with callers, transcribe audio, generate responses, and send conversation summaries via email.

Features

  • Voice Interaction: The assistant can engage in a conversation with the caller, transcribing their speech and generating AI responses.
  • Text-to-Speech and Speech-to-Text: Utilizes OpenAI's API to convert text to speech and speech to text.
  • Email Summaries: Sends a summary of the conversation to a specified email address.
  • Call Handling: Integrates with Asterisk to handle incoming calls and play audio files.

Prerequisites

  • Python 3.6+
  • Asterisk telephony server
  • OpenAI API key
  • SMTP server credentials for sending emails

Setup Virtual Environment

To ensure all dependencies are managed and isolated, it's recommended to use a Python virtual environment.

  1. Create a virtual environment:

    python3 -m venv venv
  2. Activate the virtual environment:

    • On Linux/MacOS:
      source venv/bin/activate
    • On Windows:
      .\venv\Scripts\activate
  3. Install required Python packages:

    pip install -r requirements.txt
  4. Deactivate the virtual environment when done:

    deactivate

Make sure to activate the virtual environment each time you work on the project to ensure you are using the isolated environment.

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/openai-asterisk-assistant.git
    cd openai-asterisk-assistant
  2. Install required Python packages:

    pip install -r requirements.txt
  3. Set up environment variables:

    cp .env.example .env

    Open the .env file and add your environment variables:

    OPENAI_API_KEY=your_openai_api_key
    EMAIL_FROM=[email protected]
    EMAIL_USERNAME=smtp_username
    EMAIL_PASSWORD=smtp_password
    EMAIL_SMTP_SERVER=smtp.example.com
    EMAIL_SMTP_PORT=587
  4. Configure Asterisk: Ensure your Asterisk server is configured to use AGI scripts and point to the main.py script for handling calls.

Usage

  1. Start the Asterisk server: Ensure your Asterisk server is running and properly configured.

  2. Run the script: The script will be executed automatically by Asterisk when a call is received.

  3. Testing: Make a call to the Asterisk server and interact with the AI assistant.

Logging

Logs are saved to /var/log/openai_assistant.log. You can change the log file location by modifying the logging.basicConfig configuration in the script.

Configuration

Adjust the following configuration options in the script as needed:

  • SILENCE_THRESHOLD: Threshold for detecting silence in the audio (default: -30 dB).
  • SILENCE_DURATION: Duration of silence in seconds to consider the end of a recording (default: 2 seconds).

Contributing

We welcome contributions! Please fork the repository and submit pull requests.

License

This project is licensed under the MIT License.

Acknowledgements

  • OpenAI for their amazing API.
  • Asterisk for the open-source telephony toolkit.
  • All contributors and users of this project!

Contact

For questions or support, please contact [email protected].

asterisk's People

Contributors

sergeychernyakov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.