Reload failed because retrieve_conf encountered an error: 1 - Amd.class.php

So… System was upgraded to 12.7.5 using the update script,which seemed to go off without a hitch until a reload. The script was able to update the underlying OS from 6.x to 7.x without a problem it appears, but I am getting an error on the reload relating to Amd.class.php in retrieve_conf:

Error(s) have occured, the following is the retrieve_conf output:
exit: 1
Unable to continue. Illegal string offset 'initial_silence' in /var/www/html/admin/modules/amd/Amd.class.php on line 128
#0 /var/www/html/admin/modules/amd/Amd.class.php(128): Whoops\Run->handleError(2, 'Illegal string ...', '/var/www/html/a...', 128, Array)
#1 /var/www/html/admin/libraries/BMO/FileHooks.class.php(97): FreePBX\modules\Amd->genConfig()
#2 /var/www/html/admin/libraries/BMO/FileHooks.class.php(26): FreePBX\FileHooks->processNewHooks()
#3 /var/lib/asterisk/bin/retrieve_conf(877): FreePBX\FileHooks->processFileHooks(Array)
#4 {main}

Modules are all up to date, based on standard, commercial, extended with no issue reported with any of them.

Amd.conf is generated with the appropriate fields it seems:

[general]
initial_silence=2500
greeting=1500
after_greeting_silence=800
total_analysis_time=5000
min_word_length=100
maximum_word_length=5000
between_words_silence=50
maximum_number_of_words=3
silence_threshold=256

Disabling Amd makes it work but requires disabling two other modules that have dependencies.

Any ideas?

I just did the same update and am getting the same error. There’s also a lovely error when you go to the AMD Settings application that refers to the same information for amd.conf. Perhaps there is a problem retrieving or formatting the information for amd.conf. I don’t think getAmdSettings() is working properly… this function is used in displaying the admin page and writing the config. If I’m reading the code correctly, getAmdSettings() is supposed to return an array, but according to the error on the admin page, it’s getting a string somehow.

The deeper I dig the more my head hurts.

Something is odd… However, since this machine is remote to me, instead of trying to figure out what was happening, I had somebody drop in a new DVD and reinstalled - it is a machine that is intended to replace a production machine shortly, and I didn’t have the time to futz with it.

I also got another odd error in the dashboard, so with that one coming up after other updates, I decided it was easier to cut my losses and start fresh…

I found a fix…

Step 1: Change line 117 in /var/www/html/admin/modules/amd/Amd.class.php from

return $amd_values;

to

return json_decode($amd_values, true);

Step 2: Go to the AMD Settings application, change something, then save/submit it (don’t apply). You’ll get an error.

Step 3: Change line 117 back to the original. Reload the admin page and everything is happy.

I think somehow the AMD settings were stored as JSON in the upgrade and the AMD admin module can’t handle that format. Once the format was changed to an array, it seems to work.

1 Like

You can also report this as a bug on http://issues.freepbx.org/ or open a pull request on https://github.com/freepbx/amd or https://git.freepbx.org/projects/FREEPBX/repos/amd/browse instead of posting comments like these.

Remember that not everyone is as smart as you are.

Thanks for your input!

Nice catch!

Unfortunately what you have done here is not the correct fix for this issue.

Could you elaborate on what is incorrect about it and what the correct fix is in this case? It seems to be writing the config fine now and I’m able to use the PBX.

You claim that it’s outputting JSON but from looking over the module’s code it does not do this. What it was doing was outputting null, which is where the original error comes from since null isn’t an array you can’t offset from that. Regardless I reported the bug in the correct places and issued fixes. The fixed module is now live.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.