# Gateway
GATEWAY_PORT=8080
CC_DATA_DIR=.data

# Shared DB URL for services (sqlite by default; switch to postgres as needed)
DATABASE_URL=sqlite:///./.data/mvp_cc.db
SCHEMA_MANAGEMENT_MODE=legacy
# DATABASE_URL=postgresql://mvp:mvp@localhost:5432/mvpcc
# SCHEMA_MANAGEMENT_MODE=migrations

AUTH_SERVICE_URL=http://localhost:8001
AUDIT_SERVICE_URL=http://localhost:8002
CUSTOMER_SERVICE_URL=http://localhost:8003
INTERACTION_SERVICE_URL=http://localhost:8004
ROUTING_SERVICE_URL=http://localhost:8005
VOICE_ADAPTER_SERVICE_URL=http://localhost:8006
TELEGRAM_ADAPTER_SERVICE_URL=http://localhost:8007
KB_SERVICE_URL=http://localhost:8008
REPORTING_SERVICE_URL=http://localhost:8009
SUPERVISOR_SERVICE_URL=http://localhost:8010
SALES_SERVICE_URL=http://localhost:8020
TELEGRAM_BOT_ENABLED=0
TELEGRAM_BOT_TOKEN=
TELEGRAM_WEBHOOK_SECRET=
TELEGRAM_DEFAULT_QUEUE_ID=q_telegram
TELEGRAM_BOT_API_BASE=https://api.telegram.org
WHATSAPP_DEFAULT_QUEUE_ID=q_whatsapp
WHATSAPP_WEBHOOK_SECRET=
WHATSAPP_META_ACCESS_TOKEN=
WHATSAPP_META_PHONE_NUMBER_ID=
WHATSAPP_META_VERIFY_TOKEN=
WHATSAPP_META_APP_SECRET=
WHATSAPP_META_GRAPH_API_VERSION=v22.0
WHATSAPP_OUTBOUND_ENABLED=0
AI_PROVIDER=stub
AI_API_BASE=
AI_API_KEY=
AI_MODEL=stub-telegram-assistant
AI_TIMEOUT_SECONDS=20
AI_CUSTOMER_PERSONA_MODE=operator_humanlike
AI_DISCLOSURE_MODE=hidden
AI_TELEGRAM_ENABLED=0
AI_TELEGRAM_ALWAYS_REPLY=0
AI_TELEGRAM_MAX_CONTEXT_MESSAGES=12
AI_TELEGRAM_MAX_KB_RESULTS=3
AI_TELEGRAM_CONFIDENCE_HANDOFF_THRESHOLD=0.65
AI_WHATSAPP_ENABLED=0
AI_WHATSAPP_ALWAYS_REPLY=0
AI_WHATSAPP_MAX_CONTEXT_MESSAGES=12
AI_WHATSAPP_MAX_KB_RESULTS=3
AI_WHATSAPP_CONFIDENCE_HANDOFF_THRESHOLD=0.65
AI_VOICE_RUNTIME_SERVICE_URL=http://localhost:8018
SALES_TELEGRAM_BRIDGE_ENABLED=1
SALES_VOICE_RUNTIME_ENABLED=1
AI_VOICE_ENABLED=0
AI_VOICE_POLICY_MODE=v2_fast_conversational
AI_VOICE_QUEUE_CONFIG_JSON={}
AI_VOICE_ASR_PROVIDER=elevenlabs
AI_VOICE_TTS_PROVIDER=elevenlabs
AI_VOICE_V2_ENABLED=1
AI_VOICE_V2_QUEUE_CODES=voice_lab_ai
AI_VOICE_V2_ACK_MODE=immediate_short
AI_VOICE_V2_DUPLEX_ENABLED=1
AI_VOICE_V2_STREAMING_ASR_BACKEND=elevenlabs_realtime
AI_VOICE_V2_STREAMING_ASR_BASE_URL=http://127.0.0.1:8021
AI_VOICE_V2_STREAMING_ASR_TIMEOUT_SECONDS=4
AI_VOICE_V2_STREAMING_ASR_MODEL=base
AI_VOICE_V2_STREAMING_ASR_COMPUTE_TYPE=int8
AI_VOICE_V2_STREAMING_ASR_DEVICE=cpu
AI_VOICE_V2_STREAMING_ASR_CACHE_DIR=.models/faster_whisper
AI_VOICE_V2_STREAMING_ASR_SUPPORTED_LANGUAGES=ru
AI_VOICE_V2_PREBAKED_ACK_ENABLED=1
AI_VOICE_V2_PREBAKED_ACK_DIR=.data/voice_v2_ack_bank
AI_VOICE_V2_STREAMING_TTS=1
AI_VOICE_V2_PARTIAL_ASR=1
AI_VOICE_V2_EMOTIVE_ACK_ENABLED=1
AI_VOICE_V2_EMOTIVE_ACK_RU_ONLY=1
AI_VOICE_AUDIOSOCKET_ENABLED=0
AI_VOICE_AUDIOSOCKET_HOST=0.0.0.0
AI_VOICE_AUDIOSOCKET_PORT=9019
AI_VOICE_ASR_MODEL=gpt-4o-mini-transcribe
AI_VOICE_ASR_ELEVENLABS_API_BASE=https://api.elevenlabs.io
AI_VOICE_ASR_ELEVENLABS_API_KEY=
AI_VOICE_ASR_ELEVENLABS_MODEL_ID=scribe_v1
AI_VOICE_ASR_ELEVENLABS_LANGUAGE=ru
AI_VOICE_ASR_ELEVENLABS_SAMPLE_RATE_HZ=16000
AI_VOICE_ASR_ELEVENLABS_REALTIME_MODEL_ID=scribe_v2_realtime
AI_VOICE_ASR_ELEVENLABS_REALTIME_AUDIO_FORMAT=pcm_16000
AI_VOICE_ASR_ELEVENLABS_REALTIME_COMMIT_STRATEGY=manual
AI_VOICE_ASR_ELEVENLABS_REALTIME_FINALIZE_TIMEOUT_SECONDS=2.5
AI_VOICE_ASR_YANDEX_API_BASE=https://stt.api.cloud.yandex.net
AI_VOICE_ASR_YANDEX_OPERATIONS_BASE=https://operation.api.cloud.yandex.net
AI_VOICE_ASR_YANDEX_API_VERSION=auto
AI_VOICE_ASR_YANDEX_GRPC_TARGET=stt.api.cloud.yandex.net:443
AI_VOICE_ASR_YANDEX_API_KEY=
AI_VOICE_ASR_YANDEX_IAM_TOKEN=
AI_VOICE_ASR_YANDEX_FOLDER_ID=
AI_VOICE_ASR_YANDEX_LANGUAGE=ru-RU
AI_VOICE_ASR_YANDEX_TOPIC=general
AI_VOICE_ASR_YANDEX_SAMPLE_RATE_HZ=8000
AI_VOICE_ASR_YANDEX_TIMEOUT_SECONDS=8
AI_VOICE_ASR_YANDEX_POLL_INTERVAL_SECONDS=0.25
AI_VOICE_ASR_YANDEX_EOU_MAX_PAUSE_MS=450
AI_VOICE_ASR_YANDEX_STREAM_QUEUE_MAX_CHUNKS=300
AI_VOICE_TTS_MODEL=gpt-4o-mini-tts
AI_VOICE_TTS_VOICE=alloy
AI_VOICE_TTS_YANDEX_API_BASE=https://tts.api.ml.yandexcloud.kz
AI_VOICE_TTS_YANDEX_API_KEY=
AI_VOICE_TTS_YANDEX_IAM_TOKEN=
AI_VOICE_TTS_YANDEX_FOLDER_ID=
AI_VOICE_TTS_YANDEX_VOICE=jane
AI_VOICE_TTS_YANDEX_KK_VOICE=amira
AI_VOICE_TTS_YANDEX_SPEED=1.0
AI_VOICE_TTS_YANDEX_ROLE=
AI_VOICE_TTS_YANDEX_EMOTION=
AI_VOICE_TTS_YANDEX_SAMPLE_RATE_HZ=8000
AI_VOICE_TTS_ELEVENLABS_API_BASE=https://api.elevenlabs.io
AI_VOICE_TTS_ELEVENLABS_API_KEY=
AI_VOICE_TTS_ELEVENLABS_MODEL_ID=eleven_v3
AI_VOICE_TTS_ELEVENLABS_OUTPUT_FORMAT=pcm_16000
AI_VOICE_TTS_ELEVENLABS_RU_VOICE_ID=nPczCjzI2devNBz1zQrb
AI_VOICE_TTS_ELEVENLABS_RU_LANGUAGE_CODE=ru
AI_VOICE_TTS_ELEVENLABS_KK_VOICE_ID=nPczCjzI2devNBz1zQrb
AI_VOICE_TTS_ELEVENLABS_KK_LANGUAGE_CODE=kk
AI_VOICE_TTS_CACHE_ENABLED=1
AI_VOICE_TTS_CACHE_DIR=.data/ai_voice_tts_cache
AI_VOICE_VAD_MIN_SPEECH_MS=300
AI_VOICE_VAD_TRAILING_SILENCE_MS=400
AI_VOICE_VAD_RMS_THRESHOLD=250
AI_VOICE_TURN_MAX_MS=10000
AI_VOICE_MEDIA_IDLE_TIMEOUT_SECONDS=15
AI_VOICE_MAX_CONTEXT_SEGMENTS=12
AI_VOICE_HANDOFF_TIMEOUT_SECONDS=8
AI_VOICE_RUNTIME_TRUSTED_SERVICE_SUBJECTS=svc:ai-voice-runtime

