Voicemail with time condition

Fun exercise for this morning. The Dynamic Routes module’s primary purpose is to branch call flow based on a dynamic condition. We just need to figure out what changes when there is a temp message set for a mailbox.

When you have a temp greeting enabled for a mailbox, the file temp.wav will exist in the voicemail file structure. You need to test for the existence of this file. The following Asterisk expression will return true if mailbox 6006 is set with a temporary message, otherwise it returns null:

${SHELL([[ -f /var/spool/asterisk/voicemail/default/6006/temp.wav ]] && echo -n 'true')}

If you use that as an Asterisk Variable condition in a dynroute, update it for the vm box in question, then you can set the default destination to where the normal operation, and a match condition set to true when it’s enabled.

See this post for a similar situation using a different asterisk expression: Using Dynamic Routes to branch call flow based on extension state

3 Likes