Skip to main content

Configuration File

Edit docker/assistant-api/.assistant.env before starting the service. For local development (without Docker), export the variables and override the Docker hostnames shown in the table below.

Required Variables

VariableDefaultDescription
SECRETrpd_pksJWT signing secret — must be identical across all services
POSTGRES__HOSTpostgresPostgreSQL host
POSTGRES__DB_NAMEassistant_dbDatabase name
POSTGRES__AUTH__USERrapida_userDatabase user
POSTGRES__AUTH__PASSWORDrapida_db_passwordDatabase password
REDIS__HOSTredisRedis host
OPENSEARCH__HOSTopensearchOpenSearch host
INTEGRATION_HOSTintegration-api:9004integration-api gRPC address
ENDPOINT_HOSTendpoint-api:9005endpoint-api gRPC address
WEB_HOSTweb-api:9001web-api gRPC address
DOCUMENT_HOSThttp://document-api:9010document-api HTTP address
PUBLIC_ASSISTANT_HOSTPublicly reachable hostname for telephony callbacks and WebSocket media
PUBLIC_ASSISTANT_HOST must resolve from the public internet. Twilio, Vonage, and Exotel connect WebSocket media streams to wss://PUBLIC_ASSISTANT_HOST/v1/talk/{provider}/ctx/{contextId}. For local testing, use an ngrok tunnel and set this to your ngrok hostname (e.g. abc123.ngrok.io).

Service Identity

VariableDefaultDescription
SERVICE_NAMEworkflow-apiInternal service name label
HOST0.0.0.0Bind address
PORT9007HTTP / gRPC / WebSocket port (cmux)
LOG_LEVELdebugdebug · info · warn · error
ENVdevelopmentdevelopment · staging · production

PostgreSQL

VariableDefaultDescription
POSTGRES__HOSTpostgresHost (localhost for local dev)
POSTGRES__PORT5432Port
POSTGRES__DB_NAMEassistant_dbDatabase name
POSTGRES__AUTH__USERrapida_userUser
POSTGRES__AUTH__PASSWORDrapida_db_passwordPassword
POSTGRES__MAX_OPEN_CONNECTION50Connection pool size
POSTGRES__MAX_IDEAL_CONNECTION25Idle connections
POSTGRES__SSL_MODEdisabledisable · require · verify-full
POSTGRES__SLC_CACHE__HOSTredisRedis host for second-level GORM cache
POSTGRES__SLC_CACHE__PORT6379Redis port for GORM cache
POSTGRES__SLC_CACHE__DB1Redis DB index for GORM cache
POSTGRES__SLC_CACHE__MAX_CONNECTION10Redis pool size

Redis

VariableDefaultDescription
REDIS__HOSTredisRedis host (localhost for local dev)
REDIS__PORT6379Redis port
REDIS__MAX_CONNECTION10Connection pool size
REDIS__MAX_DB0Redis DB index

OpenSearch

VariableDefaultDescription
OPENSEARCH__SCHEMAhttphttp · https
OPENSEARCH__HOSTopensearchOpenSearch host (localhost for local dev)
OPENSEARCH__PORT9200OpenSearch port
OPENSEARCH__MAX_RETRIES3Request retry count
OPENSEARCH__MAX_CONNECTION10Connection pool size

Asset Storage

VariableDefaultDescription
ASSET_STORE__STORAGE_TYPElocallocal · s3 · azure
ASSET_STORE__STORAGE_PATH_PREFIX/app/rapida-data/assets/workflowPath for local storage
ASSET_STORE__PUBLIC_URL_PREFIXhttp://localhost:8080/rapida-data/assets/workflowPublic URL for serving stored assets

Asterisk AudioSocket

The AudioSocket server binds on a separate TCP port. Asterisk dials into this port directly.
VariableDefaultDescription
AUDIOSOCKET__HOST0.0.0.0Bind address for the AudioSocket TCP server
AUDIOSOCKET__PORT4573TCP port for AudioSocket connections
Asterisk dialplan usage:
same = n,AudioSocket(${RAPIDA_CONTEXT_ID},assistant-api-host:4573)

SIP Server

