### Install Project Dependencies Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Upgrades pip to the latest version and then installs all project dependencies listed in the 'requirements.txt' file. This includes libraries like LiveKit Agents, Sarvam AI, OpenAI, FastAPI, Supabase, and pytz. ```bash pip install --upgrade pip pip install -r requirements.txt ``` -------------------------------- ### Copy Environment File on Mac/Linux Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Copies the example environment file '.env.example' to '.env' on macOS or Linux systems. This file will be used to store sensitive API keys and configuration settings. ```bash cp .env.example .env ``` -------------------------------- ### Copy Environment File on Windows Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Copies the example environment file '.env.example' to '.env' on Windows systems using the 'copy' command. This file will be used to store sensitive API keys and configuration settings. ```powershell copy .env.example .env ``` -------------------------------- ### Clone Repository and Navigate Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Clones the InboundAIVoice repository from GitHub and changes the current directory to the newly cloned repository. ```bash git clone https://github.com/toprmrproducer/InboundAIVoice.git cd InboundAIVoice ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md An example `.env` file structure showing the required environment variables for LiveKit, OpenAI, Sarvam AI, Cal.com, Supabase, Telegram, and call transfer settings. Users must fill in their specific API keys and project details. ```env # LiveKit — from cloud.livekit.io → your project → Settings LIVEKIT_URL=wss://your-project.livekit.cloud LIVEKIT_API_KEY=APIxxxxxxxxxxxxxxxx LIVEKIT_API_SECRET=your_livekit_api_secret # OpenAI OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Sarvam AI SARVAM_API_KEY=sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Cal.com — from app.cal.com/settings/developer/api-keys CAL_API_KEY=cal_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CAL_EVENT_TYPE_ID=1234567 # Your event type ID from Cal.com # Supabase — from app.supabase.com → Settings → API SUPABASE_URL=https://your-project-ref.supabase.co SUPABASE_KEY=your_supabase_anon_key # Supabase S3 (for call recordings) SUPABASE_S3_ACCESS_KEY=your_access_key_id SUPABASE_S3_SECRET_KEY=your_secret_access_key SUPABASE_S3_ENDPOINT=https://your-project-ref.supabase.co/storage/v1/s3 SUPABASE_S3_REGION=ap-south-1 # Telegram — create bot via @BotFather TELEGRAM_BOT_TOKEN=1234567890:AAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx TELEGRAM_CHAT_ID=123456789 # Call transfer fallback number DEFAULT_TRANSFER_NUMBER=+91XXXXXXXXXX ``` -------------------------------- ### Install Dependencies and Start Agent Worker (Bash) Source: https://context7.com/toprmrproducer/inboundaivoice/llms.txt Installs project dependencies using 'uv' and starts the main agent worker. The agent worker must remain running to process incoming dispatch jobs. ```bash # Install dependencies uv venv uv pip install -r requirements.txt # Start the agent worker (keep this terminal running) uv run python agent.py start # Expected output: # INFO:livekit.agents:registered worker outbound-caller # INFO:outbound-agent:[AGENT] Session live — waiting for caller audio. ``` -------------------------------- ### Run AI Voice Agent (Python) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Commands to start the AI voice agent in either development mode (with detailed logs and auto-reloading) or production mode. Ensure your Python virtual environment is active before running these commands. ```bash # Development mode (detailed logs, auto-reload) python agent.py dev # OR Production mode python agent.py start ``` -------------------------------- ### Deploy to Coolify (Shell Command) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md The start command for deploying the application using Coolify. This command assumes supervisord is configured to manage both the agent and UI server processes. ```bash supervisord -c supervisord.conf ``` -------------------------------- ### Install Python 3.11+ on Linux (Ubuntu/Debian) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Installs Python 3.11, its virtual environment package, and pip on Ubuntu/Debian systems. It updates the package list and then installs the necessary packages. ```bash sudo apt update sudo apt install python3.11 python3.11-venv python3-pip -y python3.11 --version ``` -------------------------------- ### Environment Variables Setup Example (Bash) Source: https://context7.com/toprmrproducer/inboundaivoice/llms.txt Lists essential environment variables required for various integrations including LiveKit, OpenAI, Sarvam AI, Cal.com, Supabase, Telegram, and SIP/VoBiz. These should be set in a `.env` file. ```bash # LiveKit Cloud (https://cloud.livekit.io) LIVEKIT_URL=wss://your-project.livekit.cloud LIVEKIT_API_KEY=APIxxxxxxxxxxxxxxxx LIVEKIT_API_SECRET=your_livekit_api_secret_here # OpenAI (LLM) OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Sarvam AI (STT + TTS for Indian languages) SARVAM_API_KEY=sk_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Cal.com (Booking) CAL_API_KEY=cal_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx CAL_EVENT_TYPE_ID=1234567 # Supabase (Database + Storage) SUPABASE_URL=https://your-project-ref.supabase.co SUPABASE_KEY=your_supabase_anon_key_here SUPABASE_S3_ACCESS_KEY=your_supabase_s3_access_key_id SUPABASE_S3_SECRET_KEY=your_supabase_s3_secret_access_key SUPABASE_S3_ENDPOINT=https://your-project-ref.supabase.co/storage/v1/s3 # Telegram Notifications TELEGRAM_BOT_TOKEN=1234567890:AAxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx TELEGRAM_CHAT_ID=123456789 # SIP / VoBiz VOBIZ_SIP_DOMAIN=your_sip_domain.sip.vobiz.ai VOBIZ_USERNAME=your_username VOBIZ_PASSWORD=your_password VOBIZ_OUTBOUND_NUMBER=+91XXXXXXXXXX DEFAULT_TRANSFER_NUMBER=+91XXXXXXXXXX ``` -------------------------------- ### Create and Activate Virtual Environment (Mac/Linux) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Creates a Python virtual environment named '.venv' and activates it. This isolates project dependencies. The prompt will indicate activation by showing '(.venv)'. ```bash python3.11 -m venv .venv source .venv/bin/activate ``` -------------------------------- ### Create and Activate Virtual Environment on Windows Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Creates a Python virtual environment named '.venv' and activates it using PowerShell commands. This isolates project dependencies. ```powershell python -m venv .venv .venv\Scripts\activate ``` -------------------------------- ### Install Python 3.11+ on Mac Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Installs Python 3.11 on macOS using Homebrew. It first ensures Homebrew is installed, then installs Python 3.11, and finally verifies the installation. ```bash # Install Homebrew first (if not installed) /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" # Install Python 3.11 brew install python@3.11 # Verify python3 --version # Should show Python 3.11.x or higher ``` -------------------------------- ### Run Dashboard UI Server (Python) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md Command to launch the dashboard UI server, which is built using FastAPI. This should be run in a separate terminal from the agent. Ensure your Python virtual environment is active. ```bash python ui_server.py ``` -------------------------------- ### Vobiz SIP Trunk Setup Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/saravm.md This section provides the API calls required to set up a SIP trunk with Vobiz, purchase a phone number, and configure inbound traffic to point to your LiveKit instance. ```APIDOC ## Vobiz SIP Trunk Setup ### 4.1 Create a SIP Trunk via Vobiz API This API call creates a new SIP trunk in your Vobiz account. ### Method `POST` ### Endpoint `https://api.vobiz.ai/api/v1/account/{YOUR_ACCOUNT_ID}/trunks` ### Parameters #### Path Parameters - **YOUR_ACCOUNT_ID** (string) - Required - Your Vobiz account identifier. #### Request Body - **name** (string) - Required - A name for the SIP trunk (e.g., "Sarvam-LiveKit-Agent-Trunk"). - **auth_type** (string) - Required - Authentication type, typically "credentials". ### Request Example ```json { "name": "Sarvam-LiveKit-Agent-Trunk", "auth_type": "credentials" } ``` ### Response #### Success Response (200) Returns details of the created SIP trunk, including `sip_domain`, `username`, and `password` which are crucial for subsequent steps. --- ### 4.2 Purchase a Phone Number This API call allows you to purchase a new phone number in a specified country. ### Method `POST` ### Endpoint `https://api.vobiz.ai/api/v1/account/{ACCOUNT_ID}/numbers` ### Parameters #### Path Parameters - **ACCOUNT_ID** (string) - Required - Your Vobiz account identifier. #### Request Body - **country** (string) - Required - The ISO country code for the number (e.g., "IN" for India). - **type** (string) - Required - The type of number to purchase (e.g., "local"). ### Request Example ```json { "country": "IN", "type": "local" } ``` ### Response #### Success Response (200) Returns details of the purchased phone number. --- ### 4.3 Point Vobiz Inbound Traffic → LiveKit This API call updates the SIP trunk configuration to direct incoming calls to your LiveKit instance. **Important:** Remove the `sip:` prefix from the LiveKit SIP URI when entering it into Vobiz. ### Method `PATCH` ### Endpoint `https://api.vobiz.ai/api/v1/account/{ACCOUNT_ID}/trunks/{TRUNK_ID}` ### Parameters #### Path Parameters - **ACCOUNT_ID** (string) - Required - Your Vobiz account identifier. - **TRUNK_ID** (string) - Required - The ID of the SIP trunk to update. #### Request Body - **inbound_destination** (string) - Required - The LiveKit SIP URI without the `sip:` prefix (e.g., `my-project-id.sip.livekit.cloud:5060`). ### Request Example ```json { "inbound_destination": "my-project-id.sip.livekit.cloud:5060" } ``` ### Response #### Success Response (200) Confirms the update of the SIP trunk's inbound destination. ### Mapping Table | LiveKit Shows | What You Enter in Vobiz | |---|---| | `sip:my-project.sip.livekit.cloud:5060` | `my-project.sip.livekit.cloud:5060` | ``` -------------------------------- ### Start LiveKit AI Voice Agent (Python) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/LOCAL_STARTUP_GUIDE.md Runs the 'agent.py' script using Python 3 to start the main LiveKit AI Voice Agent. This script initiates the backend process responsible for handling voice calls. ```python python3 agent.py ``` -------------------------------- ### Start FastAPI UI Server (Python) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/LOCAL_STARTUP_GUIDE.md Executes the 'ui_server.py' script using Python 3 to launch the FastAPI-based Developer Control Panel. This server provides a web interface for configuring the AI agent. ```python python3 ui_server.py ``` -------------------------------- ### Automate SIP Trunk Setup Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/transfer_call.md A Python script to automate the configuration of the LiveKit SIP Trunk using Vobiz credentials. This resolves common authentication errors by syncing credentials. ```powershell python setup_trunk.py ``` -------------------------------- ### Configure Supabase Storage for Call Recordings (SQL) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/QUICKSTART.md This SQL script sets up a 'call-recordings' bucket in Supabase Storage, making it publicly readable for retrieval and allowing service roles for insertion. Ensure your Supabase project is configured with S3 compatibility. ```sql INSERT INTO storage.buckets (id, name, public) VALUES ('call-recordings', 'call-recordings', true) ON CONFLICT (id) DO UPDATE SET public = true; CREATE POLICY "Public read recordings" ON storage.objects FOR SELECT USING (bucket_id = 'call-recordings'); CREATE POLICY "Service role write recordings" ON storage.objects FOR INSERT WITH CHECK (bucket_id = 'call-recordings'); ``` -------------------------------- ### Setup SIP Trunk Source: https://context7.com/toprmrproducer/inboundaivoice/llms.txt Configures the LiveKit SIP trunk with Vobiz credentials for telephony integration. ```APIDOC ## LiveKit SIP Trunk Configuration ### Description This section outlines the process of configuring an outbound SIP trunk using the LiveKit API, specifically for integration with Vobiz. ### Method Asynchronous Function Call (Python) ### Endpoint `livekit.api.sip.update_outbound_trunk_fields` ### Parameters #### Path Parameters - **trunk_id** (string) - Required - The ID of the SIP trunk to update, obtained from the LiveKit dashboard. #### Request Body Parameters (passed to the function) - **address** (string) - Required - The SIP server address (e.g., `your_domain.sip.vobiz.ai`). - **auth_username** (string) - Required - The username for SIP authentication. - **auth_password** (string) - Required - The password for SIP authentication. - **numbers** (array of strings) - Required - A list of phone numbers associated with this trunk (e.g., `["+91XXXXXXXXXX"]`). ### Request Example (Python) ```python import asyncio from livekit import api async def main(): lkapi = api.LiveKitAPI() trunk_id = "ST_xxxxxxxxx" # From LiveKit dashboard address = "your_domain.sip.vobiz.ai" username = "your_username" password = "your_password" number = "+91XXXXXXXXXX" await lkapi.sip.update_outbound_trunk_fields( trunk_id, address=address, auth_username=username, auth_password=password, numbers=[number], ) print("SIP Trunk updated successfully!") await lkapi.aclose() # To run: # uv run python setup_trunk.py ``` ### Response #### Success Response - **Console Output**: "SIP Trunk updated successfully!" #### Error Response - **Exception**: If the update fails, an exception will be raised by the `livekit` library. ``` -------------------------------- ### Define Project Dependencies in requirements.txt Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/saravm.md Lists the Python packages required for the project, specifying version constraints for livekit-agents and python-dotenv. This file is used to ensure consistent installations across different environments. ```txt livekit-agents[sarvam,openai,silero]~=1.3 python-dotenv>=1.0 ``` -------------------------------- ### Tandem Skill Invocation Examples Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/SOP.md Demonstrates the syntax for invoking multiple AI skills concurrently within a single prompt. These examples cover various scenarios, from UI development to backend implementation and testing. ```text "Use @ui-ux-pro-max and @react-patterns together to build the hero section. Also apply @tailwind-patterns for all styling and @seo-audit for meta structure." ``` ```text "Invoke @senior-fullstack alongside @backend-dev-guidelines and @api-patterns to design and implement the authentication module, with @api-security-best-practices and @auth-implementation-patterns running in parallel for every decision." ``` ```text "Run @test-driven-development, @e2e-testing-patterns, and @browser-automation in tandem to produce unit, integration, and E2E tests for the checkout flow." ``` ```text "Use @brainstorming and @concise-planning together to plan the sprint, then use @product-manager-toolkit to produce the PRD." ``` -------------------------------- ### Control Response Length via System Prompt (Text) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/LOCAL_STARTUP_GUIDE.md Provides an example of how to limit the LLM's response length by including specific instructions within the system prompt. This is presented as an alternative to using the 'max_tokens' parameter directly in the LLM constructor. ```text CRITICAL: Every reply must be under 20 words. Maximum 1 sentence. Never give lists. ``` -------------------------------- ### Install Python Dependencies with uv Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/README.md Installs project dependencies using the 'uv' package manager. This ensures all required Python packages are available in the virtual environment. ```shell # Create virtual environment uv venv # Install required packages uv pip install -r requirements.txt ``` -------------------------------- ### Verify and Install Skills - Bash Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/SOP.md Checks for the presence of agent skills in the universal path and installs them if not found using npx. Includes fallbacks for tool-specific paths and a method to install from GitHub if a 404 error occurs. ```bash # Check universal path first test -d ~/.agent/skills && echo "✅ Skills ready at ~/.agent/skills" # If not found, install immediately: npx antigravity-awesome-skills # Tool-specific fallbacks: # npx antigravity-awesome-skills --claude → .claude/skills/ # npx antigravity-awesome-skills --gemini → .gemini/skills/ # npx antigravity-awesome-skills --cursor → .cursor/skills/ # npx antigravity-awesome-skills --codex → .codex/skills/ # If 404 error: # npx github:sickn33/antigravity-awesome-skills ``` -------------------------------- ### Start and Test Agent Script Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/saravm.md These bash commands are used to run and test the agent script. 'python agent.py dev' starts the agent in verbose logging mode for development, while 'python agent.py start' runs it in production mode. 'python agent.py console' simulates a caller in a separate terminal for testing without a phone. ```bash # Development mode (verbose logging) python agent.py dev # Production mode python agent.py start ``` ```bash # In a second terminal — simulates a caller python agent.py console ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/README.md Copies the example environment file and prompts the user to fill in LiveKit, OpenAI, Deepgram, and Vobiz SIP credentials. This is crucial for the agent and call functionality to work. ```shell cp .env.example .env.local ``` ```env LIVEKIT_URL=wss://... LIVEKIT_API_KEY=... LIVEKIT_API_SECRET=... OPENAI_API_KEY=... DEEPGRAM_API_KEY=... # SIP Config VOBIZ_SIP_DOMAIN=... VOBIZ_USERNAME=... VOBIZ_PASSWORD=... VOBIZ_OUTBOUND_NUMBER=+91... ``` -------------------------------- ### Install Python Dependencies for Sarvam AI Agent Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/saravm.md Installs the necessary Python packages for the Sarvam AI voice agent, including LiveKit agents with Sarvam and OpenAI support, and python-dotenv for environment variable management. It's recommended to use a virtual environment. ```bash # Recommended: use a virtual environment python -m venv .venv source .venv/bin/activate # macOS/Linux # OR .venv\Scripts\activate # Windows # Install all required packages pip install "livekit-agents[sarvam,openai,silero]~=1.3" python-dotenv ``` -------------------------------- ### Activate Virtual Environment and Run Make Call Script Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/LOCAL_STARTUP_GUIDE.md This snippet demonstrates how to activate a Python virtual environment and then execute the make_call.py script. The script requires a '--to' argument with a phone number to initiate a test call. ```bash cd "/Users/shreyasraj/Desktop/inbound AI voice" source ".venv/bin/activate" python3 make_call.py --to "+91XXXXXXXXXX" ``` -------------------------------- ### Agent Configuration Example (JSON) Source: https://context7.com/toprmrproducer/inboundaivoice/llms.txt Defines the behavior, voice settings, and API credentials for the AI agent. This configuration is reloaded per call, allowing for dynamic updates. ```json { "agent_instructions": "You are Aryan, a multilingual AI sales consultant. Book discovery calls and demos.\n\nSPEECH STYLE:\n- Max 1-2 short sentences per response\n- Use natural fillers: \"Hmm...\", \"Acha so...\"\n- Mirror caller's energy and pace", "first_line": "Namaste! This is Aryan from RapidX AI — we help businesses automate with AI. May I ask what kind of business you run?", "stt_min_endpointing_delay": 0.2, "llm_model": "gpt-4o-mini", "llm_provider": "openai", "tts_voice": "kavya", "tts_language": "hi-IN", "tts_provider": "sarvam", "stt_provider": "sarvam", "stt_language": "unknown", "lang_preset": "multilingual", "max_turns": 25 } ``` -------------------------------- ### Navigate to Project Directory (Bash) Source: https://github.com/toprmrproducer/inboundaivoice/blob/main/LOCAL_STARTUP_GUIDE.md Changes the current directory to the specified project path. This is a common first step in setting up or running a project from the terminal. ```bash cd "/Users/shreyasraj/Desktop/inbound AI voice" ```