Documentation Index
Fetch the complete documentation index at: https://docs.spn.wtf/llms.txt
Use this file to discover all available pages before exploring further.
Why LiveKit Is Used
LiveKit is the realtime audio layer. It provides:
- Rooms for each call
- Audio transport between the phone participant and the AI agent
- Agent job dispatch through
livekit-agents
- SIP APIs for connecting phone calls
- JWT-based access tokens for browser/local testing
Room Naming
Outbound lead calls use:
The agent reads the room name to understand which lead is being called.
SIP Participant Creation
The scheduler calls LiveKit’s SIP API:
CreateSIPParticipantRequest(
sip_trunk_id=LIVEKIT_SIP_TRUNK_ID,
sip_call_to="+91XXXXXXXXXX",
room_name="ignitech-lead-123",
participant_identity="sip-lead-123",
participant_name="Lead",
krisp_enabled=True,
play_ringtone=True,
)
If VOBIZ_PHONE_NUMBER is configured, it is also passed as sip_number.
Agent Runtime
Both agents are LiveKit agents:
agent.py: Sarvam STT + LLM + TTS pipeline
agent_realtime.py: OpenAI Realtime session
Each agent joins the LiveKit room, listens for the SIP participant, conducts the conversation, and saves the result to PostgreSQL.
Token Server
token_server.py exposes:
GET /api/token?identity=<id>&room=<room>&lang=<lang>
It returns:
{
"token": "jwt",
"url": "wss://your-project.livekit.cloud",
"identity": "user",
"room": "ignitech-lead-123"
}
This is mainly for local browser testing, not the production outbound calling path.
Required Environment
LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret
LIVEKIT_SIP_TRUNK_ID=ST_xxxxxxxxxxxx