Wednesday, April 28, 2010

Voicemail Details

The original /etc/asterisk/voicemail.conf had a lot of commented options, so I renamed it voicemail.conf.sample and made a new one. There are three contexts: [general] holds various global options, [zonemessages] are for timezones, and [default] (which can be renamed whatever you want) holds the mailbox information.

Currently, this is what each section looks like (with brief explanation):
[general]

format=wav49|gsm|wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
emaildateformat=%A, %B %d, %Y at %r
sendvoicemail=yes
As I said, these are all global options and most are self-explanatory. You can find technical definitions of each option here, along with a bunch of others I didn't include.
[zonemessages]

eastern=America/New_York|'vm-received' Q 'digits/at' IMp
central=America/Chicago|'vm-received' Q 'digits/at' IMp
central24=America/Chicago|'vm-received' q 'digits/at' H N 'hours'
military=Zulu|'vm-received' q 'digits/at' H N 'hours' 'phonetic/z_p'
european=Europe/Geneva|'vm-received' a d b 'digits/at' HM
These are just time zone settings. Full explanation of zonemessages is midway down the page here.
[default]

1000 => 9999,Miles K,email.removed.to.stop.spam@gmail.com
1001 => 9999,John M
....
Mailboxes are simple to set up. It's the extension followed by the passcode, Name (it knows that the last name is separated from the first name by a space!), and notification e-mail address. You can also add a pager e-mail address (pagers....hah!) and various overrides to the global options that are specified in [general].

The addition of voicemail necessitates changes to the dialplan (extensions.conf) which happened in a somewhat circular way as I followed the book's example. At first there was the no-brainer approach, taking this:
exten => 1000,1,Dial(${MILES},${DELAYTIME})
exten => 1000,n,Playback(vm-nobodyavail)
exten => 1000,n,Hangup()
into this:
exten => 1000,1,Dial(${MILES},${DELAYTIME})
exten => 1000,n,VoiceMail(1000@default,u)
exten => 1000,n,Playback(vm-nobodyavail)
exten => 1000,n,Hangup()
The VoiceMail() application takes two arguments: (mailboxNumber@mailboxContext, statusIdentifier). mailboxNumber and mailboxContext are what got entered into voicemail.conf. statusIdentifier can be either "u" (unavailable) or "b" (busy). The above is not very robust as it only has directions for an "unavailable" user and no instructions if the user is busy. The second incarnation is:
exten => 1000,1,Dial(${MILES},${DELAYTIME})
exten => 1000,n,GoToIf($["${DIALSTATUS}" = "BUSY"]?busy:unavail)
exten => 1000,n(unavail),VoiceMail(1000@default,u)
exten => 1000,n,Hangup()
exten => 1000,n(busy),VoiceMail(1000@default,b)
exten => 1000,n,Hangup()
This makes use of the DIALSTATUS variable to tell * what message to play in the unavailable/busy scenarios, kind of like a decision tree.

No comments:

Post a Comment