Skip to main content

awesome_caller_boi

A small Python package that exposes a FastAPI router to connect Twilio’s voice streaming directly to the OpenAI realtime API (GPT-4o). It handles incoming calls, establishes the WebSocket media stream with Twilio, forwards audio to OpenAI, and sends back OpenAI’s audio response to the caller.

Features

  • Provides a FastAPI router for Twilio voice webhooks.
  • Streams inbound audio from Twilio to OpenAI in real time.
  • Encodes and forwards OpenAI’s audio responses back to Twilio.
  • Automatically handles speech interruptions (caller starts speaking mid-response).
  • Easy to configure with your own get_system_message() and get_system_greeting() callbacks.
  • Put your OpenAi key in your enviornment variables and call it OPENAI_API_KEY

Installation

From PyPI (once published):

pip install awesome_caller_boi

## Usage Example 

from awesome_caller_boi.call_handler import create_call_router
from models.transcripts import Transcript

def my_middleware_fn(transcript: Transcript) -> dict:
    # extract name, order, etc., or send it to your database
    print("Got a finished call from:", transcript.phone_number)
    print("Full transcript text:", transcript.call_text)
    return {"status": "ok"}

app.include_router(
    create_call_router(
        get_system_message=my_system_message,
        get_system_greeting=my_system_greeting,
        voice="alloy",
        on_call_complete=my_middleware_fn
    )
)

Metadata

Release files for awesome-caller-boi 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for awesome-caller-boi 0.2.4
File Size Uploaded
awesome_caller_boi-0.2.4.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for awesome-caller-boi 0.2.4
File Interpreter ABI Platform
awesome_caller_boi-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / awesome_caller_boi-0.2.4.tar.gz

Download URL awesome_caller_boi-0.2.4.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
650d96ede41dacc837c25b6165fcd4fa7042b74273827b2be2c94dd0eff7c5fb
BLAKE2b-256 checksum
How to use checksums
d3a98c035330b06f905acdd43c1f81c0878d89de41fb6becc089116f92cc087e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release files / awesome_caller_boi-0.2.4-py3-none-any.whl

Download URL awesome_caller_boi-0.2.4-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18d9f7e5d1e1a7149a60a40d4ef583378d5b2ca8178fe07648f1dcda0d52b1f9
BLAKE2b-256 checksum
How to use checksums
c6146f403b164ea7ed5a16e8df23a014892e96df72d98cea5d509e3e2b71a080
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page