Skip to content
SIHub Guides
Select language
Guides/Real-time telephony
SIHub · Guides

Connect LiveKit Cloud, AT SIP and voice services

This procedure sets up the additional LiveKit real-time path for voice. The existing Twilio Gather/Say path remains separate. A LiveKit worker uses streaming STT, LLM and streaming TTS; the existence of the pipeline does not yet prove a particular call quality or 20 parallel calls. The operator deliberately performs all of the following cloud/SIP actions with their own accounts.

Start with the configuration overview, if you do not have provider accounts yet. For telephony, you need LiveKit, a SIP provider, Deepgram, the central operator AI and one TTS provider. Text and voice use the same AI access. Every voice model request goes through workspace-api-v2 to the SIHub backend and is reserved and billed there against the applicable workspace/agent allowance, even with shared platform allowances. Voice and transport costs are still recorded separately. A separate voice cloud or DGX hybrid path is not used for new sessions.

The voice output begins after the model response has been fully received. As a result, the response pause depends on the central model; the new billing path does not currently offer streaming of individual model tokens. If the speaker is interrupted, the model request that has already been started remains tied until billing before the next question is processed.

1. LiveKit project and credentials

In LiveKit Cloud create a project for SIHub. Open its settings and API keys. Copy the Project URL, the API key and the API secret in deploy/.env.production:

LIVEKIT_URL=wss://DEIN_PROJEKT.livekit.cloud
LIVEKIT_API_KEY=DEIN_SERVER_API_KEY
LIVEKIT_API_SECRET=DEIN_SERVER_API_SECRET
AIHUB_VOICE_AGENT_NAME=aihub-voice

The LiveKit URL is not your SIHub website domain. Keys belong exclusively in the operator file; the browser later only receives a restricted room token. The worker build uses Python 3.12. Installation and project linking of the optional lk-CLI follow the official guide or use a verified release binary. umask 077 and lk cloud auth allow project linking without an API secret in shell arguments. LiveKit CLI setup

Select and verify the cloud/SIP region that matches your contract. For inbound EU telephony, LiveKit documents the pattern <Projekt-SIP-Subdomain>.eu.sip.livekit.cloud; you find the actual SIP endpoint in the project settings. A regional media/SIP endpoint does not automatically guarantee the region of STT, LLM and TTS. SIP regions

2. Configure an Austrian SIP provider

Obtain a usable phone number and a SIP trunk from the AT/EU provider you have actually chosen. Request at least 30 simultaneous call channels as a contract/account limit and have the following confirmed: E.164 number format, permitted caller IDs, inbound SIP destination, outbound SIP host, authentication method, supported transport/codec options, IP allowlisting and emergency routing. A purchased trunk alone does not provide 30 AI processing slots.

Configure the provider's inbound forwarding to the LiveKit SIP endpoint, not to sihub.at and not to port 5090. The app server does not need an inbound SIP port for this. Use the authentication documented by the provider. Digest authentication for inbound calls is not available from every carrier; alternatively, allowlisted carrier IP addresses can be used. LiveKit documents that allowed_addresses may first have to be enabled for the project. Do not enter made-up IP ranges or an open 0.0.0.0/0 as a substitute. Inbound trunks and authentication

3. Create inbound and outbound trunks

In LiveKit Cloud, go to Telephony → SIP trunks to create the trunks. In the dashboard's JSON editor, you only paste the inner trunk-content each time; the files with the outer trunk-object are for the CLI. Alternatively, use the lk-CLI. The examples are in deploy/livekit/; copy them into a private directory with mode 0700, set files to 0600 and replace all placeholders in the editor. Passwords are not passed in CLI flags.

umask 077
AIHUB_SIP_DIR="$(mktemp -d)"
cp deploy/livekit/inbound-trunk.example.json "$AIHUB_SIP_DIR/inbound-trunk.json"
cp deploy/livekit/outbound-trunk.example.json "$AIHUB_SIP_DIR/outbound-trunk.json"
cp deploy/livekit/dispatch-rule.example.json "$AIHUB_SIP_DIR/dispatch-rule.json"
chmod 600 "$AIHUB_SIP_DIR/"*.json

Edit the files with your editor. auth_username/auth_password of the inbound example are only used if the provider supports this method; with IP authentication, you adjust the configuration based on the provider's real carrier addresses and the LiveKit activation. The outbound file receives the provider SIP host, its auth data and only your verified caller number.

lk sip inbound create "$AIHUB_SIP_DIR/inbound-trunk.json"
lk sip outbound create "$AIHUB_SIP_DIR/outbound-trunk.json"

Note the returned trunk IDs (ST_...). Creating the outbound trunk does not start a call yet. Create trunks once and reuse them; creating new trunks for each call is not the intended procedure. Outbound trunk reference

