Highlight a phrase and click this icon to search it on Swyx-Forum    Highlight a phrase and click this icon to search it within the Swyx Knowledgebase    Highlight a phrase and click this icon to search it using Goolge    Highlight a phrase and click this icon to search it using Wikipedia

List of Blogs
Search Blogs

Blog Archive

Most recent blog entries

 

Jan6

Written by:Tom Wellige
Donnerstag, 6. Januar 2011 15:47 

Once in a while it happens that I need my call routing script to be able to play announcements in different languages, depending on the caller’s location.

With this article series I want to provide some best practice for how to handle such requirements. Part 1 will deal with own announcements (self recorded), Part 2 which will follow soon will deal with system announcements (being provided by SwyxWare, like dates, times or numbers).

Multi language own announcements

Within Graphical Script Editor (GSE) blocks like Play Announcement or Get DTMF Char you can define a WAV file to be played. This WAV files needs of course to be pre-recorded and available for SwyxServer in the Swyx database. If you need just one language to be supported you can directly record the announcements from within the GSE and select them from a drop-down list. This is the most easiest way, but also the most inflexible one.

If you need to support different languages depending on the caller’s location you have to use a much more flexible attempt to be able to select the language / wav files at run time of the script.

The following example is a very simple call routing script playing a welcome announcement at the beginning and providing afterwards an ivr/dtmf menu to select a destination the call should be connected to.

 

multi_lang_part1_pic1

(click to enlarge)

 

Two announcements are used in this script, the welcome announcement and the announcement within the Get DTMF Char block to explain the usage of the menu:

  • 01_welcome.wav
  • 02_menu.wav

 

The script should be able to handle 5 different languages

  • German for calls from Germany and Austria
  • French for calls from France
  • Dutch for calls from the Netherlands
  • Italian for calls from Italy and
  • English for calls from any other country plus for calls without number signaling

Of course this would be a perfect moment to start arguing about countries like Switzerland or Belgium which are multi-language themselves. To keep it simple I simply ignore these countries, meaning they will get English announcements.

 

So before start scripting you need to prepare the two announcements in all of the mentioned languages and load them in the script users User Scope within the SwyxWare database. If you are not familiar with this you can take a look into the Open Queue manual here from the Swyx Forum website. It explains in chapter 3.1.2.1 how to use the IpPbx File Explorer.

  • 01_welcome_de.wav
  • 01_welcome_fr.wav
  • 01_welcome_nl.wav
  • 01_welcome_it.wav
  • 01_welcome_en.wav
  • 02_menu_de.wav
  • 02_menu_fr.wav
  • 02_menu_nl.wav
  • 02_menu_it.wav
  • 02_menu_en.wav

 

Once this is done we can start scripting…

Within the two blocks we are not using hard coded filenames any more but instead global variables to take the filenames from. These two variables need to be defined on the Parameter page of the Start block:

   1:  
   2: Dim s01_Welcome
   3: Dim s02_Menu
   4:  

 

Within the two blocks Play Announcement and Get DTMF Char we will use these variables now:

multi_lang_part1_pic2multi_lang_part1_pic3

(click to enlarge)

 

Finally we need to write a little bit of VBScript code that identifies the the caller’s location and sets the correct filenames into the two variables. This should be done in a VBScript function which needs to be defined also on the Parameter page of the Start block:

 

   1:  
   2: Dim s01_Welcome
   3: Dim s02_Menu
   4:  
   5: Function InitLanguages
   6:
   7:     PBXScript.OutputTrace "----> InitLanguages"
   8:
   9:Dim sCountryCode
  10:     sCountryCode = "0044" ' United Kingdom, Default Langauge English
  11:
  12:If Len(IpPbx.CallingNumber) > 4 then sCountryCode = Left(IpPbx.CallingNumber, 4)
  13:
  14:     PBXScript.OutputTrace "sCountryCode = " & sCountryCode
  15:
  16:Select Case sCountryCode
  17:
  18:Case "0049" ' Germany
  19:             s01_Welcome = "01_welcome_de.wav"
  20:             s02_Menu    = "02_menu_de.wav"
  21: 
  22:Case "0043" ' Austria
  23:             s01_Welcome = "01_welcome_de.wav"
  24:             s02_Menu    = "02_menu_de.wav"
  25:
  26:Case "0033" ' France
  27:             s01_Welcome = "01_welcome_fr.wav"
  28:             s02_Menu    = "02_menu_fr.wav"
  29:
  30:Case "0031" ' The Netherlands
  31:             s01_Welcome = "01_welcome_nl.wav"
  32:             s02_Menu    = "02_menu_nl.wav"
  33:
  34:Case "0039" ' Italy
  35:             s01_Welcome = "01_welcome_it.wav"
  36:             s02_Menu    = "02_menu_it.wav"
  37:
  38:Case "0044" ' United Kingdom
  39:             s01_Welcome = "01_welcome_en.wav"
  40:             s02_Menu    = "02_menu_en.wav"
  41:
  42:Case Else ' Every other country / no caller number signaled
  43:             s01_Welcome = "01_welcome_en.wav"
  44:             s02_Menu    = "02_menu_en.wav"
  45:
  46:End Select
  47:  
  48:     PBXScript.OutputTrace "s01_Welcome = " & s01_Welcome
  49:     PBXScript.OutputTrace "s02_Menu = " & s02_Menu
  50:  
  51:     PBXScript.OutputTrace "<---- InitLanguages"
  52:  
  53: End Function
  54:  
  55: InitLanguages

 

 

