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

# Configuration

> Environment variables used by the application and what each group controls.

## Runtime Mode

| Variable       | Example              | Description                                                          |
| -------------- | -------------------- | -------------------------------------------------------------------- |
| `LLM_PROVIDER` | `sarvam` or `openai` | Selects preferred agent mode. The actual running file still matters. |

## LiveKit

| Variable               | Required        | Description                                         |
| ---------------------- | --------------- | --------------------------------------------------- |
| `LIVEKIT_URL`          | Yes             | WebSocket URL for the LiveKit project               |
| `LIVEKIT_API_KEY`      | Yes             | API key used by agents, token server, and SIP setup |
| `LIVEKIT_API_SECRET`   | Yes             | API secret used to sign server tokens               |
| `LIVEKIT_SIP_TRUNK_ID` | Yes for calling | Outbound SIP trunk ID used by scheduler             |
| `TOKEN_SERVER_PORT`    | No              | Port for `token_server.py`, default `8080`          |

## Vobiz SIP

| Variable             | Required               | Description                                   |
| -------------------- | ---------------------- | --------------------------------------------- |
| `VOBIZ_PHONE_NUMBER` | Recommended            | Caller ID / SIP number displayed when dialing |
| `VOBIZ_SIP_DOMAIN`   | Yes for trunk creation | SIP endpoint/domain supplied by Vobiz         |
| `VOBIZ_SIP_USERNAME` | Yes for auth           | SIP auth username                             |
| `VOBIZ_SIP_PASSWORD` | Yes for auth           | SIP auth password                             |

## OpenAI Realtime

| Variable                           | Default                   | Description                                     |
| ---------------------------------- | ------------------------- | ----------------------------------------------- |
| `OPENAI_API_KEY`                   | None                      | Required for `agent_realtime.py`                |
| `OPENAI_MODEL`                     | `gpt-4o-mini`             | Used for extraction/normalization in some flows |
| `OPENAI_REALTIME_MODEL`            | `gpt-4o-realtime-preview` | Realtime voice model                            |
| `OPENAI_REALTIME_TRANSCRIBE_MODEL` | `whisper-1`               | Input transcription model                       |
| `OPENAI_REALTIME_TEMPERATURE`      | `0.5`                     | Realtime generation temperature                 |
| `OPENAI_REALTIME_VAD_THRESHOLD`    | `0.45`                    | Voice activity threshold                        |
| `OPENAI_REALTIME_VAD_PREFIX_MS`    | `400`                     | Audio prefix padding before detected speech     |
| `OPENAI_REALTIME_VAD_SILENCE_MS`   | `700`                     | Silence duration before turn end                |
| `AUTO_HANGUP_ON_USER_END_PHRASE`   | `false`                   | Optional auto-hangup behavior                   |
| `USER_SILENCE_HANGUP_SECONDS`      | `15`                      | User silence timeout                            |
| `CALL_MAX_DURATION_SECONDS`        | `240`                     | Maximum call duration before save/hangup        |

## Sarvam

| Variable                        | Default        | Description                |
| ------------------------------- | -------------- | -------------------------- |
| `SARVAM_API_KEY`                | None           | Required for `agent.py`    |
| `STT_LANGUAGE`                  | `en-IN`        | Sarvam STT language        |
| `STT_MODEL`                     | `saarika:v2.5` | Sarvam STT model           |
| `STT_FLUSH_SIGNAL`              | `true`         | Enables STT flush behavior |
| `MIN_ENDPOINTING_DELAY_SECONDS` | `0.65`         | Turn-end tuning            |

## Database

| Variable       | Required | Description                  |
| -------------- | -------- | ---------------------------- |
| `DATABASE_URL` | Yes      | PostgreSQL connection string |

Docker Compose local database:

```env theme={null}
DATABASE_URL=postgresql://ignitech:ignitech@db:5432/ignitech
```

## Scheduler

