# ─────────────────────────────────────────────────────────────────
#  GHL ↔ 3CX Bridge — Environment Variables
#  1. Copy this file:  cp .env.example .env
#  2. Fill in every value below
#  3. Never commit .env to version control
# ─────────────────────────────────────────────────────────────────

# ── GoHighLevel ──────────────────────────────────────────────────
# API key: GHL → Settings → Integrations → API Keys
GHL_API_KEY=pit-569df919-5dc2-4806-abe5-92bba168ae73

# Location ID: from the GHL URL → /location/LOCATION_ID_HERE/
GHL_LOCATION_ID=XJgVkZ34rUGSjuzhFHaf

# The number customers call — stays in GHL as brand number
GHL_SUPPORT_NUMBER=+16479529441

# Workflow IDs (optional — GHL → Automation → Workflows → open workflow → check URL)
GHL_WORKFLOW_MISSED_CALL=
GHL_WORKFLOW_ANSWERED=

# ── Telnyx ───────────────────────────────────────────────────────
# API key: Telnyx portal → API Keys
TELNYX_API_KEY=KEY0123456_your_telnyx_key_here

# TeXML App ID: Telnyx portal → Voice → TeXML Apps → your app → App ID
TELNYX_APP_ID=your_telnyx_app_id_here

# The DID you bought in Telnyx — GHL forwards calls here
TELNYX_DID=+1YYYYYYYYYY

# Webhook signing secret: Telnyx portal → Voice → TeXML Apps → your app → Webhook signing
TELNYX_WEBHOOK_SECRET=your_telnyx_webhook_signing_secret

# ── Twilio (alternative carrier — use Telnyx OR Twilio) ─────────
# Twilio Console → Account Info → Account SID + Auth Token
TWILIO_ACCOUNT_SID=ACb16f0e91c043c657bdb02ed6d2deed1b
TWILIO_AUTH_TOKEN=bb0cead1790b106bf0a40a81464c88ee

# The Twilio number GHL forwards calls to
TWILIO_PHONE_NUMBER=+16473654751

# Optional — TwiML App SID if you use a TwiML App instead of per-number webhook
TWILIO_APP_SID=

# Set "record-from-answer" to record CSR legs, "do-not-record" to disable
TWILIO_RECORD=record-from-answer

# Optional greeting played before bridging to 3CX (leave blank to skip)
TWILIO_GREETING=Thank you for calling support. Please hold while we connect you to the next available representative.

# Caller ID presented to 3CX when bridging (leave blank to pass original caller)
TWILIO_CALLER_ID=

# Active carrier: 'telnyx' or 'twilio' — drives docs and verify_connections.php checks
BRIDGE_CARRIER=twilio

# Calls that "complete" under this many seconds are treated as queue-hangups
# (customer abandoned the queue before any CSR picked up). Tune to your queue
# welcome message length + a few seconds. Default: 15.
QUEUE_HANGUP_THRESHOLD_SECONDS=15

# ── 3CX ──────────────────────────────────────────────────────────
# SIP URI of the support queue — format: sip:EXTENSION@YOUR_3CX_FQDN
3CX_QUEUE_SIP_URI=sip:16460@1706.3cx.cloud

# Queue extension number
3CX_QUEUE_EXT=16460

# 3CX management portal FQDN (no https://)
3CX_HOST=1706.3cx.cloud

# 3CX management portal HTTPS port (usually 5001)
3CX_PORT=5061

# 3CX admin credentials
3CX_USER=
3CX_PASS=

# Shared secret — set this in 3CX Webhooks config as X-3CX-Secret header value
3CX_WEBHOOK_SECRET=R7q9Lk2vFp8Nm3Wb5Yt1Hc6Jd4Xs0Au8En2Iv7Kq9Mb3Qz=

# SIP Trunk credentials (Authentication ID + password from the 3CX SIP Trunk)
# Twilio uses these to auth when dialling into the queue.
3CX_SIP_USERNAME=FarhanTest1
3CX_SIP_PASSWORD=Farhan$123

# ── Bridge server ─────────────────────────────────────────────────
# Public HTTPS base URL of YOUR server (no trailing slash)
WEBHOOK_BASE_URL=https://inviting-verified-flamingo.ngrok-free.app
