// Admin-editable telephony config. Holds Ozonetel cloud-call-center settings, // the Ozonetel SIP gateway info, and the Exotel REST API credentials. // // All of these used to live in env vars (OZONETEL_*, SIP_*, EXOTEL_*). // On first boot, TelephonyConfigService seeds this file from those env vars // so existing deployments keep working without manual migration. After that, // admins edit via the staff portal "Telephony" settings page and the env vars // are no longer read. // // SECRETS — note: EXOTEL_WEBHOOK_SECRET stays in env (true secret used for // inbound webhook HMAC verification). EXOTEL_API_TOKEN is stored here because // the admin must be able to rotate it from the UI. The GET endpoint masks it. export type TelephonyConfig = { ozonetel: { // Default test agent — used by maintenance and provisioning flows. agentId: string; agentPassword: string; // Default DID (the hospital's published number). did: string; // Default SIP extension that maps to a softphone session. sipId: string; // Default outbound campaign name on Ozonetel CloudAgent. campaignName: string; // Ozonetel portal admin credentials — used by supervisor barge/whisper/listen. // These are the login credentials for the Ozonetel admin dashboard // (api.cloudagent.ozonetel.com/auth/login), NOT an agent ID. adminUsername: string; adminPassword: string; }; // Ozonetel WebRTC gateway used by the staff portal softphone. sip: { domain: string; wsPort: string; }; // Exotel REST API credentials for inbound number management + SMS. exotel: { apiKey: string; apiToken: string; accountSid: string; subdomain: string; }; version?: number; updatedAt?: string; }; export const DEFAULT_TELEPHONY_CONFIG: TelephonyConfig = { ozonetel: { agentId: '', agentPassword: '', did: '', sipId: '', campaignName: '', adminUsername: '', adminPassword: '', }, sip: { domain: 'blr-pub-rtc4.ozonetel.com', wsPort: '444', }, exotel: { apiKey: '', apiToken: '', accountSid: '', subdomain: 'api.exotel.com', }, }; // Field-by-field mapping from legacy env var names to config paths. Used by // the first-boot seeder. Keep in sync with the migration target sites. export const TELEPHONY_ENV_SEEDS: Array<{ env: string; path: string[] }> = [ // OZONETEL_AGENT_ID removed — agentId is per-user on the Agent entity, // not a sidecar-level config. All endpoints require agentId from caller. { env: 'OZONETEL_AGENT_PASSWORD', path: ['ozonetel', 'agentPassword'] }, { env: 'OZONETEL_ADMIN_USERNAME', path: ['ozonetel', 'adminUsername'] }, { env: 'OZONETEL_ADMIN_PASSWORD', path: ['ozonetel', 'adminPassword'] }, { env: 'OZONETEL_DID', path: ['ozonetel', 'did'] }, { env: 'OZONETEL_SIP_ID', path: ['ozonetel', 'sipId'] }, { env: 'OZONETEL_CAMPAIGN_NAME', path: ['ozonetel', 'campaignName'] }, { env: 'SIP_DOMAIN', path: ['sip', 'domain'] }, { env: 'SIP_WS_PORT', path: ['sip', 'wsPort'] }, { env: 'EXOTEL_API_KEY', path: ['exotel', 'apiKey'] }, { env: 'EXOTEL_API_TOKEN', path: ['exotel', 'apiToken'] }, { env: 'EXOTEL_ACCOUNT_SID', path: ['exotel', 'accountSid'] }, { env: 'EXOTEL_SUBDOMAIN', path: ['exotel', 'subdomain'] }, ];