<div dir="ltr">Thanks! Another thing to point me in the right direction. Investigating the source, I found in the routine deliver_vm(), it makes these calls:<div><div>                switch_event_create_subclass(&amp;message_event, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT);</div><div><div>                switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, &quot;VM-Action&quot;, &quot;leave-message&quot;);</div></div><div>...</div><div><div>                switch_event_fire(&amp;message_event);</div></div><div>This led me to the example autoload_configs/lua.conf.xml file, which has this line:</div><div><br></div><div><div>    &lt;!--&lt;hook event=&quot;CUSTOM&quot; subclass=&quot;conference::maintenance&quot; script=&quot;catch-event.lua&quot;/&gt;--&gt;</div></div><div><br></div><div>I should be able to write a script that gets called whenever something happens to a voicemail box with this line:</div><div><div>    &lt;hook event=&quot;CUSTOM&quot; subclass=&quot;vm::maintenance&quot; script=&quot;voicemail-event.lua&quot;/&gt;</div></div><div><br></div><div>Then, in my lua script, I should be able to call event:getHeader(&quot;VM-Action&quot;), and exit unless it&#39;s &quot;leave-message&quot;. There are other headers in the event that should have information such as the length of the recording.</div><div><br></div><div>Just a little confused about the &quot;event&quot; variable. Is that a global variable that&#39;s already set when my script is called?</div><div><br></div><div>-- </div><div>Steve</div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 22, 2016 at 9:34 AM, Abaci B <span dir="ltr">&lt;<a href="mailto:abaci64@gmail.com" target="_blank">abaci64@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><a href="https://wiki.freeswitch.org/wiki/Mod_lua#Event_Hooks" target="_blank">https://wiki.freeswitch.org/wiki/Mod_lua#Event_Hooks</a></div></blockquote></div></div></div></div>