ASTERISK CONFIGURATION FILE
The voicemail.conf Configuration File
New 'Enhanced Voicemail' features (April 28, 2004)
dialout= and callback= require a context as value[general]
cidinternalcontexts = house-admin, house-toll, house-local, house-intercom-only
[default]
1234 => 1234,Some User,email@address.com,pager@address.com,saycid=yes|dialout=fromvm|callback=fromvm|review=yes|operator=yes
Features
Some quick definitions to help the reader to understand this document:- An association statement is of the value '=' or '=>'. It delimits the setting from the value and option fields in an entry
- A comment is used to add a useful note about an entry. Any text following a semicolon ';' will be treated as a comment.
- A context section is a section which is equal to a context defined in other Asterisk configuration files.
- An extension_number is a special case of a setting for a numeric string defining a particular user extension.
- An entry is a single line of text containing settings, an association statement a value, and zero or more options
- The newzonename defines a the name of a custom time zone configuration.
- An option is a string of characters which usually follows a value
- A section is a keyword enclosed in square brackets i.e. [xxx] and is used to denote a particular area of the configuration file.
- A setting is a keyword which is located on the left most side of an entry line.
- The user_email_address is a character string which defines the email address of a user for a particular voicemail entry.
- A user name is a character string set to the name of the user for a particular voicemail entry.
- The user_option(s) are options and other data which apply to tbe user defined in particular voicemail entry only.
- The user_pager_address is a character string which defines the email address of a user pager for a particular voicemail entry.
- A value is a keyword or alphanumeric string on the right hand side of the association statement (= or =>) on an entry line.
- The voicemail_password is a numeric string set to the password for a particular voicemail entry.
The format of the voicemail.conf file is:
[general]
setting=value
...
[zonemessages]
newzonename=country/city|options
...
[context_section]
extension_number => voicemail_password,user_name,user_email_address,user_pager_email_address,user_option(s)
...
[another_context_section]
extension_number => voicemail_password,user_name,user_email_address,user_pager_email_address,user_option(s)
...
The voicemail.conf file contains one general section, one zonemessages section and one or more user-defined context sections. The general section holds global configuration informaton. The zonemessages section defines time zones and time reporting formats, and the context sections which follow define groups of users within a specific context. For example, in the above case, two context sections are defined: context_section andanother_context_section.
Settings for the [general] section of voicemail.conf
Lets first discuss the contents of the general section. This section contains configuration settings which will apply as a common policy across all users. Thegeneral section must be defined and present in voicemail.conf. Configuration entries are coded in setting=value format. The configuration settings available in the general section are as follows:
attach
Attach causes Asterisk to copy a voicemail message to an audio file and send it to the user as an attachment in an e-mail voicemail notification message. The default is not to do this. Attach takes two values yes or no.delete
If set to "yes" the message will be deleted from the voicemailbox (after having been emailed).The delete flag, when used alone (instead of with voicemail broadcast), provides functionality that allows a user to receive their voicemail via email alone.
- Note This settting does not always work as a global setting. It is recommended to put this as an option for each voice mailbox that's messages are to be deleted after being emailed.
- Note This setting needs to be prefixed with a | not a , in order to set it on a user's extension if other settings are being configured. For example 823 => 1234,office,office@demo.local,,attach=yes|delete=1
mailcmd
Mailcmd allows the administrator to override the default mailer command with a defined command. Mailcmd takes a string value set to the desired command line to execute when a user needs to be notified of a voice mail message. The default command line is: '/usr/sbin/sendmail -t'. A useful alternative to sendmail is Exim which many people find easier to configure. Examplesmailcmd=/usr/sbin/sendmail -v -t -f asterisk-pbx@yourdomain.com ; use -f to prevent root@localhost.localdomain or similar
mailcmd=/usr/exim/bin/exim -t
; — use the next line for testing
mailcmd=cat >> /tmp/astvm-mail
maxsilence
Maxsilence defines how long Asterisk will wait for a contiguous period of silence before terminating an incoming call to voice mail. The default value is 0, which means the silence detector is disabled and the wait time is infinite. Maxsilence takes a value of zero or a positive integer value which is the number of seconds of silence to wait before disconnecting.envelope
Envelope controls whether or not Asterisk will play the message envelope (date/time) before playing the voicemail message. This settng does not affect the operation of the envelope option in the advanced voicemail menu. Envelope takes two values yes or no. The default value is yes. Note: this is only in the Asterisk CVS version dated 5/19/04 or later.externnotify
Want to run an external program whenever a caller leaves a voice mail message for a user? This is where the externnotify command comes in handy. Externnotify takes a string value which is the command line you want to execute when the caller finishes leaving a message.Note: see an example of an external notification script here.
Note: This command will also run after a person who has logged into a mailbox exits the VoiceMailMain() application. (Remark: This seems not to be the case for Asterisk 1.2.x)
The way it works is basically any time that somebody leaves a voicemail on the system (regardless of mailbox number), the command specified for externnotify is run with the arguments (in this order): context, extension, new voicemails, old voicemails and urgent voicemails. These arguments are passed to the program that you set in the externnotify variable.
externpass
Want to run an external program whenever a user change it's voicemail password? This is where the externpass command comes in handy. Externpass takes a string value which is the command line you want to execute when the users finishes change it's password.Note: if you use this setting, internal change_password function will not be used to regenerate voicemail.conf
Since Asterisk 1.0.10, when using the externpass option for voicemail, the password will be immediately updated in memory as well, instead of having to wait for the next time the configuration is reloaded. For previous version you must do a reload of app_voicemail.
externpasscheck
Added in 1.6.1, if you want to impose security restrictions on your voicemail password, specify a script here. Arguments for this script are: mailbox contextoldpass newpasssilencethreshold
When using the maxsilence setting, it is sometimes necessary to adjust the silence detection threshold to eliminate false triggering on background noise.Silencethreshold allows the adminstrator to do just that. The default silencethreshold value is 128. Higher numbers raise the threshold so that more background noise is needed to cause the silence detector to reset. When employing this setting, some experimentation will be necessary to find the best result.
serveremail
This setting can be used to identify the source of a voicemail notification message. The value is a string which can be encoded one of two ways. If the string is of the form someone@host.com, then the string will be used as the source address for all voicemail notification emails. If the string is of the formsomeone, then the host name of the machine running Asterisk will be postpended to the string after insertion of a '@'.maxmessage
This defines the maximum amount of time in seconds of an incoming message. Use this when there are many users and disk space is limited. The default value for this setting is 0 which means there will be no maximum time limit enforced.maxmsg
This limits the number of messages in a voicemail folder. The maximum value is 9999 (hard coded) and the default 100. When a mailbox has more than this number of messages in it, new messages can not be recorded and vm-mailboxfull is played to the caller. No more messages possible is also logged. This setting was introduced in 1.2. In previous versions it was hard coded to 100.minsecs (used to be called minmessage)
This setting can be used to eliminate messages which are shorter than a given amount of time in seconds. The default value for this setting is 0 which means there will be no minimum time limit enforced.format
The format setting selects audio file format(s) to use when storing voice mail messages. The value is a string defining the audio format(s) of the message file. The default format string is wav49|gsm|wav, meaning that Asterisk will save the voicemail message in all three supported formats. When emailing the attachment, however, it will send only the first of the formats defined here. When playing back (as with all file playback) Asterisk will attempt to use the optimum format based on the codec used for the current channel, in order to provide the best sound quality and to reduce transcoding processing time.- wav49: In this format, the file size will be small, the quality good, and it's a good choice for sending voicemail messages in email. The file will have a .WAV extension, which all Windows users should have no problems with, and users on other platforms should also be able to easily play these sound files.
- gsm: Voicemail saved in this format will have about the same file size and same audio quality as wav49. It may be less well supported by client operating systems if sent to users in email, however.
- wav: This is an uncompressed sound format with a .wav extension, so the file size is very large. Sound quality will be great, but you probably don't want to email it, and you must have adequate disk space.
- g723sf: The sample voicemail.conf file has this option commented out. If you try to activate it, you will find that it doesn't work.
maxgreet
This setting allows the adminstrator to limit the length of the user-recordable voicemail greeting. Use this option on systems with a large number of users and limited disk space. The value is an integer defining the maximum length in seconds of a greeting message. The default value is 0 which means that the greeting message can be any length. This setting will control the lengths of the unavailable greeting, busy greeting, and user name messages.skipms
This setting defines an interval in milliseconds to use when skipping forward or reverse while a voicemail message is being played. The value entered here should be a positive integer. The default value for this setting is 3000 (3 seconds).maxlogins
This setting defines the number of retries a user has to enter voicemail passwords before Asterisk will disconnect the user. The value should be a positive integer. The default value for this setting is 3.cidinternalcontexts
This setting defines the internal contexts used to determine the type of voice announcement to play when reading back the caller ID in a message envelope, or when the saycid advanced feature is enabled. In case of an internal call the voice prompt reads "Call from extension ..." instead of "Call from 12345678". This setting is only available in versions of Asterisk with advanced voicemail feature support. The value is a string listing the internal contexts. Each additional internal context should be separated from the previous one with a comma. The default value is an empty string, and no internal contexts defined.review
Sometimes it is nice to let a caller review their message before committing it to a mailbox. This setting takes a yes or no value. If set to yes, then the caller will be asked to review the message, or save it as is after they have pressed '#'. If set to no, the message will be saved and the voice maill system will disconnect the caller. The default value for review is no. This setting is only available in versions of Asterisk with advanced voicemail feature support.operator
This setting enables the user to reach an operator during the time the voicemail message is being recorded, or once a voicemail message has been left, if the review option has been set to yes. This setting takes a yes or no value. The operator must be specified at extension 'o' in extensions.conf, in the context you specify with the voicemail.conf option exitcontext (see below). This setting is only available in versions of Asterisk with advanced voicemail feature support.saycid
Read back caller's telephone number prior to playing the incoming message, and just after announcing the date and time the message was left. This setting takes a yes or no value. If the administrator wants the caller's phone number to be heard prior to playing back a voicemail message, this option should be set to yes. The default value for saycid is no. This setting is only available in versions of Asterisk with advanced voicemail feature support.sendvoicemail
This setting takes a yes or no value. It enables the "Leave a message" menu option from the Advanced Options menu which allows the voicemail user to send a message to another voicemail user.dialout
Specify a context to be used from the "place an outgoing call" feature in the advanced voicemail features menu. This setting takes a string value set to the outgoing context to be used. The default value for this setting is an empty string. This setting is only available in versions of Asterisk with advanced voicemail feature support.callback
Specify a context to be used from the "return phone call" feature in the advanced voicemail features menu. This setting takes a string value set to the outgoing context to be used. The default value for this setting is an empty string. This setting is only available in versions of Asterisk with advanced voicemail feature support.dbuser
Specify the Mysql database user name for the voicemail application to use. The value is a string. The default value is "test". Note that Asterisk has to be compiled for Mysql support for this option to be meaningful.dbpass
Specify the Mysql database password for the voicemail application to use. The value is a string. The default value is "test". Note that Asterisk has to be compiled for Mysql support for this option to be meaningful.dbhost
Specify the Mysql database server hostname for the voicemail application to use. The value is a string. The default value is an empty string. Note that Asterisk has to be compiled for Mysql support for this option to be meaningful.dbname
Specify the Mysql database name. The value is a string. The default value is "vmdb". Note that Asterisk has to be compiled for Mysql support for this option to be meaningful.dboption
Specify the Postgres database option. The value is a string. The default value is an empty string. Note that Asterisk has to be compiled for Postgres support for this option to be meaningfu1, and this option must be specified if Postgres support is enabled.pbxskip
This setting changes the Subject: line in a voicemail notification message. This setting takes a yes or no value. The default value is no. When set to yes theSubject: line will read "Subject: New message M in mailbox B". When set to no the Subject: line will read "Subject: [PBX]: New message M in mailbox B".fromstring
This setting allows the adminstrator to override a portion of the From: line in the voicemail notification message. By default, Asterisk sends the string "From: Asterisk PBX <who>. The "Asterisk PBX" portion of the From: line can be overridden by specifying your own string as the value for this setting. One might use this to customize the voicemail notification message and/or remove the reference to "Asterisk PBX".pagerfromstring
This setting allows the adminstrator to override a portion of the From: line in the voicemail pager notification message. By default, Asterisk sends the string "From: Asterisk PBX <who>. The "Asterisk PBX" portion of the From: line can be overridden by specifying your own string as the value for this setting. One might use this to customize the voicemail pager notification message and/or remove the reference to "Asterisk PBX".pagerbody
This setting overrides the normal message text seen in the body of a SMS voicemail notification message. It also supports variable substitution which can be used to make the message more meaningful.Example:
pagerbody=${VM_DATE} - ${VM_MAILBOX} has a new voicemail from ${VM_CALLERID} (${VM_DUR} seconds).
emailsubject
This setting completely overrides Subject: line in the voicemail notification message, and substitutes its own text in place of it. The value passed is a string containing the text to send in place of the Subject: line. A list of macro-like expansion tokens are listed below. NOTE: \t and \n do not expand as you might expect in this field.If you need to specify a specific subject per mailbox, have a look at this http://bugs.digium.com/view.php?id=14372 patch.
Example:
emailsubject=New voicemail in mailbox ${VM_MAILBOX} from ${VM_CALLERID}
emailbody
This setting overrides the normal message text seen in the body of a voicemail notification message. It also supports variable substitution which can be used to make the message more meaningful. The format would look like this: emailbody=\n\tHi ${VM_NAME},\n\n\tYou have a ${VM_DUR} long new voicemail message (number ${VM_MSGNUM}) in mailbox ${VM_MAILBOX}\nfrom ${VM_CIDNAME} (${VM_CIDNUM}), on ${VM_DATE}\nso you might want to check it when you get a chance.\n\nNotice thats a single line without quotes... Use \n \t to do formatting. A list of macro-like expansion tokens are listed below.
If you need to specify a specific body per mailbox, have a look at this http://bugs.digium.com/view.php?id=14372 patch.
emaildateformat
Only used in combination with 'emails' and not 'pager'. If you use ${VM_DATE} in an email then the format you had given will be displayed. The format can be made with the abbrevations taken from strftime (see http://www.opengroup.org/onlinepubs/009695399/functions/strftime.html)exitcontext
Optional context to drop the user into after he/she has pressed * or 0 to exit voicemail. If not set, pressing * or 0 will return the caller to the last context they were in before being sent to voicemail (assuming that context has a 'a' or 'o' extension).nextaftercmd
If set to "yes," after deleting a voicemail message, the system will automatically play the next message.usedirectory
If set to "yes" Asterisk allows to forward emails to another voicemailbox by choosing a local name. This can be done by pressing 8 in the voicemailboxmenu after the user has heard a voicemail. After this he has to choose between dialing the number of the recipient (Button: 1) or choosing a name which should be defined whether in the file voicemail.conf or in users.conf (Button: 2).Variables to use in emailsubject and emailbody
VM_NAMEVM_DUR
VM_MSGNUM
VM_MAILBOX
VM_CIDNUM
VM_CIDNAME
VM_CALLERID
VM_DATE
volgain
Set the gain to use when sending a recorded message via email attachment. Requires sox.An example of some settings in the general section
[general]
; Send voice file attachments in email notifications
attach=yes
; Use wav format for all voicemail messages
format=wav
; Limit the maximum message length to 180 seconds
maxmessage=180
; Limit the minimum message length to 3 seconds
minmessage=3
; Announce caller's number before playing message
saycid=yes
; Limit the login retiries to 3 before disconnecting the caller
maxlogins=3
; Define the internal contexts for the caller ID reporting function so that it says "from extension" for internal calls.
cidinternalcontexts=house_local,house_toll,house_admin
Settings for the [zonemessages] section of voicemail.conf
The zonemessages section allows the adminstrator to define custom time zones, and to change the way time is announced in a particular time zone. Users may have different time zone settings, and also different formats for announcing the date and time of voicemail messages. When a time zone is defined here, you may use it in individual malboxes by specifying a tz= option on the individual mailbox entry (Mailbox entries are discussed in the next section on contexts). The format of a zonemessages entry is:newzonename=Country/City|Options
Where: The Timezonename field is a name you pick for your custom time zone. The Country field contains the name of the country where the time zone is located. The City field contains the name of the city within the country, and the Options field contains a set of options you choose to customize the time announcement format.
The format of the timezone fields Country/City is the same as that used when installing Linux on a PC for the first time. The time zones which can be used on your system are located in the directory /usr/share/zoneinfo. Pick a Country/City pair which is in the same time zone as your location.
One or more sound files or announce options may be inserted after the '|' delimiter. The sound files should be surrounded by single quotes such as 'vm-received' . The announce options are either single characters or a variable substitution ( ${xxx} ). Multi-character strings of announce options are permitted such as HM. The announce options which can be specified for the options field are:
Option | Description |
---|---|
'filename' | filename of a soundfile (single ticks around the filename required) |
${VAR} | variable substitution |
A or a | Day of week (Saturday, Sunday, ...) |
B or b or h | Month name (January, February, ...) |
d or e | numeric day of month (first, second, ..., thirty-first) |
Y | Year |
I or i | Hour, 12 hour clock |
H | Hour, 24 hour clock (single digit hours preceded by "oh") |
k | Hour, 24 hour clock (single digit hours NOT preceded by "oh") |
M | Minute |
P or p | AM or PM |
Q | "today","yesterday" or ABdY (*note: not standard strftime value) |
q | "(for today)", "yesterday", weekday, or ABdY (*note: not standard strftime value) |
R | 24 hour time, including minute |
Example for the zonemessages section
[zonemessages]
; Set a 12 hour time reporting format for the pacific time zone
san-diego=America/Tijuana|'vm-received' Q 'digits/at' IMP
; Set a 24 hour time reporting format for the pacific time zone
san-diego24=America/Tijuana|'vm-received' Q 'digits/at' R
Settings for the [CONTEXTS] sections of voicemail.conf
The final part of the voicemail.conf configuration file contains one or more context sections where voice mail boxes are defined and configured. (Remember that context sections are sections which are named after contexts defined elsewhere in Asterisk). Multiple voice mail boxes may be defined in a context section. The format of context section is:[context_section]
extension_number => voicemail_password,user_name,user_email_address,user_pager_email_address,user_option(s)
...
After the context section definiton, an entry for each voice mail box you want to have in this context. The extension_number is the extension number which will be assigned this voice mail box. There are 5 parameters which define the configuration for this voice mail box entry:
- The voicemail_password field contains the numeric password for this voice mail box entry. The voicemail system will compare the password entered by the user against this value.
- The user_name is an alpha field which is usually set to the first and last name of the user of this voice mail box.
- The user_email_address can be set to the email address of the user so that when a voice mail message is left by a caller, an e-maill notification will be sent to the address defined in this field.
- The pager_email_address can be set to the email address of a pager so that when a voice mail message is left by a caller, a page will be sent to the pager email address defined in this field.
- The user_option(s) field can be used to override default settings defined in the general section, or set a specific time zone for this user. Specifically, there are 9 setting=value pairs which can be specified in the user_option(s) field. There can be multiple setting=value pairs defined in the user_option(s) field. Each setting=value pair after the first must be delimited with a vertical bar (|). The settings which may be used are: attach, attachfmt, serveremail, tz, imapuser, imappassword, delete, sendvoicemail, review, tempgreetwarn, envelope, sayduration, saydurationm, forcename, forcegreetings, maxmsg, volgain, saycid, review, operator, callback, dialout and exitcontext. With the exception of tz , the functions of the 8 remaining settings are exactly the same as those defined in the
Example context section
; All voice mail boxes for this system will be in the default context
[default]
; Define a user on extension 123 with password 2048 named Joe User with email address for voicemail notification, no pager, timezone set to san-diego,
; and allow attachment of the voice mail message to the email notification.
123=>2048, Joe User, juser@somewhere.net,,tz=san-diego|attach=yes
; Define a user on extension 456 with password 4096 named Jane User with no email address for voicemail notification, no pager, and no options
456=>4096,Jane User,,,
Note that there is no whitespace left between fields and options. This is important. The parser used to parse the voicemail file doesn't like whitespace between options and fields.
Voicemail broadcasts
Voicemail broadcasts can be created with the VoiceMail command in the dialplan. This can be combined with the delete option to delete the original voicemail.In extensions.conf:
exten => 100,1,VoiceMail(u101&102&103)
In voicemail.conf:
101 => 4242,Group Mailbox,,,delete=1
102 => 4242,Buckaroo Bonzai,buckaroo@bonzai.com
103 => 4242,John Whorphin,john@monkeyboy.com
This entry creates a group mailbox at mailbox 101, which, on receipt, is copied to mailboxes 102 and 103. Following the copy to these other mailboxes, the original voice message is deleted.
When multiple mailboxes are specified, the unavailable or busy message will be taken from the first mailbox specified. This could be used to record a special unavailable or busy message for the broadcast mailbox (101 in this example).
AGI Information
When using * and 0, the voicemail application does not specifically forward the call to a and o in exitcontext directly. The application resets the current context to exitcontext and, the extension to a or o respectivey and the priority to 0 then proceeds to exit gracefully relying on the dialplan to figure out to go to priority 1 next. It does, however, still make sure that priority 1 exists before setting it to 0.When executing Voicemail from an AGI script (using "exec Voicemail"), the control is then reverted back to the AGI script where you can check these using the "get variable" AGI command. The variables for the current context, extension and priority are ${CONTEXT}, ${EXTEN} and ${PRIORITY} respectively, so you can use, for example "get variable EXTEN" to retrieve the extension.
More examples
- John todd, Loligo.com http://www.loligo.com/asterisk/current/voicemail.conf
- Zac Sprackett, sprackett.com http://www.sprackett.com/asterisk/conf/voicemail.conf
Tips
- E-mail attachments: If you want some users, but not all, in VoiceMail2 to receive the VM message as an attached audio file in the e-mail notification, add an option to the user configuration in the correct context of voicemail.conf.
- Example: 1234 => 1234,Sample User,myname@mydomain.com,,attach=yes
- Avoid spaces: Do not add spaces after the commas on the configuration line. Adding spaces will give you problems.
- Mailboxes are created using the script:
- /usr/src/asterisk/contrib/scripts/addmailbox
- E-mail to multiple addresses: (Remember that Voicemail command allows multiple recipients). Sometimes it's quite handy to have a message go to multiple mailboxes but not so convenient to have to create additional entries in extensions.conf and voicemail.conf. This works great for "phone coverage" for when someone out of the office for a vacation. You can use the /etc/aliases or /etc/mail/aliases file to handle this through your MTA.
- Example from voicemail.com: 1234 => 1234,Sample User,msmith,,attach=yes
- Example from /etc/mail/aliases: msmith: <msmith@yourmail.com>, <msmith@othermail.com>
- Expanded examples of aliases within Sendmail http://www.feep.net/sendmail/tutorial/intro/aliases.html
- From the How-to above, don't forget to run the newaliases command after you've updated the aliases file.
- Comments In voicemail.conf: The password change function in VoiceMailMain is not very intelligent in parsing comments. Comments with "[" characters inside the voicemail contexts cause it to lose track of the context which makes it fail to write the changes to the voicemail.conf file. For example:
- [default]
- ;MBX => PWD,Full Name[,email,[pager email][,attach=yes|delete=yes|...]
- 1111 => 1111,Ms Smith
- The parser inside vm_change_password (apps/app_voicemail.c) will fail to ignore the comment line and will decide that 1111 is not in the default context but instead in the non-existant context ",email,[pager email][,attach=yes|delete=yes|..."
- If you want to have a comment containing the "[" character place it before your context and it will work fine.
Help New Users Set Up Their Mailbox
When creating new mailboxes for users, set their password the same as their extension. e.g.,
[default]
4993 => 4993,Joe User
3344 => 3344,Sally User
4993 => 4993,Joe User
3344 => 3344,Sally User
When they log into their voicemail the first time, the matching extension and password will tip off Asterisk that they are unconfigured. You also need to set forcename=yes and/or forcegreeting=yes, either for the individual or (this is certainly easier) in the [general] config, like so:
[general]
;...other stuff...
forcename=yes
forcegreeting=yes
;...other stuff...
forcename=yes
forcegreeting=yes
If you set either forcename or forcegreeting (or both), the setup menu will _also_ encourage the user to change their password, but if you _don't_ set forcename or forcegreeting, new users won't get any setup message, even about the password.
You should also educate your users that not only is keeping your password the same as your extension weak security, it will also cause that user to get the setup message every time they log in.
No comments:
Post a Comment