Skip to content

NethVoice IVR report: IVR name missing because dialplan no longer logs it in IVRAPPEND #8244

Open

Description

@andrea-marchionni

Description

The IVR report no longer shows the IVR name for recent calls. The data_ivr_* tables read the name from queue_log_history.data4 (data_ivr.sql), but the generated dialplan no longer writes the name in the IVRAPPEND queue log event.

Current behavior

The IVR context generated by FreePBX now sets IVRSELECTION with only the selected digit and the IVR context:

-- Executing [1@ivr-5:2] Set("PJSIP/xxx-00000109", "IVRSELECTION=1|ivr-5") in new stack
-- Executing [1@ivr-5:4] QueueLog("PJSIP/xxx-00000109", "NONE,1792164024.4143,NONE,INFO,IVRAPPEND|1|ivr-5") in new stack

The resulting queue_log row has:

field value
data1 IVRAPPEND
data2 1 (choice)
data3 ivr-5 (IVR id)
data4 empty

So ivr_name is empty in data_ivr_year, data_ivr_month, data_ivr_week and data_ivr_day.

Expected behavior

The IVR report shows the IVR name, as it did before.

Steps to reproduce

  1. Create an IVR and route an inbound call to it.
  2. Select an option during the call.
  3. Check the IVRAPPEND row in queue_log: data4 is empty.
  4. Run the report views: ivr_name is empty for that IVR.

Proposed fix

Option A (report side, independent from dialplan changes): resolve the name from asterisk.ivr_details, falling back to data4 for historical rows and to the IVR id for deleted IVRs:

SELECT
    DATE_FORMAT(q.time, "%Y") AS period,
    q.data3 AS ivr_id,
    MAX(COALESCE(NULLIF(q.data4, ''), i.name, q.data3)) AS ivr_name,
    q.data2 AS choice,
    count(*) AS tot
FROM queue_log_history q
LEFT JOIN asterisk.ivr_details i
    ON i.id = CAST(SUBSTRING_INDEX(q.data3, '-', -1) AS UNSIGNED)
WHERE q.queuename = 'NONE'
  AND q.agent = 'NONE'
  AND q.event = 'INFO'
  AND q.data1 = 'IVRAPPEND'
GROUP BY period, ivr_id, choice
ORDER BY period ASC;

This requires the report DB user to have SELECT on asterisk.ivr_details and both databases on the same MariaDB instance. Rows without data4 will show the current IVR name, so renamed IVRs will show the new name on old data.

Option B (dialplan side): restore the IVR name in IVRSELECTION (${EXTEN}|ivr-N|<name>) in the IVR module dialplan generator, so data4 is populated again.

Activity

  1. moved this from Todo to In Progress in NethVoiceon Oct 19, 2026
  2. moved this from In Progress to Testing in NethVoiceon Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

nethvoiceBug or features releted to the NethVoice projecttestingPackages are available from testing repositories

Type

Projects

  • Status
    Testing

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions