Supervisor web (PHP)¶
Visão geral¶
Interface web Lorentz CTI Supervisor (supervisor/):
- PHP 8.2.26 + Apache (container
php:8.2.26-apache-bookworm) - SQL Server via sqlsrv / ADODB
- Comandos CTI via TCP 3000 → LorentzCTI
- Módulos: CTI, SAC, relatórios, PowerDialing
Deploy¶
URL: http://<IP>:8080/ (porta definida em SUPERVISOR_HTTP_PORT).
Estrutura montada no container¶
/var/www/html/ ← ../supervisor (bind mount)
/var/www/html/att_config.php ← config/runtime (rw — sac_config.php grava aqui)
/var/www/html/api/att_config.php ← config/runtime (rw)
/var/lorentz/LorentzCTI.ini ← config/runtime (ro)
/var/www/html/uploads/ ← volume persistente
/var/www/html/log/ ← volume persistente
Configuração¶
att_config.php (runtime completo)¶
Gerado por ./scripts/render-config.sh a partir de config/templates/att_config.php.template (~127 defines).
O template unifica o que existia em supervisor/att_config.php (lab) e supervisor/api/att_config.php (API + telas SAC), incluindo constantes usadas em CTI, Phoenix, SMTP, monitor, qualificação, CRM, pesquisa de satisfação e integração 3CX/PABX.
| Grupo | Exemplos | Placeholder / valor VPS |
|---|---|---|
| SQL Server | EW_SQLSERVER, EW_SQLSERVER_DB, EW_SQLSERVER_PASS |
sqlserver, .env |
| Phoenix / CTI | EW_PHOENIX_SERVER, EW_PHOENIX_PORTA, EW_PHOENIX_CONCENTRE |
lorentz-cti, 3000 |
| URLs | EW_SERVER_URL, EW_SERVER_MP3 |
SUPERVISOR_PUBLIC_URL, VPS_PUBLIC_IP |
| Base Histórica | EW_BASEHISTORICA_API_URL, EW_BASEHISTORICA_API_KEY |
worker :8091, .env |
| UI / telas | EW_SHOWDIALOG_CENTER, EW_HABILITAR_CLIENTEWEB, EW_CLIENTE_SIMPLIFICADO |
defaults do template |
| Gravação Linux | EW_MP3_LINUX, EW_BACKUP_FOLDER |
1, /var/lorentz/gravacao |
| Admin emergência | EW_ADMIN_USER_NAME, EW_ADMIN_PASSWORD |
.env (SUPERVISOR_ADMIN_*) |
Regenerar após mudar .env ou template:
Validar defines críticas:
grep -c '^define' config/runtime/att_config.php # esperado: ~127
grep EW_SHOWDIALOG_CENTER config/runtime/att_config.php
sac_config.php (edição pela UI)¶
A tela sac_config.php no Supervisor (menu admin) lê e grava /var/www/html/att_config.php via str_replace nas defines existentes ou append antes de ?>.
Requisitos no stack:
- Mount
config/runtime/att_config.php:rw(não:ro) — verdocker-compose.yml - Template com todas as chaves que a tela referencia (senão o append funciona, mas telas que leem a constante antes do save podem falhar)
Atenção:
./scripts/render-config.shsobrescreveconfig/runtime/att_config.php. Alterações salvas pelosac_config.phppersistem até o próximo render. Para valores permanentes de infra (SQL, URL, Phoenix), prefira.env+ template; usesac_config.phppara parâmetros operacionais (PowerDialing, SMTP, flags de monitor).
Sincronizar api/att_config.php¶
O script render-config.sh copia o mesmo arquivo para api/att_config.php (mesmo conteúdo que att_config.php raiz).
Licenciamento Linux (stack host ID)¶
No Windows, att_licenca.php usa VOL / getmac. No container Linux isso falha (VOL: not found).
Solução no stack:
| Artefato | Função |
|---|---|
docker/supervisor/stack-host-id.php |
Gera MacAddress estável para .lic |
config/runtime/stack-host-id |
ID persistido (EC2 instance-id ou machine-id) |
scripts/show-stack-host-id.sh |
Exibe MacAddress para o Gerador de Licença |
scripts/apply-supervisor-host-id-patch.sh |
Patch em ../supervisor/att_licenca.php |
Opcional no .env: LORENTZ_STACK_HOST_ID (fixa o ID manualmente).
API JWT¶
Edite manualmente supervisor/api/config.php:
JWT_SECRET— trocar em produçãoCORS_ALLOWED_ORIGINS— restringir domínio
Login¶
Usuários em SAC_FUNCIONARIO (SQL Server), autenticação MD5 legada.
Usuário admin de emergência: constantes EW_ADMIN_* em att_config.php.
Composer (se necessário)¶
Dependências já podem existir em vendor/.
Permissões¶
O entrypoint ajusta uploads/ e log/ para www-data.
Validação¶
curl -sI http://127.0.0.1:8080/login.php
docker exec lorentz-supervisor curl -sI http://127.0.0.1/login.php
docker compose logs supervisor
Integração Phoenix (TCP 3000)¶
Supervisor envia pacotes STX/ETX via Telnet — exemplos em att_ajax.php:
Requer LorentzCTI escutando na porta 3000 e resolvível como lorentz-cti dentro da rede Docker.
Teste de conectividade do container Supervisor¶
ConfigServer (INI centralizado)¶
Alternativa documentada em supervisor/docs/CONFIGSERVER-README.md:
- INI em
/var/lorentz/LorentzCTI.ini(já montado) - Incluir
configserver.phpno fluxo se migrar deatt_config.php
Documentação adicional¶
- 16-atualizacao-supervisor-web.md — alterações no código PHP e patch para suporte
supervisor/README.mdsupervisor/docs/DEPLOYMENT.mdsupervisor/docs/INSTALLATION.mdsupervisor/docs/02_cti_integration.md
Gap conhecido¶
att_phoenix.php é referenciado em vários módulos mas pode estar ausente do repositório — funções PowerDialing avançadas podem depender desse arquivo proprietário.