Build Voice Mail with IVR Builder
Author Image

By: Aivis Olsteins

In News

2019-03-07

1 Comments

IVR Builder Introduction - Next Steps

IVR Builder tutorial #2 - add a playback functionality to simple Voice Mail system

In the previous post related to IVR Builder I showed quick example how to create a simple voice mail application with few quick commands. This is not the most sophisticated thing in the world, however gives some basic idea of how IVR Builder works. It shows how to use some basic building blocks like:

  • Text to speech;
  • Voice recording;
  • Sending email with recordings attached.

Let's extend it a liite bit more: lets allow us (the owner of the mailbox) to dial in, browse the messages, listen to them and to optionally delete them.

First I want to introduce two data types we have in IVR Builder and which will be handy: arrays and objects.

  1. Arrays. Pretty much resemble Arrays is Javascript: useful to store multiple values in one value. Like this: var fruits= ["apple", "banana", "orange"];. Also, like in Javascript, you can retrieve any of them by its index (starting from 0 of course): fruits[1] will be "banana".
  2. Objects. Somehow silimar to Objects in Javascipt as well. Useful to define a set of properties of something (well, an object) which has them. Like this: var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}; (example from the link).

Both of these types are useful also because IVR Builder can store them directly into it's local database where it can be retrieved by later action, for example, when the owner of the mail box dials in to listen for the messages.

These two types will be useful because we will use them to store information about each call: caller Id and location of the recording.

Let's reuse our previous piece of code from the previous post of download it directly from here. Remember, you can upload it into IVR Builder and continue editing in place.

Here are the steps we will do once user has left the voice mail:

  1. Create an object of the call, with caller_id and recording file name as their properties: var $msg_obj = {'filename':$recording,'caller':$caller};
  2. Generate random ID for the call, so we have a key under which the message is stored.
  3. Write the call object into local database, with the key generated in step 2.
  4. We also need to write a key in a separate array (let's call is 'messages' so we know how many messages we have and what are they keys). Let's retrive it from the database first.
  5. Append the key which we genarated in step 2 to the arry from step 4
  6. Store the new array in the database , with the same name 'messages'.

The additional blocks look like this:

{$image1}

Now we should make a separate functionality for an owner of the mailbox. For sake of simplicity in this example we will identify them by caller ID. That is not, however, recommended in production systems, because caller ID can be easily spoofed. Password protection at least is recommended.

Enter IF block:

{$image2}

Inside of this block we will do all actions needed to replay voice mail:

  1. Perhaps play some welcome message (use TTS, as shown earlier)
  2. Retrieve an array of message IDs from the storage. Remember, we agreed array will be named 'messages'
  3. Now use FOR block to loop over each of the elements in the array. They are essentialy Ids of individual messages, so for each of them we can:
    1. Retrieve message object by its key
    2. Get the Caller ID which we stored uder attribute 'caller' (see above, recording, step 1)
    3. Synthesize TTS message which can play caller ID. Hint: use say_as="digits" to play numbers digit by digit rather than whole numbers
    4. Get the location of the message file from 'filename' attribute and use it in Play File step.
  4. End it here.

{$image3}

That is basically it. A very simple voice mail with access and playback which we got working by adding a dozen of blocks.

As always if something does not work or you have difficulties to understand thsi guide, you are welcome to ask our Support and we will be happy to help you anytime.

If you have difficulties building tis flow, you can download it from our IVR Flows collection in our Documentation page. Just use "Import Flow" in your flows section to upload it.

 

 

 

Comments
Leave a comment
About Author
Author Image
My name is Aivis Olsteins and I am owner of DataTechLabs. My experience in Telecoms started in early 1990's and I have worked in multiple technical positions in mobile, messaging and data networks. My expertise lies in telecom networks, database systems, distributed processing and large data analysis. These posts are my attempt to share my knowledge with everyone who might find it useful.

Get in Touch

If you have something to say, please use the contact form below to get in touch with us. We will get back to you as soon as possible.

Mail Us

DataTechLabs SIA, Muzikas str 12A
Jurmala, LV-2008, Latvia.

Call Us

+371 67 66 09 01
+ 1 202 499 1550

E-mail Us

info@datatechlabs.com
support@datatechlabs.com