config.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. from pydantic_settings import BaseSettings, SettingsConfigDict
  2. class Settings(BaseSettings):
  3. threecx_base_url: str = "https://192.168.1.118"
  4. threecx_client_id: str = "3cxtelefone"
  5. threecx_api_key: str = "/opt/3cx/3cx.key"
  6. threecx_queue_dn: str = "84"
  7. threecx_monitored_extensions: str = "10,11,13,42"
  8. threecx_verify_tls: bool = False
  9. # Dedicated 3CX RoutePoint / AI Media configuration
  10. threecx_media_client_id: str = "90"
  11. threecx_media_api_key: str = "/opt/3cx-middleware/3cx-telefonie-middleware/90-api.key"
  12. threecx_media_routepoint_dn: str = "90"
  13. # Whisper
  14. whisper_model: str = "small"
  15. whisper_device: str = "cpu"
  16. whisper_compute_type: str = "int8"
  17. whisper_language: str = "de"
  18. # Media
  19. media_sample_rate: int = 8000
  20. media_channels: int = 1
  21. media_sample_width: int = 2
  22. media_output_sample_rate: int = 16000
  23. media_recording_enabled: bool = True
  24. media_recording_dir: str = "./recordings"
  25. app_host: str = "127.0.0.1"
  26. app_port: int = 8095
  27. database_path: str = "./data/telephony.sqlite3"
  28. log_level: str = "INFO"
  29. middleware_api_token: str = ""
  30. # Kontor MCP
  31. kontor_mcp_url: str = "http://sgpdev:8090/mcp"
  32. kontor_mcp_token: str = ""
  33. kontor_mcp_timeout: float = 10.0
  34. phone_default_region: str = "DE"
  35. cors_origins: str = "http://localhost:1841"
  36. rabbitmq_enabled: bool = False
  37. rabbitmq_url: str = "amqp://guest:guest@127.0.0.1:5672/"
  38. rabbitmq_exchange: str = "telephony"
  39. model_config = SettingsConfigDict(
  40. env_file=".env",
  41. env_file_encoding="utf-8",
  42. extra="ignore",
  43. )
  44. threecx_outbound_device_hints: dict[str, str] = {}
  45. @property
  46. def outbound_device_hints(self) -> dict[str, str]:
  47. return self.threecx_outbound_device_hints
  48. @property
  49. def monitored_dns(self) -> list[str]:
  50. values = [self.threecx_queue_dn]
  51. values.extend(x.strip() for x in self.threecx_monitored_extensions.split(",") if x.strip())
  52. return list(dict.fromkeys(values))