> ## 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.

# Quickstart

> Install dependencies, configure environment variables, initialize SIP, and run the application locally.

## Prerequisites

* Python 3.10 or newer
* PostgreSQL, either local or Docker Compose
* LiveKit Cloud project
* Vobiz SIP trunk credentials
* Sarvam API key for `agent.py`, or OpenAI API key for `agent_realtime.py`
* Talking Shops API credentials if CRM push is enabled

## 1. Create The Environment

```powershell theme={null}
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt
```

## 2. Configure `.env`

Copy `.env.example` to `.env` and fill in the required values.

Minimum local setup:

```env theme={null}
DATABASE_URL=postgresql://user:password@localhost:5432/ignitech

LIVEKIT_URL=wss://your-project.livekit.cloud
LIVEKIT_API_KEY=your_livekit_api_key
LIVEKIT_API_SECRET=your_livekit_api_secret

VOBIZ_PHONE_NUMBER=+918071XXXXXX
VOBIZ_SIP_DOMAIN=your-trunk-id.sip.vobiz.ai
VOBIZ_SIP_USERNAME=your_vobiz_username
VOBIZ_SIP_PASSWORD=your_vobiz_password

LLM_PROVIDER=openai
OPENAI_API_KEY=your_openai_api_key
OPENAI_REALTIME_MODEL=gpt-4o-realtime-preview
```

For Sarvam mode:

```env theme={null}
LLM_PROVIDER=sarvam
SARVAM_API_KEY=your_sarvam_api_key
STT_LANGUAGE=en-IN
STT_MODEL=saarika:v2.5
```

## 3. Initialize The Database

The schema is safe to initialize repeatedly.

```powershell theme={null}
python db.py
```

## 4. Create LiveKit SIP Configuration

```powershell theme={null}
python sip_setup.py create
python sip_setup.py list
```

Copy the outbound trunk ID from the list output into:

```env theme={null}
LIVEKIT_SIP_TRUNK_ID=ST_xxxxxxxxxxxx
```

## 5. Run The App Locally

Open separate terminals.

OpenAI Realtime agent:

```powershell theme={null}
python agent_realtime.py start
```

Scheduler:

```powershell theme={null}
python scheduler.py
```

Lead fetcher:

```powershell theme={null}
python lead_fetcher.py
```

Dashboard:

```powershell theme={null}
streamlit run streamlit_app.py
```

Token server for browser testing:

```powershell theme={null}
python token_server.py
```

## 6. Add A Test Lead

```sql theme={null}
INSERT INTO leads (name, phone, source)
VALUES ('Test Lead', '<10-digit-mobile>', 'manual');
```

The scheduler normalizes Indian mobile numbers to E.164, so `98765XXXXX`, `098765XXXXX`, `9198765XXXXX`, and `+9198765XXXXX` can all resolve to `+9198765XXXXX` if valid.

## 7. Make A Manual SIP Test Call

```powershell theme={null}
python sip_setup.py call +91XXXXXXXXXX
```

For a real lead room:

```powershell theme={null}
python sip_setup.py call +91XXXXXXXXXX 123
```

That joins room `ignitech-lead-123` using participant identity `sip-lead-123`.