For region-specific outbound settings, only use a configuration supported by the current project/API. The global default route and a destination_country-option do not guarantee that all conversation data is hosted in Austria. Region behavior

4. Create SIHub agent and channel

Create a workspace in SIHub, import knowledge, configure agent prompt/language and publish a version. Create an active channel. API contract:

{
  "name": "AT-Hauptnummer",
  "status": "active",
  "data": {
    "type": "sip",
    "voice_engine": "livekit",
    "mode": "live",
    "agent_id": "DEIN_VERÖFFENTLICHTER_AGENT"
  }
}

Sending this body to POST /api/entities/channels returns the channel ID in the field id of the response. Types are sip, phone or webvoice. An operator binding, a published agent and plan eligibility remain required; Free does not include real-time voice. A customer must not be able to use someone else's number by entering arbitrary trunk IDs.

Add to the protected operator environment:

AIHUB_LIVEKIT_CHANNEL_BINDINGS='{"DEINE_CHANNEL_ID":{"workspace_id":"DEINE_WORKSPACE_ID","inbound_trunk_id":"ST_INBOUND","outbound_trunk_id":"ST_OUTBOUND","from_number":"DEINE_VERIFIZIERTE_E164_NUMMER"}}'

Apply the operator configuration with the usual deploy, as described in section 7. Workspaces are automatically in live mode; there is no additional live approval. Changes to the operator environment take effect with the service restart; then check GET /api/voice/status. Passwords and LiveKit API secrets do not belong in the channel entity.

5. Bind the dispatch rule to exactly this channel

Open Telephony → Dispatch rules or edit the private dispatch-rule.json. The dashboard JSON editor expects the inner dispatch_rule-content; the CLI receives the entire example file. Set trunk_ids to your inbound trunk; an omitted trunk filter field would create an unnecessarily broad wildcard dispatch. agentName is exactly aihub-voice. The job metadata is the JSON string {"channel_id":"DEINE_CHANNEL_ID"}.

lk sip dispatch create "$AIHUB_SIP_DIR/dispatch-rule.json"

The rule creates a separate room for each call and starts the named worker. The worker checks the channel, the published agent version, its workspace and the operator binding. Room names/telephony attributes may contain phone numbers at the platform provider; configure log/privacy rules accordingly, without automatically assuming anonymous provider logs. Dispatch schema and metadata

The project must not also have a second overlapping dispatch rule for the same trunk. Check existing rules before activating a new one. SIHub does not record the audio by default; no egress/recording setup is started automatically.

6. STT, LLM and TTS accounts

Deepgram: Create a project and API key in the Deepgram Console. Set DEEPGRAM_API_KEY and an actually enabled DEEPGRAM_MODEL. For the EU streaming path, the template uses DEEPGRAM_BASE_URL=https://api.eu.deepgram.com/v1/listen; the plugin derives the corresponding secure WebSocket connection from it. The provider documents the EU endpoint, including the use of existing keys. EU endpoint

DEEPGRAM_MIP_OPT_OUT=1 requests the model-improvement opt-out in the worker. The regional URL alone says nothing about third-party LLM/TTS or any log/contract retention periods. Deepgram describes further differences between region, storage and MIP; verify the opt-out in your actual account. Deepgram data processing

Central operator AI: Use the same configuration as for text chat: SIHUB_INCLUDED_AI_PROVIDER, optional SIHUB_INCLUDED_AI_MODEL and the operator's matching API access. Example for OpenAI: SIHUB_INCLUDED_AI_PROVIDER=openai, OPENAI_API_KEY and OPENAI_MODEL. Anthropic, Gemini, Groq, xAI, Custom and ModelServer are supported as well. The worker receives no model credentials; it calls the private SIHub backend instead. Historical VOICE_LLM_*-, AIHUB_VOICE_LLM_ROUTE- and DGX voice values do not affect new sessions; existing private keys are preserved during the upgrade. Configure operator AI

Cartesia: In the provider dashboard, create an API key, select an approved voice and copy its voice ID. Set CARTESIA_API_KEY, CARTESIA_VOICE_ID, CARTESIA_MODEL, AIHUB_VOICE_TTS_PROVIDER=cartesia. The worker uses the streaming TTS path. Model ID, voice ID and API version are different values. Cartesia WebSocket TTS

ElevenLabs as alternative TTS: Create a restricted API key and copy a voice ID available in the account. Set ELEVENLABS_API_KEY, ELEVENLABS_VOICE_ID, ELEVENLABS_MODEL, AIHUB_VOICE_TTS_PROVIDER=elevenlabs. The provider documentation describes key restrictions and server-side authentication. Enter the model explicitly, for example the model enabled in your account, such as eleven_flash_v2_5; the current model documentation recommends Flash instead of the older Turbo models. ElevenLabs models Using a voice is not an implemented voice cloning workflow. ElevenLabs keys

