Skip to content

Latest commit

 

History

History
116 lines (77 loc) · 3.63 KB

File metadata and controls

116 lines (77 loc) · 3.63 KB

Overview

This project is managed using pyproject.toml and the uv package manager for fast Python dependency management.

1. Test with Web Client

Set Up Environment Variables

Based on .env.sample, create a .env file to allow your local app to access your Azure resource.

Run the App Locally

  1. Run the local server:

    uv run server.py
  2. Once the app is running, open http://127.0.0.1:8000 in your browser (or click the printed URL in the terminal).

  3. On the page, click Start to begin speaking with the agent using your browser’s microphone and speaker.

Run with Docker (Alternative)

If you prefer Docker or are running in GitHub Codespaces:

  1. Build the image:

    docker build -t voiceagent .
    
  2. Run the image with local environment variables:

    docker run --env-file .env -p 8000:8000 -it voiceagent
    
  3. Open http://127.0.0.1:8000 and click Start to interact with the agent.

2. Test with ACS Client (Phone Call)

To test Azure Communication Services (ACS) locally, we’ll expose the local server using Azure DevTunnels.

DevTunnels allow public HTTP/S access to your local environment — ideal for webhook testing.

  1. Install Azure Dev CLI if not already installed.

  2. Log in and create a tunnel:

    devtunnel login
    devtunnel create --allow-anonymous
    devtunnel port create -p 8000
    devtunnel host
  3. The final command will output a URL like:

    https://<your-tunnel>.devtunnels.ms:8000
    
  4. Add this URL to your .env file under:

    ACS_DEV_TUNNEL=https://<your-tunnel>.devtunnels.ms:8000
    

Set Up Incoming Call Event

  1. Go to your Communication Services resource in the Azure Portal.
  2. In the left menu, click Events+ Event Subscription.
  3. Use the following settings:
    • Event type: IncomingCall
    • Endpoint type: Web Hook
    • Endpoint URL:
      https://<your-tunnel>.devtunnels.ms:8000/acs/incomingcall
      

Ensure both your local Python server and DevTunnel are running before creating the subscription.

Call the Agent

  1. Get a phone number for your ACS resource if not already provisioned.
  2. Call the number. Your call will route to your local agent.

Recap

  • Use the web client for fast local testing.
  • Use DevTunnel + ACS to simulate phone calls and test telephony integration.
  • Use Genesys AudioHook to integrate with Genesys Cloud contact center.
  • Customize the .env file, system prompts, and runtime behavior to fit your use case.

3. Test with Genesys AudioHook

Genesys AudioHook (Audio Connector) streams real-time call audio from Genesys Cloud to your AudioHook endpoint for AI processing.

Set Up Environment Variables

Add the following to your .env file:

GENESYS_API_KEY=your-chosen-api-key

Run Locally

uv run server.py

The server starts with:

  • AudioHook WebSocket: ws://127.0.0.1:8000/audiohook/ws
  • Browser Simulator: http://127.0.0.1:8000/genesys

Open the simulator page, enter the same API key, and click Connect & Start Call to test without a Genesys Cloud account.

For production setup and full details, see the Genesys AudioHook section in the top-level README.