Repository navigation
Open
Open
Copy link
Labels
nethvoiceBug or features releted to the NethVoice projectBug or features releted to the NethVoice projecttestingPackages are available from testing repositoriesPackages are available from testing repositories
Milestone
Description
Steps to reproduce
- On a NethVoice installation with queues and some queue activity, wait for the nightly
reports-scheduler.servicerun, or start it manually:systemctl --user start reports-scheduler.service. - Check the unit status and logs:
systemctl --user status reports-scheduler.service,journalctl --user -u reports-scheduler.service.
Expected behavior
reports-scheduler.service completes successfully: queue-miner.php rebuilds agent_extensions on every run and tasks views rebuilds all the view tables.
Actual behavior
The scheduler fails, so the report tables stop being updated. Two independent problems:
agent_extensionsis never rebuilt. Inqueue-miner.phpevery statement of the first batch was run withexecute([$now])and then again withquery().DROP TABLE agent_extensionsandCREATE TABLE agent_extensionshave no placeholder, so with PHP 8 (where PDO throws by default)execute()fails withSQLSTATE[HY093]and the table is never rebuilt. On NS7 (PHP 7, silent PDO errors) the followingquery()used to rebuild it. The stale table can contain duplicated extensions, andtasks viewsthen fails ondata_summary_agent.sqlwithError 1242: Subquery returns more than 1 row. The logs also show error 1064 from the secondquery()on the statements that use the placeholder.- Race on
phonebook_map.tasks viewsruns the view files in parallel, four at a time.data_call.sqlanddata_caller.sqlbothDROP/CREATE TABLE phonebook_mapand almost always run together: one of them fails withError 1050: Table 'phonebook_map' already exists.
Components
NethVoice reports (reports-api image, queue-miner.php executed in the freepbx container), nethvoice-report up to nethesis/nethvoice-report@c8d1ecc.
Fix
- queue-miner: rebuild agent_extensions on every run nethesis/nethvoice-report#233: bind
$nowonly to the statements that use it and run each statement once. - views: create phonebook_map only in data_call.sql nethesis/nethvoice-report#234: create
phonebook_maponly indata_call.sql(the definitions were identical anddata_caller.sqldoesn't use it).
Test case
With the testing image that includes both fixes:
- Run
systemctl --user start reports-scheduler.servicea few times in a row: it must complete without errors, and the journal must not containHY093,1064,1242or1050. queue-miner.phpmust rebuildagent_extensions: after adding a queue agent (or renaming one) and receiving at least one queue call, run the scheduler again and check that the agent appears inasteriskcdrdb.agent_extensionswith the current name, with exactly one row per extension:
SELECT extension, COUNT(*) FROM asteriskcdrdb.agent_extensions GROUP BY extension HAVING COUNT(*) > 1;→ no rows.- Open the queue reports (agent summary, hourly distribution by agent) and the CDR caller/call data pages: they must show up-to-date data, with agent names resolved.
phonebook_mapmust still be created bydata_call.sqlaftertasks views(SHOW TABLES LIKE 'phonebook_map';).
Metadata
Metadata
Assignees
Labels
nethvoiceBug or features releted to the NethVoice projectBug or features releted to the NethVoice projecttestingPackages are available from testing repositoriesPackages are available from testing repositories
Type
Projects
- StatusShow more project fieldsTesting
Activity
edospadoni commentedon Nov 12, 2026
Testing PR with the updated nethvoice-report pin: nethesis/ns8-nethvoice#1202