Multilingual Scripting with Cisco CVP Call Studio

One of the most common tasks in IVR application development is making your application support multiple languages, and in my experience there are a lot of platforms out there that don’t necessarily make this the easiest thing to accomplish.  Cisco actually does a fairly good job with this in Unified Call Studio for CVP (Customer Voice Portal), although there are some things you need to do right with your media server deployment in a Comprehensive deployment (ICM + CVP) to make it work how you probably think it should by default (more info on media server setup here).

This article will walk you though how to create a simple application in Call Studio that uses 3 languages and then show you how to setup your media server  so that both your studio app, and microapps invoked from ICM scripting, will be able to find the audio files for each language.

Lets start with the functionality of the studio app:

  1. Caller will hear a menu with 3 options prompting them to select 1 of 3 languages (prompt 1000.wav)
    1. US Spanish (es-US)
    2. Great Britain English (en-GB)
    3. French (fr-FR)
  2. Based on the caller choice we will set the language for the session using an application modifier node
  3. We will play the audio file 2000.wav in the selected language and disconnect the call

Here is what our studio script looks like:

Screenshot 2014-07-04 14.07.32

Now that you understand what our app is supposed to do, let’s take a look at what the application modifier node does when we make a menu choice.  Here are the settings from the first application modifier, which would be reached if we selected option 1 on the menu for US Spanish.  You can see that we are setting the language to a value of ‘es-US’.  What this is really doing is setting a specialized variable in the session context called ‘CallData.LANGUANGE’, which we can later use by adding {CallData.LANGUAGE} via substitution or by using the language tab for audio items in studio itself.

Screenshot 2014-07-04 15.34.08

 

Once you have the language set by the application modifier you can leverage the choice very easily by setting one or more languages in any given audio item right in the studio editor.  This is something that I find most people don’t even know exists, despite the fact that it is one of the most advantageous features of Call Studio when compared to other editors.  The reason that this feature is so useful is that many languages use a varying order for adjectives and nouns or even verbs and nouns, and studio allows you to accomplish that without a lot of complex scripting that makes the script flow itself unreadable.  I will give you an example of what I mean about ordering words; let’s suppose that you have to play back the order of the caller’s favorite color from a database in both english and spanish.  In English you would play back ‘Your favorite color is set to Red’, and this would most likely be accomplished with 2 audio items 1.wav (‘Your favorite color is set to’) and red.wav (‘Red’), but in spanish this would not play the same way.  In spanish you would want to play back ‘actualmente rojo se fija como su color favorito’ (‘currently red is set as your favorite color’ according to google translate) by playing 1.wav (‘actualmente’), red.wav (‘rojo’), and 2.wav (‘se fija como su color favorito’).  While this may be a bad functional example, and probably a terrible translation, you can see that for spanish you need 3 items to tell the caller what you want versus just 2 with english.  You can configure any audio element to provide this dynamic playback by creating language specific tabs in the audio settings.  To create a new language specific set of audio items just right click on an existing tab, such as ‘Default Language’, and choose ‘New Language’.

studio_new_lang_screen_shot

If we take a look at our last audio element in the script, called ‘Audio_01’ we started with we can see that it has 4 language tabs for the audio; ‘Default Language’, es-US, en-GB, and fr-FR. NOTE: the substitution {CallData.LANGUAGE} must be included in the audio path for this to work.  It would be much easier to include this in the default audio path but unfortunately the default audio path does not allow run-time substitution.

Screenshot 2014-07-05 00.49.22

You may be asking yourself where does the ‘Default Language’ get set; it’s set in the properties of the project itself and in our example it would be used if the caller did not enter a choice in the menu or entered invalid choices too many times.   In the sample I provided app you will see that I have the Language set to ‘fr-CA’ for Canadian French.

Screenshot 2014-07-04 16.21.11

Now that we have everything wired-up, I am going to assume that your instincts are screaming “TEST IT, TEST IT!” like any good programmer, so let’s do just that.  Here are the tests we will run in the debugger:

Test 1:

  1. Call the application
  2. Press 1 for US Spanish
  3. Verify that the US Spanish version of 2001.wav is played

Result:

Test 2:

  1. Call the application
  2. Press 3 for France French
  3. Verify that the France French version of 2003.wav is played

Result:
Screenshot 2014-07-05 01.01.09

Test 3:

  1. Call the application
  2. Don’t make a choice at the menu (no input 3 times)
  3. verify that the Canadian French version of 2000.wav is played

Result:
Screenshot 2014-07-05 01.02.50

 

As you can see, we kept the actual flow of script clean and added the needed complexity to playback language specific audio right in the audio element’s configuration.

One thing that I want to point out about the design of the application at this point is that I used varying prompt names for the audio played back in the ‘Audio_01’ element.  I did this simply to make the debugger output easy to follow in the tests, if this were a real-word application I would have likely used 2000.wav for every language’s audio because the path to each file would be unique because of the locale specific directory in the URL.

I hope you found this helpful.   Please feel free to share your thoughts in the comments.  Happy scripting!

You can also download the Call Studio Project used in this post here

Leave a Reply

Your email address will not be published. Required fields are marked *