Thanks! Another thing to point me in the right direction. Investigating the source, I found in the routine deliver_vm(), it makes these calls:
                switch_event_create_subclass(&message_event, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT);
                switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Action", "leave-message");
...
                switch_event_fire(&message_event);
This led me to the example autoload_configs/lua.conf.xml file, which has this line:

    <!--<hook event="CUSTOM" subclass="conference::maintenance" script="catch-event.lua"/>-->

I should be able to write a script that gets called whenever something happens to a voicemail box with this line:
    <hook event="CUSTOM" subclass="vm::maintenance" script="voicemail-event.lua"/>

Then, in my lua script, I should be able to call event:getHeader("VM-Action"), and exit unless it's "leave-message". There are other headers in the event that should have information such as the length of the recording.

Just a little confused about the "event" variable. Is that a global variable that's already set when my script is called?

-- 
Steve


On Sun, May 22, 2016 at 9:34 AM, Abaci B <abaci64@gmail.com> wrote: