py-phone-caller pre-release 2026¶
Date: 2026-08-17
Target milestone: 1.0.0
Status: pre-release hardening and production-readiness review
Purpose¶
This document summarizes the recent hardening work performed on py-phone-caller, the current release posture, and the main recommendations before declaring the project production-ready for 1.0.0.
The main goal of the recent work was to move the project from a lab/development stack toward a consistent, reproducible, air-gapped-friendly, deployment-ready system.
Executive summary¶
py-phone-caller is now in a much stronger pre-release state:
- The project is aligned around the
uvworkspace model. - Docker images no longer depend on legacy
requirements.*files. - Runtime configuration is no longer baked into images.
- Dynaconf-compatible environment files can be generated from TOML configuration and secrets.
- Database initialization is centralized through
caller_registerand now handles legacy schema drift more safely. - The Web UI has been improved visually and hardened around login and admin bootstrap behavior.
- Rust SMS support and Kokoro audio generation have been validated locally.
- Monitoring integrations for Nagios and Zabbix have been modernized and live-tested against the running API.
- Deployment tooling has fewer hardcoded values and is more suitable for lab, air-gapped, and controlled LAN environments.
The main remaining production gap is API authentication. The Web UI has password protection, but most internal API endpoints are currently unauthenticated and must remain private until an authentication layer is added.
Current architecture overview¶
The application is composed of multiple focused services:
| Component | Role |
|---|---|
asterisk_caller |
Receives requests to place calls or queue calls. |
asterisk_ws_monitor |
Watches Asterisk events and coordinates audio playback/call flow. |
generate_audio |
Generates audio files from text using Kokoro/Piper/MMS TTS. |
caller_register |
Initializes and repairs the database schema and registers calls. |
caller_prometheus_webhook |
Alertmanager-compatible webhook receiver for voice and SMS alerts. |
asterisk_recaller |
Selects calls to retry or backup calls to execute. |
caller_sms |
Sends SMS messages and can use Twilio or the Rust on-premise SMS engine. |
caller_scheduler |
Handles scheduled calls. |
caller_address_book |
Manages address book/on-call contact data. |
py_phone_caller_ui |
Provides the Web UI. |
celery_worker |
Runs asynchronous task workers. |
py_phone_caller_utils |
Shared library for DB access, config, tasks, voice helpers, and Rust SMS integration. |
External dependencies include:
- PostgreSQL
- Redis
- Asterisk / ARI / AMI
- Kokoro TTS model/runtime
ffmpegor compatible audio tooling- optional SMS modem/runtime resources
- optional monitoring systems such as Nagios and Zabbix
Recent major changes¶
1. uv workspace alignment¶
The project has been moved toward a consistent uv-managed workflow.
Key outcomes:
- The root workspace is the main dependency source of truth.
- Service Dockerfiles were updated to install packages through
uv sync --frozen --no-dev --package .... - Container builds now use the repository root as build context where needed.
- Legacy dependency flows based on service-local
requirements.txtfiles were removed from the deployment path. uv.lockis now central to reproducible dependency resolution.- Python
3.14alignment was applied to the service build flow.
Why this matters:
- Reproducible builds are easier.
- Dependency drift between local development and containers is reduced.
- Workspace packages such as
py_phone_caller_utilsare installed consistently instead of copied ad hoc.
2. Container build cleanup¶
The service Dockerfiles under src/ were modernized.
Important changes:
- Images install only the target service package and required workspace dependencies.
- Runtime config is no longer copied into images.
PICCOLO_CONFis set for services using Piccolo..dockerignorewas expanded to avoid baking local secrets, caches, generated audio, and temporary artifacts into images.- A representative image build was validated successfully.
The intended pattern is now:
rather than:
3. Cloud-native configuration model¶
The project now supports a more cloud-native configuration approach.
Instead of copying src/config into containers, configuration can be converted into Dynaconf-compatible environment files.
Added utility:
Purpose:
- Convert
settings.tomland.secrets.tomlvalues into environment variables. - Generate variables using Dynaconf-style names such as
DYNACONF_SECTION__KEY. - Keep secrets outside images.
- Allow Docker Compose, Ansible, systemd, and other deployment systems to inject runtime config through env files.
Deployment outputs such as generated env files are ignored by Git.
This is a strong improvement for:
- air-gapped deployments
- cloud-native/container deployments
- secret hygiene
- reproducible images
- separating build-time and runtime concerns
4. Docker Compose updates¶
The Docker Compose stack was updated to match the new configuration model.
Important changes:
- Services use generated env files from
deploy/compose/env/. - Raw project config is not baked into images.
- Compose validation was run successfully.
- Documentation was added or updated under
deploy/compose/README.md.
Current expectation:
- Generate Dynaconf env files from TOML config/secrets.
- Start infrastructure and application services with Compose.
- Keep generated env files local and untracked.
5. Ansible deployment hardening¶
The Ansible deployment assets were improved to avoid hardcoded lab assumptions.
Important changes:
- Service hostnames are now variables rather than hardcoded values.
/etc/hostsentries are optional and controlled through variables.- Legacy forced mapping of service aliases to
127.0.0.1was removed. - Sensitive values in examples were replaced with vault/env-driven placeholders.
- Documentation now explains how to provide host aliases in air-gapped or lab environments.
Relevant variables include:
py_phone_caller_service_host: "{{ caddy_domain_name }}"
py_phone_caller_pbx_host: "pbx.lan"
py_phone_caller_database_host: "postgresql.lan"
py_phone_caller_queue_host: "redis.lan"
py_phone_caller_hosts_entries: []
Example for lab or air-gapped host aliases:
py_phone_caller_hosts_entries:
- address: "<INFRA_SERVICES_IP>"
names:
- postgresql.lan
- pbx.lan
- redis.lan
- address: "<REVERSE_PROXY_IP>"
names:
- nginx.lab.local
This matches the real deployment direction better than hardcoded IP addresses.
6. Database and Piccolo hardening¶
Several database-related issues were fixed.
Piccolo config discovery¶
Initial issue:
Root cause:
- Piccolo defaults to importing top-level
piccolo_conf. - The actual config module lives inside the workspace package:
Fix:
This was added to the database-using service container environments.
Legacy schema drift repair¶
Observed runtime errors included missing columns such as:
Fixes added:
- idempotent schema repair for existing legacy databases
- repair migration for tracked migration flows
- direct repair fallback in
caller_register - baseline migration-history reconciliation for databases where tables existed but Piccolo migration metadata was incomplete
The project now treats caller_register as the central database initialization/repair component.
Operational rule:
- Start/run
caller_registerfirst. - Then start DB-dependent services such as
asterisk_recaller,py_phone_caller_ui, andasterisk_ws_monitor.
7. Web UI security and behavior fixes¶
The Web UI received several important fixes.
Legacy password hashes¶
Issue:
Root cause:
- Existing users had legacy
sha512$salt$hashpassword hashes. - Current Werkzeug rejects that format as an unsupported hash method.
Fix:
- Added safe shared password verification logic.
- Supported legacy
sha512verification. - Rehashed legacy passwords using the current Werkzeug format after successful login.
- Updated login and password-change flows to use the shared verifier.
- Added regression tests.
Admin bootstrap behavior¶
Issue:
- If the admin user was deleted, the Web UI could create a new admin with a random password on normal startup.
Fix:
- The initial admin is created only when the
userstable is empty andUI_USER_RESET_PASSWORD=trueis explicitly set. - Missing admin with existing users no longer triggers silent recreation.
- Password reset skips safely if the admin account is missing.
- Startup avoids resetting the password immediately after initial creation.
Recommended behavior:
Use this only for intentional first-time bootstrap or explicit admin password reset. Set it back to false immediately afterward.
8. Web UI look and feel¶
The UI was refreshed while preserving offline compatibility.
Important constraints:
- No CDN usage.
- No Google Fonts or external assets.
- All assets must remain local for air-gapped environments.
Changes included:
- updated shared layout/navigation/footer
- improved dashboard hero/cards
- modernized login screen
- expanded local CSS for cards, tables, buttons, forms, modals, pagination, and responsive polish
The result is a more curated and modern interface without compromising offline operation.
9. Rust SMS engine validation¶
The Rust SMS engine was built and validated.
Rust code location:
Main build command:
cd src/py-phone-caller-utils
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 uv run maturin develop --manifest-path py_phone_caller_utils/sms/rust_engine/Cargo.toml
Important fixes and notes:
maturinwas added as a development dependency.- Rust toolchain and C compiler requirements were documented.
- Python
3.14/ PyO3 compatibility was handled withPYO3_USE_ABI3_FORWARD_COMPATIBILITY=1. - The native module import was validated.
- The Rust SMS runtime was verified through
caller_smsstartup.
Documentation was expanded at:
Observed successful runtime behavior:
Starting Rust engine with DB: sqlite:///tmp/sms.db, Strategy: round_robin, Modems: 2
Rust SMS engine started successfully.
10. Kokoro audio generation fixes¶
The audio generation flow was validated and fixed.
Observed issue:
Impact:
generate_audioreturned a response, but no audio file was generated.asterisk_ws_monitorkept polling for the file until timeout.- Calls could not proceed with generated voice audio.
Fix:
- Added the missing
kokorodependency. - Added explicit
huggingface-hubdependency where needed. - Validated import of
KPipeline. - Validated generation of an actual WAV file.
- Rebuilt the Rust SMS extension after dependency sync removed the native module.
Validation included a generated WAV with:
11. num2words security hardening¶
A security warning was reviewed for num2words.
Finding:
- Malicious releases affect
num2words0.5.15and0.5.16. - The project lockfile resolved the safe version
0.5.14. - The previous dependency range was too broad.
Fix:
This prevents future dependency resolution from selecting known malicious releases.
12. Celery worker validation¶
The Celery worker was run successfully from a PyCharm-compatible command.
Equivalent command:
Observed successful behavior:
- Celery started.
- Redis connection succeeded.
py_phone_caller_utils.tasks.celery_task.do_this_callwas registered.- Worker reached ready state.
13. Gunicorn / Web UI validation¶
The Web UI was run successfully through Gunicorn.
Equivalent command:
Observed successful behavior:
- Gunicorn started.
- Four workers booted.
- Flask app initialized.
/metricsroute was added.- PostgreSQL connectivity succeeded.
- Admin setup no longer crashed after schema repair.
14. Nagios and Zabbix integrations¶
The monitoring call scripts were reviewed and updated.
Files:
Improvements:
- Removed hardcoded API IP addresses.
- API endpoint is now configurable through environment variables or script arguments.
- Added
curlavailability checks. - Added timeout configuration.
- Added HTTP failure handling.
- Switched to safer
curl --get --data-urlencode --request POSTusage. - Updated component READMEs with setup, manual tests, and troubleshooting.
Live validation:
asterisk_callermetrics endpoint responded athttp://192.168.101.17:8081/metrics.- Nagios and Zabbix scripts returned successful
{"status": 200}responses againsthttp://192.168.101.17:8081/call_to_queue.
Current known network context¶
The current lab host mapping shared during validation was:
192.168.101.160 nginx.lab.local
192.168.101.212 git.py-phone-caller.lan postgresql.lan pbx.lan redis.lan
During live service testing, all py-phone-caller services were running on:
The deployment tooling should not hardcode these values. They are useful lab defaults/examples only.
Offline and air-gapped posture¶
Air-gapped operation is an important project requirement.
Current good points:
- Web UI assets remain local.
- No CDN or external font dependency was added during UI refresh.
- Runtime configuration is externalized through env files.
- Docker images no longer need raw
src/configcopied into them. - Kokoro model presence is checked and can be prepared ahead of runtime.
- Deployment docs increasingly account for local DNS or explicit
/etc/hostsaliases.
Recommended release rule:
- Any new frontend dependency must be vendored locally or packaged with the app.
- Any new model/runtime dependency must have an offline preload procedure.
- Any deployment secret must come from env files, vault, or platform secret injection, not from baked images.
Validation already performed¶
Recent validation included:
- project tests passing, most recently reported as
26 passed - Web UI focused tests passing after login/admin changes
git diff --check- shell syntax checks for helper scripts
- Docker Compose config validation
- representative container image build
- verification that built images do not contain
/app/src/config - Rust SMS build and import validation
- Kokoro TTS import and WAV generation validation
- live Nagios/Zabbix script calls against running services
- live service startup checks for Celery, Gunicorn/Web UI,
caller_sms,generate_audio, and Asterisk-related components where possible
Full live stack launch remains environment-dependent because it requires external systems such as Asterisk, PostgreSQL, Redis, model/runtime assets, and optional SMS hardware.
Production-readiness feedback¶
What is strong now¶
The project is now much more coherent than before the recent hardening pass.
Strong points:
- Service boundaries are clear.
uvgives a better dependency and build foundation.- Docker and Ansible are moving toward the same runtime configuration model.
- Configuration and secrets are no longer baked into images.
- DB initialization is safer for legacy and partially migrated environments.
- Web UI login/admin behavior is safer.
- Offline UI requirements are respected.
- Rust SMS and Kokoro audio paths have been tested in real local runs.
- Monitoring integrations are now configurable and tested.
Main remaining risk: unauthenticated APIs¶
The most important remaining production risk is API authentication.
Current state:
- The Web UI has password-based authentication.
- Internal service APIs are not yet protected.
- Any client that can reach
asterisk_callercan potentially trigger calls. - Monitoring integrations can submit call requests if they can reach the endpoint.
This is acceptable only when the stack is deployed inside a trusted LAN, air-gapped network, or tightly firewalled segment.
Before exposure to untrusted networks, add authentication for all non-public endpoints.
Recommended direction:
- Add a shared API token or signed request mechanism first.
- Require authentication on write/action endpoints such as
call_to_queue,place_call,make_audio,send_sms, and registration endpoints. - Use separate tokens/scopes for service-to-service calls and monitoring integrations.
- Keep network isolation even after authentication is added.
Health and readiness checks¶
The project should standardize health endpoints.
Recommended endpoints per service:
/healthfor process liveness/readyfor dependency readiness/metricsfor Prometheus metrics, where applicable
Readiness should check real dependencies where possible:
- PostgreSQL connectivity for DB-using services
- Redis connectivity for queue/Celery services
- Asterisk ARI connectivity for Asterisk services
- Kokoro/model availability for
generate_audio - Rust SMS engine/modem readiness for
caller_sms
Startup order¶
The release documentation should make startup order explicit.
Recommended order:
- PostgreSQL
- Redis
- Asterisk
caller_registergenerate_audiocaller_sms, if SMS is enabledasterisk_callerasterisk_ws_monitorasterisk_recallercaller_schedulercaller_address_bookcelery_workerpy_phone_caller_ui- reverse proxy / external access layer
The most important rule is to run caller_register before DB-dependent services.
Recommended 1.0.0 release checklist¶
Build and dependency checks¶
- Run
uv sync --frozenfrom the project root. - Confirm
uv.lockis clean and committed. - Run the full test suite.
- Build all service images.
- Confirm no image contains raw
src/configor secret files. - Confirm
num2wordsremains capped below0.5.15. - Confirm Rust SMS native module can be rebuilt from source.
- Confirm Kokoro model/runtime is available in the target environment.
Configuration checks¶
- Generate Dynaconf env files from TOML settings and secrets.
- Confirm generated env files are not committed.
- Confirm
PICCOLO_CONFis present for all Piccolo/database services. - Confirm
UI_USER_RESET_PASSWORDis false for normal production restarts. - Confirm hostnames resolve through DNS or explicit
py_phone_caller_hosts_entries. - Confirm no deployment script has hardcoded lab IPs or credentials.
Database checks¶
- Start PostgreSQL.
- Run/start
caller_register. - Confirm Piccolo migration/repair process completes.
- Confirm required columns exist in
callsandusers. - Confirm Web UI admin user behavior is intentional.
Runtime smoke checks¶
- Start Redis.
- Start Asterisk and confirm ARI/AMI connectivity.
- Start
generate_audioand generate a test WAV. - Start
caller_smsand confirm backend readiness. - Start
asterisk_callerand verify/metrics. - Start
asterisk_ws_monitorand confirm WebSocket connection to Asterisk. - Start Web UI and verify login.
- Place a queued test call in a controlled environment.
- Verify Nagios/Zabbix script call delivery if monitoring integration is enabled.
Security checks¶
- Ensure API services are not exposed to untrusted networks.
- Restrict service ports with firewall rules.
- Rotate all default/example credentials.
- Use Ansible Vault, generated env files, or platform secrets for sensitive values.
- Plan or implement API authentication before public or semi-public exposure.
- Confirm generated audio files and logs do not leak sensitive data unexpectedly.
Suggested post-release roadmap¶
The following improvements would make the project more robust after 1.0.0:
- Add API authentication for all service endpoints.
- Add token scopes for monitoring, service-to-service, and admin operations.
- Add standardized
/healthand/readyendpoints. - Add a formal smoke-test script that checks the whole stack in order.
- Add structured error responses for background operations such as audio generation.
- Add better observability around call lifecycle state.
- Add documented backup/restore procedures for PostgreSQL and generated config.
- Add a documented offline artifact preparation process for models, wheels, and images.
- Add an explicit migration-history cleanup command or admin procedure for legacy databases.
- Consider reducing implicit startup side effects in services where possible.
Current release confidence¶
Current confidence is good for:
- trusted LAN deployments
- air-gapped/lab deployments
- controlled production environments with firewall isolation
- internal monitoring integration use
- local PyCharm/operator-driven service testing
Current confidence is not yet sufficient for:
- direct exposure to the public Internet
- untrusted network clients
- environments without firewall isolation
- deployments requiring endpoint-level authorization guarantees
Final assessment¶
py-phone-caller is now close to a credible 1.0.0 release candidate.
The most important completed improvements are:
- reproducible
uvdependency management - cleaner container builds
- externalized runtime configuration
- safer database initialization and repair
- improved Web UI behavior and appearance
- validated Rust SMS engine
- validated Kokoro TTS path
- hardened monitoring scripts
- fewer hardcoded deployment assumptions
The most important remaining milestone is API authentication. Until that is implemented, the system should be treated as production-ready only inside a trusted, isolated, firewall-controlled network.