Provider concurrency limits must per project and region allow at least your planned peak load; new additional keys do not automatically bypass project limits. Check contract/region options for the providers you actually choose. Deepgram limits

Specific starting values and reloading

The production template uses DEEPGRAM_MODEL=nova-3, CARTESIA_MODEL=sonic-3 and for the TTS alternative ELEVENLABS_MODEL=eleven_flash_v2_5. Check that they are enabled in the respective account and explicitly replace them if needed. The central operator model must be set up. For new sessions, the runtime sets primary=workspace and billing_protocol=workspace-api-v2; customers do not choose a model route.

sudo docker compose --env-file deploy/.env.production -f deploy/compose.yml config --quiet
sudo docker compose --env-file deploy/.env.production -f deploy/compose.yml run --rm --no-deps app python manage.py check-config --voice

check-config only lists missing variable names and checks formats. Exit code 1 means: complete the configuration. A successful check proves neither valid keys nor provider limits; no provider is contacted. With configured dispatch rules, external callers can already trigger real calls; only enable public carrier routing after these checks.

7. Deploy the app and worker together, then test voice

For existing installations, use the normal Deploy action for SIHub in AppHub or Sync with deployment. The shared flow handles configuration and data upgrade, checks the real central AI connection and starts the services. App and worker must be updated together; older workers without workspace-api-v2 do not receive new sessions. The exact procedure is described under Deployment.

For self-managed Docker, build and start the app and voice worker together after the backup:

sudo docker compose --env-file deploy/.env.production -f deploy/compose.yml --profile voice up -d --build --force-recreate app voice-worker-a voice-worker-b
sudo docker compose --env-file deploy/.env.production -f deploy/compose.yml logs --tail 50 voice-worker-a voice-worker-b

Check registration/health in LiveKit and in monitoring. /internal/voice/ remains blocked in the public Apache; Docker workers talk directly to http://app:5090 and authenticate with AIHUB_VOICE_WORKER_TOKEN. Each model request is also bound to the active voice session. Do not publish this key as a workspace API key.

A deliberate outbound test uses POST /api/test-call:

{"agent_id":"AGENT_ID","phone":"DEINE_EINWILLIGENDE_TESTNUMMER","consent":true,"mode":"live"}

An actual E.164 destination number and confirmed consent are required. Keep the agent's assignment to a matching active phone channel unambiguous. The output contains the conversation reference; also check the LiveKit SIP session. Dispatch plus SIP participant connects the callee to the room. Outbound call flow

Create a dedicated channel for browser audio that is active and has data.type=webvoice, data.voice_engine=livekit, data.mode=live and a published agent_id. Add its own operator binding {"WEBVOICE_CHANNEL_ID":{"workspace_id":"DEINE_WORKSPACE_ID"}} in the same AIHUB_LIVEKIT_CHANNEL_BINDINGS-JSON; existing telephony entries remain in it. No SIP trunk is required for this channel.

For browser audio an authenticated account with chat permissions receives, via POST /api/voice/web-session and {"channel_id":"WEBVOICE_CHANNEL_ID"} one url, token and room_name. Use the prepared audio access/SDK with microphone permission and HTTPS. A token JSON alone is not a browser audio test.

First Inbound test: Call your own AT number from an authorized test number. Check language, greeting, interruptions, published knowledge answers, history, token usage and call ending. Then repeat the acceptance stages, including worker/provider errors and allowance limits. All these calls are real conversations with actual provider usage.

8. Troubleshoot common errors

Observation Next step
Website 502 sudo docker compose --env-file deploy/.env.production -f deploy/compose.yml ps, check app health and port 5090; check the Apache error log.
Access 409 Check the active workspace, plan entitlement and channel-specific operator connection.
Allowance error 402 Check the available workspace/agent allowance; the model request is not triggered when the allowance is exhausted.
Worker needs to be updated Run the usual deploy so that the app and voice worker get the workspace-api-v2 to update the request.
Worker does not receive a job agentName, channel metadata, dispatch rule and trunk ID must match; do not activate an overlapping rule.
SIP 403 Check provider/LiveKit trunk authentication and carrier IP allowlisting.
Call rings but remains silent SIP participant sip.callStatus=active, check worker job, STT/TTS/LLM configuration and codec/transport path.
Provider 401/403/429 Check key permissions, credit, project/region limit and the available model ID in the provider portal.
Browser without microphone Check HTTPS, browser permission and a valid new webvoice room token.
Change in .env.production has no effect Recreate affected containers; restart alone does not apply changed environment values.

Keys, complete environment files and conversation content do not belong in diagnostic tickets. For provider sessions, use the respective pseudonymous call/room/request IDs and the official LiveKit testing procedure.