| Variable                     | Default         | Description                             |
| ---------------------------- | --------------- | --------------------------------------- |
| `SCHEDULER_INTERVAL_SECONDS` | `60`            | How often to scan for new leads         |
| `PUSH_INTERVAL_SECONDS`      | `120`           | How often to push called records to CRM |
| `MAX_CONCURRENT_CALLS`       | `1`             | Active call limit                       |
| `STALE_CALL_MINUTES`         | `5`             | Max age for stuck `calling` records     |
| `MAX_CALL_RETRIES`           | `3`             | Max retry attempts per lead             |
| `CALL_TIMEZONE`              | `Asia/Kolkata`  | Calling-window timezone                 |
| `CALL_HOURS_START`           | `9`             | Start hour, inclusive                   |
| `CALL_HOURS_END`             | `20`            | End hour, exclusive                     |
| `CALL_ALLOWED_WEEKDAYS`      | Monday-Saturday | Allowed call days                       |
| `CALL_WHITELIST_NUMBERS`     | Empty           | Restrict calls to selected test numbers |
| `DISPLAY_TIMEZONE`           | `Asia/Kolkata`  | Dashboard display timezone              |

## Lead Sources

| Variable                          | Description                          |
| --------------------------------- | ------------------------------------ |
| `INDIAMART_API_KEY`               | IndiaMART CRM API key                |
| `INDIAMART_POLL_INTERVAL_MINUTES` | IndiaMART polling interval           |
| `INDIAMART_NEW_ONLY_MODE`         | Use IndiaMART cursor/new-only mode   |
| `FACEBOOK_ACCESS_TOKEN`           | Facebook Graph API token             |
| `FACEBOOK_PAGE_ID`                | Facebook Page ID                     |
| `FACEBOOK_APP_SECRET`             | Verifies Facebook webhook signatures |
| `FACEBOOK_VERIFY_TOKEN`           | Webhook verification token           |
| `FACEBOOK_AD_FORM_IDS`            | Comma-separated Lead Ad form IDs     |
| `WEBHOOK_PORT`                    | Port for Facebook webhook server     |

## Talking Shops

| Variable                                 | Default                                 | Description                             |
| ---------------------------------------- | --------------------------------------- | --------------------------------------- |
| `TALKINGSHOPS_API_URL`                   | `https://api.talkingshops.com/v1/tasks` | Task creation endpoint                  |
| `TALKINGSHOPS_API_KEY`                   | None                                    | CRM API key                             |
| `TALKINGSHOPS_AUTH_HEADER`               | `x-tenant-api-key`                      | Header name for auth                    |
| `TALKINGSHOPS_AUTH_PREFIX`               | Empty                                   | Optional auth prefix, such as `Bearer`  |
| `TALKINGSHOPS_CUSTOMERS_API_URL`         | Derived                                 | Customer lookup/create endpoint         |
| `TALKINGSHOPS_OWNERS`                    | Empty                                   | Round-robin `owner_id:owner_name` pairs |
| `TALKINGSHOPS_OWNER_ID`                  | Empty                                   | Static task owner ID                    |
| `TALKINGSHOPS_OWNER_NAME`                | Empty                                   | Static task owner name                  |
| `TALKINGSHOPS_TIMEOUT_SECONDS`           | `30`                                    | HTTP timeout                            |
| `TALKINGSHOPS_DRY_RUN`                   | `false`                                 | Log payload without sending             |
| `TALKINGSHOPS_MARK_FAILED_ON_PUSH_ERROR` | `true`                                  | Mark calls failed when push fails       |

## Dashboards

| Variable                               | Description                                            |
| -------------------------------------- | ------------------------------------------------------ |
| `MINUTES_DASHBOARD_PASSWORD`           | Optional password for `/minutes` Streamlit page        |
| `LEGACY_SUCCESS_CALL_ESTIMATE_MINUTES` | Estimate used for old successful rows without duration |
