I got it working. Ignore the rest of this message unless you want to know how I solved it.
My problem was that I was using "reloadxml" after I added the "hook" line, but after reading the mod_lua.cpp file, I found that while "reloadxml" loaded the whole XML include tree into the Freeswitch config structure, The mod_lua code used that config structure only on startup. The solution was to shut down freeswitch. (And thanks to the new systemd on Debian 8, it started back up by itself.)
--------
It didn't work.I tried putting this line in autoload_configs/lua.conf.xml:
<hook event="CUSTOM" subclass="vm::maintenance" script="voicemail-event.lua"/>
I then created a "voicemail-event.lua" file with the following:
action = event:getHeader("VM-Action")
freeswitch.consoleLog("info", "VM Action: " .. action)
However, the log file has nothing about this script:
91307edb-28d3-4d1d-bd80-95654a327c8b 2016-05-27 15:07:47.533629 [DEBUG] switch_core_state_machine.c:710 (sofia/external/+
1408xxxxxxx@fl.gg) State DESTROY going to sleep
2016-05-27 15:07:47.533629 [DEBUG] mod_voicemail.c:1946 Update MWI: Messages Waiting yes
2016-05-27 15:07:47.533629 [DEBUG] mod_voicemail.c:1947 Update MWI: Update Reason NEW
2016-05-27 15:07:47.533629 [DEBUG] mod_voicemail.c:1949 Update MWI: Voice Message 1/0
2016-05-27 15:07:47.953635 [DEBUG] switch_utils.c:1180 Emailed file [/tmp/mail.14643868674630] to [
voicemail@xxxx.com]
2016-05-27 15:07:47.953635 [DEBUG] mod_voicemail.c:3038 Sending message to
voicemail@xxxx.com2016-05-27 15:07:48.393632 [DEBUG] switch_utils.c:1182 Emailed data to [vm-page]
2016-05-27 15:07:48.393632 [DEBUG] mod_voicemail.c:3088 Sending notify message to vm-page
The deliver_vm() function in src/mod/applications/mod_voicemail/mod_voicemail.c sends the event before the MWI update. It also sends the event at other times, including after voicemail authentication, but I don't see that it the log either.
Investigating a little further, in src/mod/languages/mod_lua/mod_lua.cpp, there is a function that seems to process the autoload_configs/lua.conf.xml file. It has a loop that appears to process the "hook" elements that includes this line:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "hook params: '%s' | '%s' | '%s'\n", event, subclass, script);
--
Steve