In today's business sector 24/7 ('twenty
hours a day, 7 days a week') availability is more and more required. A 24/7
service is a service or business available
without interruption regardless of time or day. 24/7 service might be offered
by commercial companies, public service providers, indsustrial and utility
services and nonprofit organisations. In addition to the availability of
services provided by the companies, 24/7 availabity also means that your
customers and other partners can get into contact to you in 24/4 - that is
without any interruption.
After the Easter Holiday season, it
occured to me that: 'What about the customers'calls made during these days?' In
addition to the Easter Holiday there are many cases when you are unable to
accept your customers' calls: for instance if you are out of the office, you
are on Holiday or it is weekend.
On this bases, in my article I inteded
to show a code example on how to implement a customized voicemail solution to
be able accept incoming calls if you are out of the office.
What is Voicemail
Voicemail is a computer-based system
that allows users to exchange personal voice messages, that is to deliver voice
information by using a telephone. Among corporate communication systems
voicemail is widespread, since the caller party can easily leave a message for
the company by recording her/his voice, then later one of the employees can
listen that back.
Prerequisites for my solution
In order to implement any call
management feature, it is essentially needed to have a PBX. Many phone systems
are available in the market, and some of them may provide APIs for
customization. As I use Ozeki Phone System XE as a company PBX, in this code
example I used this PBX and its OzML API to develop, as well.
The implementation of the
#1) Install a voicemail extension in your PBX
opening your PBX, you need to add a new voicemail extension by clicking the Add
button in the Extensions panel
that, click on the Voicemail button that can be found at the right side of the
#2) Configure a voicemail extension in your PBX
it is time to configure the voicemail. The basic functionalities can be set on
the General tab. Here you need to enter an extension number for your voicemail
and browse a path for file saving. You also need to specify some parameters
(minimum record length, recording format, automated sending in e-mail)
concerning to file saving. The greeting message can be also configured: if you
want to greet your callers, you can type welcome message for them (such as
'Hello, welcome to XY company! We are out of the office, so please leave a
message and we will call back you!') and the Text-to-Speech engine will be reading
in that. Or you can upload a prerecorded greeting message as a sound file that
will be played in for the caller.
clicking on the Advanced tab, you can see that 2 functionalities can be
customized. The recording behaviour specifies how the voicemail reacts when
someone wants to leave a message and the play behaviour specifies how the
voicemail reacts when someone wants to listen to the messages left on the
#3) Customize the recording behaviour
1. In the Recording behaviour section select the Custom
2. You can see in the OzML code (Code example 1)
that there will be two seconds of delay and a beep after the greeting message.
You can optimize your recording by modifying the default OzML script (for
example your can modify the record path or the format of the record that can be
mp3 or wav, and you can specify the inactivity period and the finish digits to
create commands for interrupting the recordingd. However, you can customize
your voicemail in many other different ways. For this purpose use the OzML
<Record RecordPath='$recordpath' Format='$format' Inactivity='5'
<Speak>Your message has been saved.</Speak>
example 1: The default recording behaviour
#4) Customize the play behaviour
1. In the Play behaviour section select the Custom
2. You can customize the play behaviour by modifying the
default OzML code (Code example 2) that offers you three options: If you press
the 1, you can listen to your new messages. With the ForEach loop you can go
through your messages, and you will be informed if you have a voicemail. Then
the system will play the recording and move this file into the old messages
directory. That will be repeated until you listen to the last voicemail. If you
press the 2, you can listen to your old messages and you can delete them with
the DeleteFile command. And finally, if you press the 3, you can record a new
greeting message. However, you can setup many other option if you want to. For
this purpose use the OzML reference guide:http://www.ozekiphone.com/voip-reference-book-of-ozml-the-xml-language-of-ozeki-254.html
<UserInput repeat='true' digits='1'>
<Speak>This is the voicemail of user $username .</Speak>
<Speak>To listen to your new messages, press 1.</Speak>
<Speak>To listen to your old
messages, press 2.</Speak>
<Speak>To record a new greeting message, press 3.</Speak>
has been recorded at $item.date from $item.from .</Speak>
<Speak>You have no new
<Speak>This voicemail has been recorded
at $item.date from $item.from .</Speak>
delete this message, press 1.</Speak>
<Speak>End of old
<Speak>Your new greeting
message will be recorded. The recording will start after the
RecordPath='$greetingmessage' Format='$format' Inactivity='5' FinishDigits='1234567890*#'></Record>
<Speak>Your new greeting
message has been saved.</Speak>
example 2: The default play behaviour
#5) Setup dial plan rules
In order to listen to your voicemails,
call your Voicemail extension. If someone else calls your Voicemail extension,
the caller will be able to leave a message for you.
By default, every extension can call
every other extension. For changing the that or managing outgoing and incoming
calls from outside lines, you will need to set up dial plan rules:
1. If you would like to call telephones in PSTN or GSM
networks, you need to set up Standars connections within
the Outside lines panel, and you also need to set Outbound routing rules
within the Dial plan panel (since the called party is not on the list of Standard extensions in
2. It is also possible that there are incoming calls from
the PSTN or GSM networks. In these cases, you need to add Inbound routing rules
to forward them to any of the extensions.
3. If a call is not answered by the destination and you
wish to forward that to an another extension (for example to a Voicemail), you need to
add new Missed call rules.
4. To be able to send and receive SMS messages, you need
to add new Message routing rules.
Bonus tutorial: How to send
automated greeting SMS for your partners
The following code example demonstrates how
to send an automated [Have a nice day or Happy Birthday] SMS for your customers
by using OzML.
a nice day, Dear Customer!
example 3: Automated SMS sending with OzML
This code example sends the 'Have a nice
day, Dear Customer!' greeting messeage with the <SendSms> OzML command.
Now host your script by using your database.
Voicemail is the best option to be able
to accept all calls incoming while you are out of the office. Due to the OzML
API, it is quite easy to customize your voicemail system based on your sepcific
needs. I have added a short script to my article that presents how to send a
greeting SMS message to your customers in order to wish them a nice day. This code
can also used during any Holidays or as a reminder or alert SMS.