Mod voicemail
From FreeSWITCH Wiki
Voicemail
mod_voicemail is a voicemail application. It allows you to send calls to voicemail for messages to be left for your users and lets them check for messages later.
Synopsis
voicemail,Voicemail,[check|auth] <profile_name> <domain_name> [<id>]
Controlling Variables
When the following parameters are set (in directory.conf.xml), they set options for your voicemail users
vm-mailto
This is the user's email address default: undefined
vm-notify-mailto
the addr you want notifications sent to default: same as vm-mailto
vm-password
This is the user's voicemail PIN
vm-email-all-messages
send all messages to vm-mailto addr (attachment based on vm-attach-file param) default: false
vm-notify-email-all-messages
send a notify email to vm-notify-mailto when a vm is left (never has attachment) default: false
vm_cc
Setting this variable will inject the message into the specified voicemail mailbox
Example:
<variable name="vm_cc" value="1001@mydomain.com" />
vm-keep-local-after-email
when you email the main message also keep it locally as new vm for the phone. when false means delete it as if it never happened and just email it. default: true
vm-attach-file
attach the audio file to the main email default: true
vm_message_ext
Determines the storage type (and email type) for voicemails received and can be set per user. In order to use MP3 you must have mod_shout installed and loaded. The default is '.wav'. Example:
<variable name="vm_message_ext" value=".mp3"/>
notify-template-file
the notify email will use the same template as the main email unless you define the new profile default: undefined
Send_mail setting
To enable email setting for voicemail, make sure the following two lines are configured correctly in switch.conf.xml
<param name="mailer-app" value="sendmail"/>
<param name="mailer-app-args" value="-t"/>
Example
Send Call To Voice Mail
The following is an example of sending a call to voicemail after you've decided that a user isn't available.
<action application="voicemail" data="default $${domain} $1"/>
where default is the profile name (must be configured in voicemail.conf.xml), $${domain} is (obviously) the domain (in this case the system-wide domain setting for your switch from vars.xml) and $1 is the dialed extension.
Check Voice Mail
The following is an example of checking vm (will prompt for PIN if ${sip_authorized} is not "true")
<action application="voicemail" data="check $${sip_profile} $${domain} $1"/>
The following example will allow the user to check vm whether they're "sip_authorized" or not
<action application="voicemail" data="auth $${sip_profile} $${domain} $1"/>
Configuration Parameters
file-extension
This is the extension which you want to use for the voicemail messages to be recorded. The default is wav but can be gsm, raw, ul, al, etc.
default
<param name="file-extension" value="wav"/>
terminator-key
default
<param name="terminator-key" value="#"/>
max-login-attempts
default
<param name="max-login-attempts" value="3"/>
digit-timeout
default
<param name="digit-timeout" value="10000"/>
max-record-len
default
<param name="max-record-len" value="300"/>
tone-spec
default
<param name="tone-spec" value="%(1000, 0, 640)"/>
play-new-messages-key
default
<param name="play-new-messages-key" value="1"/>
play-saved-messages-key
default
<param name="play-saved-messages-key" value="2"/>
main-menu-key
default
<param name="main-menu-key" value="0"/>
config-menu-key
default
<param name="config-menu-key" value="5"/>
record-greeting-key
default
<param name="record-greeting-key" value="1"/>
choose-greeting-key
default
<param name="choose-greeting-key" value="2"/>
record-name-key
default
<param name="record-name-key" value="3"/>
record-file-key
default
<param name="record-file-key" value="3"/>
listen-file-key
default
<param name="listen-file-key" value="1"/>
save-file-key
default
<param name="save-file-key" value="2"/>
delete-file-key
default
<param name="delete-file-key" value="7"/>
undelete-file-key
default
<param name="undelete-file-key" value="8"/>
email-key
default
<param name="email-key" value="4"/>
pause-key
default
<param name="pause-key" value="0"/>
restart-key
default
<param name="restart-key" value="1"/>
ff-key
default
<param name="ff-key" value="6"/>
rew-key
default
<param name="rew-key" value="4"/>
odbc-dsn
This option allows you to override the default sqlite with an ODBC handle. You can use any valid DSN from your odbc.ini to store your voicemail configuration
default
<param name="odbc-dsn" value="dsn:user:pass"/>
Database Schema
CREATE TABLE voicemail_msgs (
created_epoch INTEGER,
read_epoch INTEGER,
username VARCHAR(255),
domain VARCHAR(255),
uuid VARCHAR(255),
cid_name VARCHAR(255),
cid_number VARCHAR(255),
in_folder VARCHAR(255),
file_path VARCHAR(255),
message_len INTEGER,
flags VARCHAR(255),
read_flags VARCHAR(255)
);
CREATE TABLE voicemail_prefs (
username VARCHAR(255),
domain VARCHAR(255),
name_path VARCHAR(255),
greeting_path VARCHAR(255)
);
API
vm_boxcount
vm_boxcount can be called from console, xml_rpc or any other interface that exposes FreeSwitch API.
The function takes the following arguments:
<user>@<domain> [|[new|saved|new-urgent|saved-urgent|all]]
and defaults to "new".
FAQ
Do I need a text-to-speech engine installed?
No, it will work with sound files or a text-to-speech engine.
How do I install sound files?
A: make sounds-install