The built-in SIP server handles direct SIP INVITE connections and Asterisk SIP trunk connections.
VariableDefaultDescription
SIP__SERVER0.0.0.0Bind address for SIP
SIP__EXTERNAL_IP0.0.0.0Public IP advertised in SDP and SIP Contact headers — must be your server’s public IP
SIP__PORT5090SIP signalling port (UDP)
SIP__TRANSPORTudpudp · tcp
SIP__RTP_PORT_RANGE_START10000RTP media port range start
SIP__RTP_PORT_RANGE_END20000RTP media port range end
Set SIP__EXTERNAL_IP to your server’s public IP address. If this is set to 0.0.0.0, SDP answers will advertise the wrong address and media will not flow for callers outside the local network.
SIP connection string:
sip:{assistantID}:{apiKey}@{SIP__EXTERNAL_IP}:{SIP__PORT}

Full Environment File

# ── Service identity ──────────────────────────────────────────────
SERVICE_NAME=workflow-api
HOST=0.0.0.0
PORT=9007
LOG_LEVEL=debug
SECRET=rpd_pks
ENV=development

# ── Asset storage ─────────────────────────────────────────────────
ASSET_STORE__STORAGE_TYPE=local
ASSET_STORE__STORAGE_PATH_PREFIX=/app/rapida-data/assets/workflow
ASSET_STORE__PUBLIC_URL_PREFIX=http://localhost:8080/rapida-data/assets/workflow

# ── PostgreSQL ────────────────────────────────────────────────────
POSTGRES__HOST=postgres
POSTGRES__DB_NAME=assistant_db
POSTGRES__AUTH__USER=rapida_user
POSTGRES__AUTH__PASSWORD=rapida_db_password
POSTGRES__PORT=5432
POSTGRES__MAX_OPEN_CONNECTION=50
POSTGRES__MAX_IDEAL_CONNECTION=25
POSTGRES__SSL_MODE=disable
POSTGRES__SLC_CACHE__HOST=redis
POSTGRES__SLC_CACHE__PORT=6379
POSTGRES__SLC_CACHE__MAX_CONNECTION=10
POSTGRES__SLC_CACHE__DB=1

# ── Redis ─────────────────────────────────────────────────────────
REDIS__HOST=redis
REDIS__PORT=6379
REDIS__MAX_CONNECTION=10
REDIS__MAX_DB=0

# ── OpenSearch ────────────────────────────────────────────────────
OPENSEARCH__SCHEMA=http
OPENSEARCH__HOST=opensearch
OPENSEARCH__PORT=9200
OPENSEARCH__MAX_RETRIES=3
OPENSEARCH__MAX_CONNECTION=10

# ── Internal service addresses ────────────────────────────────────
INTEGRATION_HOST=integration-api:9004
ENDPOINT_HOST=endpoint-api:9005
ASSISTANT_HOST=assistant-api:9007
WEB_HOST=web-api:9001
DOCUMENT_HOST=http://document-api:9010
UI_HOST=https://localhost:3000

# ── Public hostname (required for telephony) ──────────────────────
PUBLIC_ASSISTANT_HOST=your-public-hostname.example.com

# ── Asterisk AudioSocket ──────────────────────────────────────────
AUDIOSOCKET__HOST=0.0.0.0
AUDIOSOCKET__PORT=4573

# ── SIP Server ────────────────────────────────────────────────────
SIP__SERVER=0.0.0.0
SIP__EXTERNAL_IP=0.0.0.0
SIP__PORT=5090
SIP__TRANSPORT=udp
SIP__RTP_PORT_RANGE_START=10000
SIP__RTP_PORT_RANGE_END=20000

Local Development Overrides

When running from source, override Docker hostnames:
export $(grep -v '^#' docker/assistant-api/.assistant.env | xargs)
export POSTGRES__HOST=localhost
export REDIS__HOST=localhost
export OPENSEARCH__HOST=localhost
export INTEGRATION_HOST=localhost:9004
export ENDPOINT_HOST=localhost:9005
export WEB_HOST=localhost:9001
export DOCUMENT_HOST=http://localhost:9010

go run cmd/assistant/assistant.go

Next Steps