# Gateway error alerts (Telegram)
ERROR_TELEGRAM_ALERTS=0
ERROR_TELEGRAM_ALERT_BOT_TOKEN=<telegram-bot-token>
ERROR_TELEGRAM_ALERT_CHANNEL_ID=<telegram-channel-id-or-username>
# Alternative: ERROR_TELEGRAM_ALERT_CHAT_IDS=<id1>,<id2>
ERROR_TELEGRAM_ALERT_MIN_STATUS=500
ERROR_TELEGRAM_ALERT_COOLDOWN_SECONDS=60
ERROR_TELEGRAM_ALERT_IGNORE_PATHS=/health

# Event bus (Track 8)
EVENT_BUS_ENABLED=0
EVENT_BUS_URL=amqp://guest:guest@localhost:5672/
EVENT_BUS_EXCHANGE=mvpcc.domain.events
EVENT_BUS_CONSUMER_ENABLED=1
EVENT_BUS_AUDIT_QUEUE=mvpcc.audit.events
EVENT_BUS_REPORTING_QUEUE=mvpcc.reporting.events

# Asterisk bridge (Track 9)
ASTERISK_BRIDGE_ENABLED=0
ASTERISK_AMI_HOST=
ASTERISK_AMI_PORT=5038
ASTERISK_AMI_USERNAME=
ASTERISK_AMI_SECRET=
ASTERISK_AMI_EVENT_PREFIX=MVPCC
ASTERISK_QUEUE_MAP_JSON={}
ASTERISK_BRIDGE_POLL_INTERVAL_SECONDS=1
ASTERISK_IVR_FASTAGI_ENABLED=0
ASTERISK_IVR_FASTAGI_HOST=127.0.0.1
ASTERISK_IVR_FASTAGI_PORT=4573
ASTERISK_IVR_DTMF_TIMEOUT_SECONDS=5
ASTERISK_IVR_MAX_NO_INPUT_RETRIES=2
ASTERISK_IVR_MAX_INVALID_RETRIES=2
ASTERISK_IVR_CALL_LINK_WAIT_SECONDS=5
# bridge internal auth mode:
# - legacy_headers (default QA baseline)
# - bearer
# - bearer_first (try bearer, fallback to legacy on 401/403)
ASTERISK_BRIDGE_AUTH_MODE=legacy_headers
ASTERISK_BRIDGE_AUTH_FALLBACK_LEGACY=1
ASTERISK_BRIDGE_AUTH_SUBJECT=svc:asterisk-bridge
ASTERISK_BRIDGE_AUTH_USER=asterisk-bridge
ASTERISK_BRIDGE_AUTH_ROLE=admin
ASTERISK_BRIDGE_AUTH_TOKEN_TTL_SECONDS=300
ASTERISK_CALLCONTROL_ENABLED=0
ASTERISK_CALLCONTROL_ACTION_TIMEOUT_SECONDS=10
ASTERISK_WEBRTC_ENABLED=0
ASTERISK_WEBRTC_WS_URL=
ASTERISK_WEBRTC_ICE_SERVERS_JSON=[]
ASTERISK_OPERATOR_EXTENSION_MAP_JSON={}
ASTERISK_BROWSER_SIP_MAP_JSON={}
ASTERISK_TRANSFER_TARGET_MAP_JSON={}
ASTERISK_SFTP_HOST=
ASTERISK_SFTP_PORT=22
ASTERISK_SFTP_USERNAME=
ASTERISK_SFTP_PASSWORD=
ASTERISK_SFTP_BASE_PATH=/var/spool/asterisk/monitor

# Track 9.1 service-token hardening
IVR_RUNTIME_TRUSTED_SERVICE_SUBJECTS=svc:asterisk-bridge
VOICE_ADAPTER_TRUSTED_SERVICE_SUBJECTS=svc:asterisk-bridge,svc:ivr-service
RECORDING_IMPORT_TRUSTED_SERVICE_SUBJECTS=svc:asterisk-bridge
RECORDING_IMPORT_ALLOW_ADMIN=1