By calling our function at the end of the code definition the script becomes self-initializing.

If you need to identify more languages / countries the following page provides you with the needed country codes:

 

If you need some other default language all you have to do is to modify the lines 10, 43 and 44.

 

Feel free to give any feedback via the comment function of the blog.

 

 

Tags:

 

1 comment(s) so far...

Re: Best practice for multi-language call routing scripts (Part 1)

Hi Tom,

thank you for pointing me to this article. I have modified your script to our needs. But somehow I feel uncomfortable to ignore domestic or local calls in the selection of languages. Please find below my code. Do you have any good idea how I could manage to set announcement to German for callers displaying "0X" or even no "0" as the first digit?


Dim s01_Not-at-desk
Dim s02_Busy
Dim s03_Business_Hours
Dim s04_Out-of-office
Dim s05_Options
Dim s06_Failure

Function InitLanguages

PBXScript.OutputTrace "----> InitLanguages"
Dim sCountryCode

sCountryCode = "0044" ' UK, Default Language English

If Len(IpPbx.CallingNumber) > 4 then sCountryCode = Left(IpPbx.CallingNumber, 4)

PBXScript.OutputTrace "sCountryCode = " & sCountryCode


Select Case sCountryCode

Case "0049" ' Germany

s01_Not-at-desk = "MHo_01_Not-at-desk_de.wav"
s02_Busy = "MHo_02_Busy_de.wav"
s03_Business_Hours = "MHo_03_Business_Hours_de.wav"
s04_Out-of-office = "MHo_04_Out-of-office_de.wav"
s05_Options = "MHo_05_Options_de.wav"
s06_Failure = "MHo_06_Failure_de.wav"

Case "0043" ' Austria

s01_Not-at-desk = "MHo_01_Not-at-desk_de.wav"
s02_Busy = "MHo_02_Busy_de.wav"
s03_Business_Hours = "MHo_03_Business_Hours_de.wav"
s04_Out-of-office = "MHo_04_Out-of-office_de.wav"
s05_Options = "MHo_05_Options_de.wav"
s06_Failure = "MHo_06_Failure_de.wav"

Case "0041" ' Switzerland

s01_Not-at-desk = "MHo_01_Not-at-desk_de.wav"
s02_Busy = "MHo_02_Busy_de.wav"
s03_Business_Hours = "MHo_03_Business_Hours_de.wav"
s04_Out-of-office = "MHo_04_Out-of-office_de.wav"
s05_Options = "MHo_05_Options_de.wav"
s06_Failure = "MHo_06_Failure_de.wav"


Case Else ' Every other country / no caller number signaled

s01_Not-at-desk = "MHo_01_Not-at-desk_en.wav"
s02_Busy = "MHo_02_Busy_en.wav"
s03_Business_Hours = "MHo_03_Business_Hours_en.wav"
s04_Out-of-office = "MHo_04_Out-of-office_en.wav"
s05_Options = "MHo_05_Options_en.wav"
s06_Failure = "MHo_06_Failure_en.wav"

End Select

PBXScript.OutputTrace "s01_Not-at-desk = " & s01_Not-at-desk
PBXScript.OutputTrace "s02_Busy = " & s02_Busy
PBXScript.OutputTrace "s03_Business_Hours = " & s03_Business_Hours
PBXScript.OutputTrace "s04_Out-of-office = " & s04_Out-of-office
PBXScript.OutputTrace "s05_Options = " & s05_Options
PBXScript.OutputTrace "s06_Failure = " & s06_Failure

PBXScript.OutputTrace "<---- InitLanguages"

End Function

InitLanguages

By Hopke on  Freitag, 27. Januar 2012 12:09

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Title:
Comment:
Add Comment  Cancel 
Blog Help
Sponsors