right  Talk To Us!

Cloud REST Translation Languages

Translation Languages

Use the following language codes in Translation Options.

Language Language code
Afrikaans af
Albanian sq
Amharic am
Arabic ar
Armenian hy
Assamese as
Aymara ay
Azerbaijani az
Bambara bm
Basque eu
Belarusian be
Bengali bn
Bhojpuri bho
Bosnian bs
Bulgarian bg
Catalan ca
Cebuano ceb
Chichewa ny
Chinese (Simplified) zh-CN
Chinese (Traditional) zh-TW
Corsican co
Croatian hr
Czech cs
Danish da
Divehi dv
Dogri doi
Dutch nl
English en
Esperanto eo
Estonian et
Ewe ee
Filipino tl
Finnish fi
French fr
Frisian fy
Galician gl
Ganda lg
Georgian ka
German de
Greek el
Guarani gn
Gujarati gu
Haitian Creole ht
Hausa ha
Hawaiian haw
Hebrew he
Hindi hi
Hmong hmn
Hungarian hu
Icelandic is
Igbo ig
Iloko ilo
Indonesian id
Irish Gaelic ga
Italian it
Japanese ja
Javanese jv
Kannada kn
Kazakh kk
Khmer km
Kinyarwanda rw
Konkani gom
Korean ko
Krio kri
Kurdish (Kurmanji) ku
Kurdish (Sorani) ckb
Kyrgyz ky
Lao lo
Latin la
Latvian lv
Lingala ln
Lithuanian lt
Luxembourgish lb
Macedonian mk
Maithili mai
Malagasy mg
Malay ms
Malayalam ml
Maltese mt
Maori mi
Marathi mr
Meiteilon (Manipuri) mni-Mtei
Mizo lus
Mongolian mn
Myanmar (Burmese) my
Nepali ne
Northern Sotho nso
Norwegian no
Odia (Oriya) or
Oromo om
Pashto ps
Persian fa
Polish pl
Portuguese pt
Punjabi pa
Quechua qu
Romanian ro
Russian ru
Samoan sm
Sanskrit sa
Scots Gaelic gd
Serbian sr
Sesotho st
Shona sn
Sindhi sd
Sinhala si
Slovak sk
Slovenian sl
Somali so
Spanish es
Sundanese su
Swahili sw
Swedish sv
Tajik tg
Tamil ta
Tatar tt
Telugu te
Thai th
Tigrinya ti
Tsonga ts
Turkish tr
Turkmen tk
Twi ak
Ukrainian uk
Urdu ur
Uyghur ug
Uzbek uz
Vietnamese vi
Welsh cy
Xhosa xh
Yiddish yi
Yoruba yo
Zulu zu

Cloud REST API Class Translator

translator

  Available in REST API Version 2 and later.

This represents an AI translator. The AI translator uses Speech Recognition on the inbound audio of the primary and secondary calls of a connect action. The translations of the recognised speech are played simultaneously to both calls using Text-To-Speech (TTS). The translator can also send transcriptions of the recognised speech and the translation played to a results page.

Note that using a translator is a chargeable feature.

Used by action connect

language wrappers and examples

It contains the following properties:

Property Required/Optional Default Description
primary required - A call translation options object that configures how to translate the audio from the primary call.
secondary required - A call translation options object that configures how to translate the audio from the secondary call.
transcription results page optional A web page request object that defines the web page that to receive transcription results. The request to this page happens asynchronously and its response is not considered part of the application flow.
id optional "" A user-defined string that can be used to uniquely identify each particular translator in results sent to the transcription results page.

Transcription Results

Each transcription result has the speech recognised along with the corresponding translation. They are sent to the transcription results page in an action result as they become available. The action in the action result object will be connect.translator

PropertyAvailabilityDescription
transcriptionalwaysAn array of phrase objects representing sequential parts of the recognised speech.
completedalwaystrue or false. true indicates that this is the last result produced by the translator.
idalwaysThe string identifying the translator, as specified in the translator object.

Note that results are not returned to the application directly, but to the results page. A page that receives a transcription result should respond with a 204 response code indicating no content.


  • Examples:


    • Create a translator object:

      	{
      		"primary" : {
      			"speech_recognition_options" : {
      				"language" : "en-GB",
      				"speech_model_options" : {
      					"model" : "latest_long"
      				}
      			},
      			"tts_voice" : "French France Female Polly Lea"
      		},
      		"secondary" : {
      			"speech_recognition_options" : {
      				"language" : "fr-FR",
      				"speech_model_options" : {
      					"model" : "phone_call",
      					"enhanced" : true
      				}
      			},
      			"translation_options": {
      				"source_language" : "fr",
      				"target_language" : "en"
      			},
      			"tts_voice" : "English UK Female Polly Amy"
      		}
      	}
      
    • Create a translator object with transcriptions enabled:

      	{
      		"primary" : {
      			"speech_recognition_options" : {
      				"language" : "en-GB",
      				"speech_model_options" : {
      					"model" : "latest_long"
      				}
      			},
      			"tts_voice" : "French France Female Polly Lea"
      		},
      		"secondary" : {
      			"speech_recognition_options" : {
      				"language" : "fr-FR",
      				"speech_model_options" : {
      					"model" : "phone_call",
      					"enhanced" : true
      				}
      			},
      			"translation_options": {
      				"source_language" : "fr",
      				"target_language" : "en"
      			},
      			"tts_voice" : "English UK Female Polly Amy"
      		},
      		"transcription_results_page" : {
      			"url" : "transcription_results_page"
      		},
      		"id" : "translator1234"
      	}
      

      The following are examples of the results that may be sent to the transcription_results page:

      Primary result:

      "action_result" :
      {
      	"action" : "connect",
      	"result" :
      	{
      		"completed" : false,
      		"id" : "translator1234",
      		"transcription" :
      		[
      			{
      				"alternatives" :
      				[
      					{
      						"confidence" : 0.97,
      						"text" : "hello my friend",
      						"translation" : "bonjour mon ami"
      					}
      				],
      				"call" : "primary",
      				"direction" : "inbound",
      				"final" : true
      			}
      		]
      	}
      }
      

      Secondary result:

      "action_result" :
      {
      	"action" : "connect.translator",
      	"result" :
      	{
      		"completed" : false,
      		"id" : "translator1234",
      		"transcription" :
      		[
      			{
      				"alternatives" :
      				[
      					{
      						"confidence" : 0.97,
      						"text" : "au revoir pour le moment",
      						"translation" : "goodbye for now"
      					}
      				],
      				"call" : "secondary",
      				"direction" : "inbound",
      				"final" : true
      			}
      		]
      	}
      }
      
  • Translator Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    Construct a translator object that represents an AI translator that translates both primary and secondary calls that have been connected by the connect action.

    • public class Translator 
      {
          // Constructors
          public Translator(CallTranslationOptions primaryOptions, CallTranslationOptions secondaryOptions);
      
          // Members
          public string Id;
          public WebPageRequest TranscriptionResultsPage;
      }
      

      Examples:

      • Create a translator object:

        var primaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions(model: "latest_long")
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
        var secondaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions(model: "phone_call", enhanced: true)
            },
            TTSVoice = "English UK Female Polly Amy",
            TranslationOptions = new TranslationOptions(sourceLanguage: "fr", targetLanguage: "en")
        };
        
        var translator = new Translator(primaryOptions, secondaryOptions);
        
      • Create a translator object with transcriptions enabled:

        var primaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions(model: "latest_long")
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
        var secondaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions(model: "phone_call", enhanced: true)
            },
            TTSVoice = "English UK Female Polly Amy",
            TranslationOptions = new TranslationOptions(sourceLanguage: "fr", targetLanguage: "en")
        };
        
        var translator = new Translator(primaryOptions, secondaryOptions)
        {
            TranscriptionResultsPage = new WebPageRequest("transcriptionResultsPage.aspx"),
            Id = "translator1234"
        };
        

        Extract the transcription from the action result:

        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (TranslatorTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var id = transcriptionResult.Id;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var call = phrase.Call;
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                var text = alternative.Text;
                var confidence = alternative.Confidence;
                var translation = alternative.Translation;
                // process final speech result...
            }
        }
        
    • public class Translator 
      {
          // Constructors
          public Translator(CallTranslationOptions primaryOptions, CallTranslationOptions secondaryOptions);
      
          // Members
          public string Id;
          public WebPageRequest TranscriptionResultsPage;
      }
      

      Examples:

      • Create a translator object:

        var primaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions(model: "latest_long")
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
        var secondaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions(model: "phone_call", enhanced: true)
            },
            TTSVoice = "English UK Female Polly Amy",
            TranslationOptions = new TranslationOptions(sourceLanguage: "fr", targetLanguage: "en")
        };
        
        var translator = new Translator(primaryOptions, secondaryOptions);
        
      • Create a translator object with transcriptions enabled:

        var primaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions(model: "latest_long")
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
        var secondaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions(model: "phone_call", enhanced: true)
            },
            TTSVoice = "English UK Female Polly Amy",
            TranslationOptions = new TranslationOptions(sourceLanguage: "fr", targetLanguage: "en")
        };
        
        var translator = new Translator(primaryOptions, secondaryOptions)
        {
            TranscriptionResultsPage = new WebPageRequest("transcriptionResultsPage.aspx"),
            Id = "translator1234"
        };
        

        Extract the transcription from the action result:

        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (TranslatorTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var id = transcriptionResult.Id;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var call = phrase.Call;
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                var text = alternative.Text;
                var confidence = alternative.Confidence;
                var translation = alternative.Translation;
                // process final speech result...
            }
        }
        
    • public class Translator 
      {
          // Constructors
          public Translator(CallTranslationOptions primaryOptions, CallTranslationOptions secondaryOptions);
      
          // Members
          public string Id;
          public WebPageRequest TranscriptionResultsPage;
      }
      

      Examples:

      • Create a translator object:

        var primaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions(model: "latest_long")
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
        var secondaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions(model: "phone_call", enhanced: true)
            },
            TTSVoice = "English UK Female Polly Amy",
            TranslationOptions = new TranslationOptions(sourceLanguage: "fr", targetLanguage: "en")
        };
        
        var translator = new Translator(primaryOptions, secondaryOptions);
        
      • Create a translator object with transcriptions enabled:

        var primaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions(model: "latest_long")
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
        var secondaryOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions(model: "phone_call", enhanced: true)
            },
            TTSVoice = "English UK Female Polly Amy",
            TranslationOptions = new TranslationOptions(sourceLanguage: "fr", targetLanguage: "en")
        };
        
        var translator = new Translator(primaryOptions, secondaryOptions)
        {
            TranscriptionResultsPage = new WebPageRequest("transcriptionResultsPage.aspx"),
            Id = "translator1234"
        };
        

        Extract the transcription from the action result:

        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var transcriptionResult = (TranslatorTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var id = transcriptionResult.Id;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var call = phrase.Call;
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                var text = alternative.Text;
                var confidence = alternative.Confidence;
                var translation = alternative.Translation;
                // process final speech result...
            }
        }
        
  • Translator Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    Construct a translator object that represents an AI translator that translates both primary and secondary calls that have been connected by the connect action.

    • Public Class Translator
          ' Constructors
          Public Sub New (primaryOptions As Calltranslationoptions, secondaryOptions As Calltranslationoptions)
      
          ' Members
          Public Property Id As String
          Public Property TranscriptionResultsPage As Webpagerequest
      End Class
      

      Examples:

      • Create a translator object

        Dim primaryOptions = New CallTranslationOptions With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "en-GB",
                .SpeechModelOptions = New SpeechModelOptions(model:="latest_long")
            },
            .TTSVoice = "French France Female Polly Lea"
        }
        
        Dim secondaryOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "fr-FR",
                .SpeechModelOptions = New SpeechModelOptions(model:="phone_call", enhanced:=True)
            },
            .TTSVoice = "English UK Female Polly Amy",
            .TranslationOptions = New TranslationOptions() With {
                .SourceLanguage = "fr",
                .TargetLanguage = "en"
            }
        }
        
        Dim translator = New Translator(primaryOptions, secondaryOptions)
        
      • Create a translator object with transcriptions enabled

        Dim primaryOptions = New CallTranslationOptions With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "en-GB",
                .SpeechModelOptions = New SpeechModelOptions(model:="latest_long")
            },
            .TTSVoice = "French France Female Polly Lea"
        }
        
        Dim secondaryOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "fr-FR",
                .SpeechModelOptions = New SpeechModelOptions(model:="phone_call", enhanced:=True)
            },
            .TTSVoice = "English UK Female Polly Amy",
            .TranslationOptions = New TranslationOptions() With {
                .SourceLanguage = "fr",
                .TargetLanguage = "en"
            }
        }
        
        Dim translator = New Translator(primaryOptions, secondaryOptions) With {
            .TranscriptionResultsPage = New WebPageRequest("transcriptionResultsPage.aspx"),
            .Id = "1234"
        }
        

        Extract the transcription from the action result:

        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As TranslatorTranscriptionResult = telephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim id = transcriptionResult.Id
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim caller = phrase.Call
            Dim direction = phrase.Direction
            Dim alternatives = phrase.Alternatives
            For Each alternative In alternatives
                Dim Text = alternative.Text
                Dim confidence = alternative.Confidence
                Dim translation = alternative.Translation
                ' process final speech result...
            Next
        Next
        
    • Public Class Translator
          ' Constructors
          Public Sub New (primaryOptions As Calltranslationoptions, secondaryOptions As Calltranslationoptions)
      
          ' Members
          Public Property Id As String
          Public Property TranscriptionResultsPage As Webpagerequest
      End Class
      

      Examples:

      • Create a translator object

        Dim primaryOptions = New CallTranslationOptions With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "en-GB",
                .SpeechModelOptions = New SpeechModelOptions(model:="latest_long")
            },
            .TTSVoice = "French France Female Polly Lea"
        }
        
        Dim secondaryOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "fr-FR",
                .SpeechModelOptions = New SpeechModelOptions(model:="phone_call", enhanced:=True)
            },
            .TTSVoice = "English UK Female Polly Amy",
            .TranslationOptions = New TranslationOptions() With {
                .SourceLanguage = "fr",
                .TargetLanguage = "en"
            }
        }
        
        Dim translator = New Translator(primaryOptions, secondaryOptions)
        
      • Create a translator object with transcriptions enabled

        Dim primaryOptions = New CallTranslationOptions With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "en-GB",
                .SpeechModelOptions = New SpeechModelOptions(model:="latest_long")
            },
            .TTSVoice = "French France Female Polly Lea"
        }
        
        Dim secondaryOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "fr-FR",
                .SpeechModelOptions = New SpeechModelOptions(model:="phone_call", enhanced:=True)
            },
            .TTSVoice = "English UK Female Polly Amy",
            .TranslationOptions = New TranslationOptions() With {
                .SourceLanguage = "fr",
                .TargetLanguage = "en"
            }
        }
        
        Dim translator = New Translator(primaryOptions, secondaryOptions) With {
            .TranscriptionResultsPage = New WebPageRequest("transcriptionResultsPage.aspx"),
            .Id = "1234"
        }
        

        Extract the transcription from the action result:

        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As TranslatorTranscriptionResult = telephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim id = transcriptionResult.Id
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim caller = phrase.Call
            Dim direction = phrase.Direction
            Dim alternatives = phrase.Alternatives
            For Each alternative In alternatives
                Dim Text = alternative.Text
                Dim confidence = alternative.Confidence
                Dim translation = alternative.Translation
                ' process final speech result...
            Next
        Next
        
  • class Translator extends JSONElement

    Represents the Translator support class.

    Class synopsis:

    // Constructors:
    public Translator(CallTranslationOptions primary, CallTranslationOptions secondary)
    
    // Members:
    public void setTranscriptionResultsPage(WebPageRequest resultsPage)
    public void setID(String id)
    
    class TranslatorTranscriptionResult extends TranscriptionResult

    Represents a translator transcription result.

    Class synopsis:

    // Members Inherited from TranscriptionResult:
    public List<Phrase> getTranscription()
    public boolean getCompleted()
    public String getId()
    

    Examples:

    • Create a translator object:

      CallTranslationOptions primaryCTO = new CallTranslationOptions();
      CallTranslationOptions secondaryCTO = new CallTranslationOptions();
      
      {
          SpeechModelOptions speechModelOpts = new SpeechModelOptions();
          speechModelOpts.setModel("latest_long");
          SpeechRecognitionOptions speechRecognitionOpts = new SpeechRecognitionOptions();
          speechRecognitionOpts.setLanguage("en-GB");
          speechRecognitionOpts.setSpeechModelOptions(speechModelOpts);
      
          primaryCTO.setSpeechRecognitionOptions(speechRecognitionOpts);
          primaryCTO.setTTSVoice("French France Female Polly Lea");
      }
      
      {
          SpeechModelOptions speechModelOpts = new SpeechModelOptions();
          speechModelOpts.setModel("phone_call");
          speechModelOpts.setEnhanced(true);
          SpeechRecognitionOptions speechRecognitionOpts = new SpeechRecognitionOptions();
          speechRecognitionOpts.setLanguage("fr-FR");
          speechRecognitionOpts.setSpeechModelOptions(speechModelOpts);
      
          TranslationOptions translationOpts = new TranslationOptions();
          translationOpts.setSourceLanguage("fr");
          translationOpts.setTargetLanguage("en");
      
          secondaryCTO.setSpeechRecognitionOptions(speechRecognitionOpts);
          secondaryCTO.setTranslationOptions(translationOpts);
          secondaryCTO.setTTSVoice("English UK Female Polly Amy");
      }
      
      Translator translator = new Translator(primaryCTO, secondaryCTO);
      
    • Create a translator object with transcriptions enabled:

      CallTranslationOptions primaryCTO = new CallTranslationOptions();
      CallTranslationOptions secondaryCTO = new CallTranslationOptions();
      
      {
          SpeechModelOptions speechModelOpts = new SpeechModelOptions();
          speechModelOpts.setModel("latest_long");
          SpeechRecognitionOptions speechRecognitionOpts = new SpeechRecognitionOptions();
          speechRecognitionOpts.setLanguage("en-GB");
          speechRecognitionOpts.setSpeechModelOptions(speechModelOpts);
      
          primaryCTO.setSpeechRecognitionOptions(speechRecognitionOpts);
          primaryCTO.setTTSVoice("French France Female Polly Lea");
      }
      
      {
          SpeechModelOptions speechModelOpts = new SpeechModelOptions();
          speechModelOpts.setModel("phone_call");
          speechModelOpts.setEnhanced(true);
          SpeechRecognitionOptions speechRecognitionOpts = new SpeechRecognitionOptions();
          speechRecognitionOpts.setLanguage("fr-FR");
          speechRecognitionOpts.setSpeechModelOptions(speechModelOpts);
      
          TranslationOptions translationOpts = new TranslationOptions();
          translationOpts.setSourceLanguage("fr");
          translationOpts.setTargetLanguage("en");
      
          secondaryCTO.setSpeechRecognitionOptions(speechRecognitionOpts);
          secondaryCTO.setTranslationOptions(translationOpts);
          secondaryCTO.setTTSVoice("English UK Female Polly Amy");
      }
      
      WebPageRequest transcriptionResultsPage = new WebPageRequest("transcription_results_page");
      
      Translator translator = new Translator(primaryCTO, secondaryCTO);
      translator.setTranscriptionResultsPage(transcriptionResultsPage);
      translator.setID("translator1234");
      

      Extract the transcription from the action result:

      TranslatorTranscriptionResult transcriptionResult = (TranslatorTranscriptionResult)ourRequest.getInstanceInfo().getActionResult();
      String id = transcriptionResult.getId();
      boolean completed = transcriptionResult.getCompleted();
      List<Phrase> phrases = transcriptionResult.getTranscription();
      
      for (Phrase phrase : phrases)
      {
          String call = phrase.getCall();
          String dir = phrase.getDirection();
          List<Speech> alternatives = phrase.getAlternatives();
      
          for (Speech alternative : alternatives)
          {
              String text = alternative.getText();
              double confidence = alternative.getConfidence();
              String translation = alternative.getTranslation();
      
              /* process text and translation */
          }
      }
      
  • class Translator

    Represents the Translator support class.

    Class synopsis:

    # Translator object:
    Translator(primary, secondary)
    
    # Instance methods:
    Translator.set_transcription_results_page(resultsPage)
    Translator.set_id(id)
    
    Get Translator Transcription Result

    The Translator Transcription Result is represented by a dictionary. It is found within the action result for the transcription results page.

    Obtaining the Translator Transcription Result dictionary:

    my_request = TelephonyRequest(request)
    action_result = my_request.get_action_result()
    if action_result.get("action") == "connect.translator":
        transcription_result =  action_result.get("result")
    

    Examples:

    • Create a translator object:

      primarySMO = SpeechModelOptions()
      primarySMO.set_model("latest_long")
      primarySRO = SpeechRecognitionOptions()
      primarySRO.set_language("en-GB")
      primarySRO.set_speech_model_options(primarySMO)
      primaryCTO = CallTranslationOptions()
      primaryCTO.set_speech_recognition_options(primarySRO)
      primaryCTO.set_tts_voice("French France Female Polly Lea")
      
      secondarySMO = SpeechModelOptions()
      secondarySMO.set_model("phone_call")
      secondarySMO.set_enhanced(True)
      secondarySRO = SpeechRecognitionOptions()
      secondarySRO.set_language("fr-FR")
      secondarySRO.set_speech_model_options(secondarySMO)
      translationOpts = TranslationOptions()
      translationOpts.set_source_language("fr")
      translationOpts.set_target_language("en")
      secondaryCTO = CallTranslationOptions()
      secondaryCTO.set_speech_recognition_options(secondarySRO)
      secondaryCTO.set_translation_options(translationOpts)
      secondaryCTO.set_tts_voice("English UK Female Polly Amy")
      
      translator = Translator(primaryCTO, secondaryCTO)
      
    • Create a translator object with transcriptions enabled:

      primarySMO = SpeechModelOptions()
      primarySMO.set_model("latest_long")
      primarySRO = SpeechRecognitionOptions()
      primarySRO.set_language("en-GB")
      primarySRO.set_speech_model_options(primarySMO)
      primaryCTO = CallTranslationOptions()
      primaryCTO.set_speech_recognition_options(primarySRO)
      primaryCTO.set_tts_voice("French France Female Polly Lea")
      
      secondarySMO = SpeechModelOptions()
      secondarySMO.set_model("phone_call")
      secondarySMO.set_enhanced(True)
      secondarySRO = SpeechRecognitionOptions()
      secondarySRO.set_language("fr-FR")
      secondarySRO.set_speech_model_options(secondarySMO)
      translationOpts = TranslationOptions()
      translationOpts.set_source_language("fr")
      translationOpts.set_target_language("en")
      secondaryCTO = CallTranslationOptions()
      secondaryCTO.set_speech_recognition_options(secondarySRO)
      secondaryCTO.set_translation_options(translationOpts)
      secondaryCTO.set_tts_voice("English UK Female Polly Amy")
      
      translator = Translator(primaryCTO, secondaryCTO)
      
      translator.set_transcription_results_page(WebPage(url='transcription_results_page'))
      translator.set_id("translator1234")
      

      Extract the transcription from the action result:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "connect.translator":
      
          transcription_result = action_result.get("result")
      
          completed = transcription_result.get("completed")
          id = transcription_result.get("id")
          phrases = transcription_result.get("transcription")
      
          for phrase in phrases:
      
              call = phrase.get("call")
              direction = phrase.get("direction")
              alternatives = phrase.get("alternatives")
      
              for alternative in alternatives:
      
                  text = alternative.get("text")
                  confidence = alternative.get("confidence")
                  translation = alternative.get("translation")
                  # process text and translation
      
  • The Translator class

    Introduction

    Represents an AI translator.

    Class synopsis

    class Translator {
    
        /* methods */
        public __construct()
        public self setPrimaryCallTranslationOptions(CallTranslationOptions $opts)
        public self setSecondaryCallTranslationOptions(CallTranslationOptions $opts)
        public self setTranscriptionResultsPage(WebPageRequest|string $results_page, string $method = null)
        public self setID(string $id)
    }
    
    The TranslatorTranscriptionResult class

    Introduction

    Represents a translator transcription result.

    Class synopsis

    class TranslatorTranscriptionResult extends TranscriptionResult {
    
        /* inherited methods */
        public array[Phrase] getTranscription()
        public string getID()
        public boolean getCompleted()
        public string getAction()
        public boolean getInterrupted()
    }
    

    Examples:

    • Create a translator object:

      $translator = new Aculab\TelephonyRestAPI\Translator();
      
      $call_translation_options = new Aculab\TelephonyRestAPI\CallTranslationOptions();
      
      $speech_model_options = new \Aculab\TelephonyRestAPI\SpeechModelOptions();
      $speech_model_options->setModel("latest_long");
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("en-GB");
      $speech_recognition_options->setSpeechModelOptions($speech_model_options);
      $call_translation_options->setSpeechRecognitionOptions($speech_recognition_options);
      $call_translation_options->setTTSVoice("French France Female Polly Lea");
      $translator->setPrimaryCallTranslationOptions($call_translation_options);
      
      $call_translation_options = new Aculab\TelephonyRestAPI\CallTranslationOptions();
      $speech_model_options = new \Aculab\TelephonyRestAPI\SpeechModelOptions();
      $speech_model_options->setModel("phone_call")
          ->setEnhanced(true);
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("fr-FR");
      $speech_recognition_options->setSpeechModelOptions($speech_model_options);
      $translation_options = new Aculab\TelephonyRestAPI\TranslationOptions();
      $translation_options->setSourceLanguage('fr')
          ->setTargetLanguage('en');
      $call_translation_options->setSpeechRecognitionOptions($speech_recognition_options)
          ->setTranslationOptions($translation_options)
          ->setTTSVoice("English UK Female Polly Amy");
      $translator->setSecondaryCallTranslationOptions($call_translation_options);
      
    • Create a translator object with transcriptions enabled:

      $translator = new Aculab\TelephonyRestAPI\Translator();
      
      $call_translation_options = new Aculab\TelephonyRestAPI\CallTranslationOptions();
      
      $speech_model_options = new \Aculab\TelephonyRestAPI\SpeechModelOptions();
      $speech_model_options->setModel("latest_long");
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("en-GB");
      $speech_recognition_options->setSpeechModelOptions($speech_model_options);
      $call_translation_options->setSpeechRecognitionOptions($speech_recognition_options);
      $call_translation_options->setTTSVoice("French France Female Polly Lea");
      $translator->setPrimaryCallTranslationOptions($call_translation_options);
      
      $call_translation_options = new Aculab\TelephonyRestAPI\CallTranslationOptions();
      $speech_model_options = new \Aculab\TelephonyRestAPI\SpeechModelOptions();
      $speech_model_options->setModel("phone_call")
          ->setEnhanced(true);
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("fr-FR");
      $speech_recognition_options->setSpeechModelOptions($speech_model_options);
      $translation_options = new Aculab\TelephonyRestAPI\TranslationOptions();
      $translation_options->setSourceLanguage('fr')
          ->setTargetLanguage('en');
      $call_translation_options->setSpeechRecognitionOptions($speech_recognition_options)
          ->setTranslationOptions($translation_options)
          ->setTTSVoice("English UK Female Polly Amy");
      $translator->setSecondaryCallTranslationOptions($call_translation_options);
      
      $translator->setTranscriptionResultsPage("transcriptionResultsPage")
          ->setID("translator1234");
      

      Extract the transcription from the action result

      $info = \Aculab\TelephonyRestAPI\InstanceInfo::getInstanceInfo();
      
      $transcriptionResult = $info->getActionResult();
      
      $completed = $transcriptionResult->getCompleted();
      $id = $transcriptionResult->getID();
      $phrases = $transcriptionResult->getTranscription();
      foreach($phrases as $phrase) {
          $call = $phrase->getCall();
          $dir = $phrase->getDirection();
          $alternatives = $phrase->getAlternatives();
          foreach($alternatives as $speech) {
              if ($speech) {
                  $text = $speech->getText();
                  $confidence = $speech->getConfidence();
                  $translation = $speech->getTranslation();
                  /* process text and translation */
              }
          }
      }
      

Cloud REST API Class Translation Options

translation options

  Available in REST API Version 2 and later.

This controls how recognised speech is translated.

Used in class call translation options

The language codes are those of the text, such as "en" for English or "es" for Spanish. Use a language code from the Translation Languages page.

Normally, the source language can be determined from the corresponding speech recognition language. However, not all speech recognition languages can be translated.

Similarly, when used in a call translation options object, the target language can usually be derived from the TTS voice used. Some voices can speak more than one language and the default language for the voice will be used unless a target language is specified.
There are also some voices that expect a language that is not supported.

language wrappers and examples

It contains the following properties:

Property Required/Optional Default Description
source language optional - The language code of the source text. The default is based on the language specified in the corresponding speech recognition options.
target language action dependent - The language code to translate the recognised speech in to. When used in a call translation options object, the target language can usually be derived from the TTS voice used. This property is required in other cases.

  • Examples:


    • Create a translation options object with a target language:

          {
              "target_language" : "es"
          }
      
    • Create a translation options object with a source language and a target language:

          {
              "source_language" : "en",
              "target_language" : "es"
          }
      
  • TranslationOptions Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    A class representing the options used to translate between languages and is used by the call translation options object.

    • public class TranslationOptions 
      {
          // Constructors
          public TranslationOptions(string sourceLanguage = null, string targetLanguage = null);
      
          // Members
          public string SourceLanguage;
          public string TargetLanguage;
      }
      

      Examples:

      • Create a translation options object with a target language:

        var translationOptions = new TranslationOptions()
        {
            TargetLanguage = "es"
        };
        
      • Create a translation options object with a source language and a target language:

        var translationOptions = new TranslationOptions()
        {
            SourceLanguage = "en",
            TargetLanguage = "es"
        };
        
    • public class TranslationOptions 
      {
          // Constructors
          public TranslationOptions(string sourceLanguage = null, string targetLanguage = null);
      
          // Members
          public string SourceLanguage;
          public string TargetLanguage;
      }
      

      Examples:

      • Create a translation options object with a target language:

        var translationOptions = new TranslationOptions()
        {
            TargetLanguage = "es"
        };
        
      • Create a translation options object with a source language and a target language:

        var translationOptions = new TranslationOptions()
        {
            SourceLanguage = "en",
            TargetLanguage = "es"
        };
        
    • public class TranslationOptions 
      {
          // Constructors
          public TranslationOptions(string sourceLanguage = null, string targetLanguage = null);
      
          // Members
          public string SourceLanguage;
          public string TargetLanguage;
      }
      

      Examples:

      • Create a translation options object with a target language:

        var translationOptions = new TranslationOptions()
        {
            TargetLanguage = "es"
        };
        
      • Create a translation options object with a source language and a target language:

        var translationOptions = new TranslationOptions()
        {
            SourceLanguage = "en",
            TargetLanguage = "es"
        };
        
  • TranslationOptions Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    A class representing the options used to translate between languages and is used by the call translation options object.

    • Public Class TranslationOptions
          ' Constructors
          Public Sub New (Optional sourceLanguage As String = Nothing, Optional targetLanguage As String = Nothing)
      
          ' Members
          Public Property SourceLanguage As String
          Public Property TargetLanguage As String
      End Class
      

      Examples:

      • Create a translation options object with a target language

        Dim translationOptions = New TranslationOptions(targetLanguage:="es")
        
      • Create a translation options object with a source language and a target language

        Dim translationOptions = New TranslationOptions() With {
            .SourceLanguage = "en",
            .TargetLanguage = "es"
        }
        
    • Public Class TranslationOptions
          ' Constructors
          Public Sub New (Optional sourceLanguage As String = Nothing, Optional targetLanguage As String = Nothing)
      
          ' Members
          Public Property SourceLanguage As String
          Public Property TargetLanguage As String
      End Class
      

      Examples:

      • Create a translation options object with a target language

        Dim translationOptions = New TranslationOptions(targetLanguage:="es")
        
      • Create a translation options object with a source language and a target language

        Dim translationOptions = New TranslationOptions() With {
            .SourceLanguage = "en",
            .TargetLanguage = "es"
        }
        
  • class TranslationOptions extends JSONElement

    Represents the Translation Options support class.

    Class synopsis:

    // Constructors:
    public TranslationOptions()
    
    // Members:
    public void setSourceLanguage(String sourceLanguage)
    public void setTargetLanguage(String targetLanguage)
    

    Examples:

    • Create a translation options object with a target language:

      TranslationOptions translationOpts = new TranslationOptions();
      translationOpts.setTargetLanguage("es");
      
    • Create a translation options object with a source language and a target language:

      TranslationOptions translationOpts = new TranslationOptions();
      translationOpts.setSourceLanguage("en");
      translationOpts.setTargetLanguage("es");
      
  • class TranslationOptions

    Represents the Translation Options support class.

    Class synopsis:

    # TranslationOptions object:
    TranslationOptions()
    
    # Instance methods:
    TranslationOptions.set_source_language(source_language)
    TranslationOptions.set_target_language(target_language)
    

    Examples:

    • Create a translation options object with a target language:

      translationOpts = TranslationOptions()
      translationOpts.set_target_language("es")
      
    • Create a translation options object with a source language and a target language:

      translationOpts = TranslationOptions()
      translationOpts.set_source_language("en")
      translationOpts.set_target_language("es")
      
  • The TranslationOptions class

    Introduction

    Represents the translation options.

    Class synopsis

    class TranslationOptions {
    
        /* methods */
        public __construct()
        public self setSourceLanguage(string $language)
        public self setTargetLanguage(string $language)
    }
    

    Examples:

    • Create a translation options object with a target language:

      $translation_options = new Aculab\TelephonyRestAPI\TranslationOptions();
      $translation_options->setTargetLanguage('es');
      
    • Create a translation options object with a source language and a target language:

      $translation_options = new Aculab\TelephonyRestAPI\TranslationOptions();
      $translation_options->setSourceLanguage('en')
          ->setTargetLanguage('es');
      

Cloud REST API Class Call Translation Options

call translation options

  Available in REST API Version 2 and later.

This controls how call audio is translated.

Its properties define the language that will be recognised, the language it is to be translated into, and the voice that is to be used to say the translated text. For most languages the translation options will be able to default its source language to that used by the speech recognition, and you will only need to specify the target translated language.

Used in class translator


language wrappers and examples

It contains the following properties:

Property Required/Optional Default Description
speech recognition options optional - A speech recognition options object to configure the speech recognition used.
translation options optional - A translation options object to configure the translation of the recognised speech.
tts voice optional set in the service configuration The TTS voice use to say the translated speech. Use a Selector from one of the voice tables on the Text-To-Speech (TTS) page.

  • Examples:


    • Create a call translation options object with translation options:

      	{
      		"speech_recognition_options" : {
      			"language" : "en-GB",
      			"speech_model_options" : {
      				"model": "latest_long"
      			}
      		},
      		"translation_options": {
      			"source_language" : "en",  # language of text generated by speech recognition
      			"target_language" : "fr",  # language to translate to for TTS
      		},
      		"tts_voice" : "French France Female Polly Lea"
      	}
      
    • Create a translation options object with implied translation options:

      	{
      		"speech_recognition_options" : {
      			"language" : "fr-FR",
      			"speech_model_options" : {
      				"model" : "phone_call",
      				"enhanced" : true
      			}
      		},
      		"tts_voice" : "English UK Female Polly Amy"
      	}
      
  • CallTranslationOptions Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    A class representing the call translation recognition options that can be set when translating between two connected calls.

    • public class CallTranslationOptions 
      {
          // Constructors
          public CallTranslationOptions(SpeechRecognitionOptions speechRecognitionOptions = null, TranslationOptions translationOptions = null, string ttsVoice = null);
      
          // Members
          public SpeechRecognitionOptions SpeechRecognitionOptions;
          public TranslationOptions TranslationOptions;
          public string TTSVoice;
      }
      

      Examples:

      • Create a call translation options object specifying the translation options explicitly:

        var callTranslationOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions()
                {
                    Model = "latest_long"
                }
            },
            TranslationOptions = new TranslationOptions()
            {
                SourceLanguage = "en",
                TargetLanguage = "fr"
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
      • Create a call translation options object with implied translation options:

        var callTranslationOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions()
                {
                    Model = "phone_call",
                    Enhanced = true
                }
            },
            TTSVoice = "English UK Female Polly Amy"
        };
        
    • public class CallTranslationOptions 
      {
          // Constructors
          public CallTranslationOptions(SpeechRecognitionOptions speechRecognitionOptions = null, TranslationOptions translationOptions = null, string ttsVoice = null);
      
          // Members
          public SpeechRecognitionOptions SpeechRecognitionOptions;
          public TranslationOptions TranslationOptions;
          public string TTSVoice;
      }
      

      Examples:

      • Create a call translation options object specifying the translation options explicitly:

        var callTranslationOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions()
                {
                    Model = "latest_long"
                }
            },
            TranslationOptions = new TranslationOptions()
            {
                SourceLanguage = "en",
                TargetLanguage = "fr"
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
      • Create a call translation options object with implied translation options:

        var callTranslationOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions()
                {
                    Model = "phone_call",
                    Enhanced = true
                }
            },
            TTSVoice = "English UK Female Polly Amy"
        };
        
    • public class CallTranslationOptions 
      {
          // Constructors
          public CallTranslationOptions(SpeechRecognitionOptions speechRecognitionOptions = null, TranslationOptions translationOptions = null, string ttsVoice = null);
      
          // Members
          public SpeechRecognitionOptions SpeechRecognitionOptions;
          public TranslationOptions TranslationOptions;
          public string TTSVoice;
      }
      

      Examples:

      • Create a call translation options object specifying the translation options explicitly:

        var callTranslationOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "en-GB",
                SpeechModelOptions = new SpeechModelOptions()
                {
                    Model = "latest_long"
                }
            },
            TranslationOptions = new TranslationOptions()
            {
                SourceLanguage = "en",
                TargetLanguage = "fr"
            },
            TTSVoice = "French France Female Polly Lea"
        };
        
      • Create a call translation options object with implied translation options:

        var callTranslationOptions = new CallTranslationOptions()
        {
            SpeechRecognitionOptions = new SpeechRecognitionOptions()
            {
                Language = "fr-FR",
                SpeechModelOptions = new SpeechModelOptions()
                {
                    Model = "phone_call",
                    Enhanced = true
                }
            },
            TTSVoice = "English UK Female Polly Amy"
        };
        
  • CallTranslationOptions Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    A class representing the call translation recognition options that can be set when translating between two connected calls.

    • Public Class CallTranslationOptions
          ' Constructors
          Public Sub New (Optional speechRecognitionOptions As Speechrecognitionoptions = Nothing, Optional translationOptions As Translationoptions = Nothing, Optional ttsVoice As String = Nothing)
      
          ' Members
          Public Property SpeechRecognitionOptions As Speechrecognitionoptions
          Public Property TranslationOptions As Translationoptions
          Public Property TTSVoice As String
      End Class
      

      Examples:

      • Create a call translation options object specifying the translation options explicitly

        Dim callTranslationOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "en-GB",
                .SpeechModelOptions = New SpeechModelOptions(model:="latest_long")
            },
            .TranslationOptions = New TranslationOptions() With {
                .SourceLanguage = "en",
                .TargetLanguage = "fr"
            },
            .TTSVoice = "French France Female Polly Lea"
        }
        
      • Create a call translation options object with implied translation options

        Dim callTranslationOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "fr-FR",
                .SpeechModelOptions = New SpeechModelOptions() With {
                    .Model = "phone_call",
                    .Enhanced = True
                }
            },
            .TTSVoice = "English UK Female Polly Amy"
        }
        
    • Public Class CallTranslationOptions
          ' Constructors
          Public Sub New (Optional speechRecognitionOptions As Speechrecognitionoptions = Nothing, Optional translationOptions As Translationoptions = Nothing, Optional ttsVoice As String = Nothing)
      
          ' Members
          Public Property SpeechRecognitionOptions As Speechrecognitionoptions
          Public Property TranslationOptions As Translationoptions
          Public Property TTSVoice As String
      End Class
      

      Examples:

      • Create a call translation options object specifying the translation options explicitly

        Dim callTranslationOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "en-GB",
                .SpeechModelOptions = New SpeechModelOptions(model:="latest_long")
            },
            .TranslationOptions = New TranslationOptions() With {
                .SourceLanguage = "en",
                .TargetLanguage = "fr"
            },
            .TTSVoice = "French France Female Polly Lea"
        }
        
      • Create a call translation options object with implied translation options

        Dim callTranslationOptions = New CallTranslationOptions() With {
            .SpeechRecognitionOptions = New SpeechRecognitionOptions() With {
                .Language = "fr-FR",
                .SpeechModelOptions = New SpeechModelOptions() With {
                    .Model = "phone_call",
                    .Enhanced = True
                }
            },
            .TTSVoice = "English UK Female Polly Amy"
        }
        
  • class CallTranslationOptions extends JSONElement

    Represents the Call Translation Options support class.

    Class synopsis:

    // Constructors:
    public CallTranslationOptions()
    
    // Members:
    public void setSpeechRecognitionOptions(SpeechRecognitionOptions options)
    public void setTranslationOptions(TranslationOptions options)
    public void setTTSVoice(String ttsVoice)
    

    Examples:

    • Create a call translation options object with translation options:

      SpeechModelOptions speechModelOpts = new SpeechModelOptions();
      speechModelOpts.setModel("latest_long");
      SpeechRecognitionOptions speechRecognitionOpts = new SpeechRecognitionOptions();
      speechRecognitionOpts.setLanguage("en-GB");
      speechRecognitionOpts.setSpeechModelOptions(speechModelOpts);
      TranslationOptions translationOpts = new TranslationOptions();
      translationOpts.setSourceLanguage("en");
      translationOpts.setTargetLanguage("fr");
      
      CallTranslationOptions callTranslationOpts = new CallTranslationOptions();
      callTranslationOpts.setSpeechRecognitionOptions(speechRecognitionOpts);
      callTranslationOpts.setTranslationOptions(translationOpts);
      callTranslationOpts.setTTSVoice("French France Female Polly Lea");
      
    • Create a call translation options object with implied translation options:

      SpeechModelOptions speechModelOpts = new SpeechModelOptions();
      speechModelOpts.setModel("phone_call");
      speechModelOpts.setEnhanced(true);
      SpeechRecognitionOptions speechRecognitionOpts = new SpeechRecognitionOptions();
      speechRecognitionOpts.setLanguage("fr-FR");
      speechRecognitionOpts.setSpeechModelOptions(speechModelOpts);
      
      CallTranslationOptions callTranslationOpts = new CallTranslationOptions();
      callTranslationOpts.setSpeechRecognitionOptions(speechRecognitionOpts);
      callTranslationOpts.setTTSVoice("English UK Female Polly Amy");
      
  • class CallTranslationOptions

    Represents the Call Translation Options support class.

    Class synopsis:

    # CallTranslationOptions object:
    CallTranslationOptions()
    
    # Instance methods:
    CallTranslationOptions.set_speech_recognition_options(options)
    CallTranslationOptions.set_translation_options(options)
    CallTranslationOptions.set_tts_voice(voice)
    

    Examples:

    • Create a call translation options object with translation options:

      speechModelOpts = SpeechModelOptions()
      speechModelOpts.set_model("latest_long")
      speechRecognitionOpts = SpeechRecognitionOptions()
      speechRecognitionOpts.set_language("en-GB")
      speechRecognitionOpts.set_speech_model_options(speechModelOpts)
      translationOpts = TranslationOptions()
      translationOpts.set_source_language("en")
      translationOpts.set_target_language("fr")
      
      callTranslationOpts = CallTranslationOptions()
      callTranslationOpts.set_speech_recognition_options(speechRecognitionOpts)
      callTranslationOpts.set_translation_options(translationOpts)
      callTranslationOpts.set_tts_voice("French France Female Polly Lea")
      
    • Create a call translation options object with implied translation options:

      speechModelOpts = SpeechModelOptions()
      speechModelOpts.set_model("phone_call")
      speechModelOpts.set_enhanced(True)
      speechRecognitionOpts = SpeechRecognitionOptions()
      speechRecognitionOpts.set_language("fr-FR")
      speechRecognitionOpts.set_speech_model_options(speechModelOpts)
      
      callTranslationOpts = CallTranslationOptions()
      callTranslationOpts.set_speech_recognition_options(speechRecognitionOpts)
      callTranslationOpts.set_tts_voice("English UK Female Polly Amy")
      
  • The CallTranslationOptions class

    Introduction

    Represents the call translation options.

    Class synopsis

    class CallTranslationOptions {
    
        /* methods */
        public __construct()
        public self setSpeechRecognitionOptions(SpeechRecognitionOptions $opts)
        public self setTranslationOptions(TranslationOptions $opts)
        public self setTTSVoice(string $tts_voice)
    }
    

    Examples:

    • Create a call translation options object with translation options:

      $call_translation_options = new Aculab\TelephonyRestAPI\CallTranslationOptions();
      
      $speech_model_options = new \Aculab\TelephonyRestAPI\SpeechModelOptions();
      $speech_model_options->setModel("latest_long");
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("en-GB");
      $speech_recognition_options->setSpeechModelOptions($speech_model_options);
      $call_translation_options->setSpeechRecognitionOptions($speech_recognition_options);
      
      $translation_options = new Aculab\TelephonyRestAPI\TranslationOptions();
      $translation_options->setSourceLanguage('en')
          ->setTargetLanguage('fr');
      $call_translation_options->setTranslationOptions($translation_options);
      
      $call_translation_options->setTTSVoice("French France Female Polly Lea");
      
    • Create a translation options object with implied translation options:

      $call_translation_options = new Aculab\TelephonyRestAPI\CallTranslationOptions();
      $speech_model_options = new \Aculab\TelephonyRestAPI\SpeechModelOptions();
      $speech_model_options->setModel("phone_call")
          ->setEnhanced(true);
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("fr-FR");
      $speech_recognition_options->setSpeechModelOptions($speech_model_options);
      $call_translation_options->setSpeechRecognitionOptions($speech_recognition_options);
      $call_translation_options->setTTSVoice("English UK Female Polly Amy");
      

Cloud Guides Translation

Translation

Overview

When connecting together two parties who speak different languages using the Connect action, Aculab Cloud can provide accurate live audio translation between the two calls.

When enabled, each utterance made on either of the connected primary or secondary calls will be heard by the far end. At the same time it will also be transcribed using natural language speech recognition, translated into a different language using neural machine translation, then when the original utterance is completed the translation will be played to both parties using Text To Speech (TTS). You specify the language being spoken on each call and control how you want the translated audio to be played back to the other call.

audio to audio translation diagram

As the speech from either party is translated and played back, transcriptions of both the recognised speech and the translated speech are produced and sent to a specified page.

Speech Recognition Models

Google Speech-to-Text defines a number of models that have been trained from millions of examples of audio from specific sources, for example phone calls or videos. Recognition accuracy can be improved by using the specialized model that relates to the kind of audio data being analysed.

For example, the phone_call model used on audio data recorded from a phone call will produce more accurate transcription results than the default, command_and_search, or video models.

Premium models

Google have made premium models available for some languages, for specific use cases (e.g. medical_conversation). These models have been optimized to more accurately recognise audio data from these specific use cases. See Speech Recognition Languages to see which premium models are available for your language.

Languages

Currently, our Translation supports over 130 languages. For the up to date list, see Translation Languages.

Depending on the languages spoken on each call, you may only need to set the speech recognition language, the target language of the translation and the TTS voice used to say the translated text. For cases where there are different variations of a language for speech recognition and translation you may need to override all the defaults.

Charging

On a trial account you can start using Connect with translation straight away.

Our Translation is charged per minute with 15 second granularity. So, for example:

  • A connect which provides translations between two calls for 49 seconds will be charged for 60 seconds, for each side of the connect.
  • A connect which translates between two calls for 3 minutes 20 seconds will be charged for 3 minutes and 30 seconds for each side of the connect.

Irrespective of how much is said on each call.

You can obtain detailed charge information for a specific call using the Application Status web service. You can obtain detailed charge information for calls over a period of time using the Managing Reports web services. Note that there will be two entries in the Feature Data Record (FDR), one for each side of the connect.

Archive

The Aculab blog

News, views and industry insights from Aculab

  • The End of the PSTN in the US

    As the technical world has evolved, so has the way we communicate. The gradual, global transition away from the Public Switched Telephone Network (PSTN) is the most noticeable change in recent years. This begs the question, is the PSTN in the US headed towards a slow end as we transition into the digital era?

    Continue reading

  • Revolutionising the Landscape of Remote Authentication

    In a time where borders blur and workplaces extend beyond the confines of traditional offices, the significance of remote authentication has taken centre stage. As we advance, so does the need for secure and efficient ways to verify and authenticate our identity remotely. Finding the balance between security and user convenience is key when seeking to implement successful remote authentication.

     

    Continue reading

  • Choosing The Ideal Communication Platform: Key Considerations to Optimise Your Business

    Communication Platforms as a Service have become a necessity in the current digital age; allowing businesses to obtain frictionless means of communicating effectively. However, as technology rapidly evolves, so must communications. Much of the platforms on offer today are homogenous, so choosing the best fit for your business can be difficult. In this blog, we have shared some key points and trends for to consider, so your business can amplify communications and increase operational efficiency!

     

    Continue reading

  • 10 questions people are asking about The Big Switch Off

    With The Big Switch Off fast approaching, people naturally have questions and concerns ahead of the shutdown. The transition from conventional networks to digital technology is unavoidable in the fast-evolving world of telecommunications. In this blog, we address ten common questions people have about the Big PSTN Switch Off, shedding light on the topic and providing clarity.

     

    Continue reading

  • 3 Ways Your Business Can Benefit From a Communications Platform as a Service

    Acquiring a Communications Platform as a Service has become a very common trend for a variety of businesses in recent years. Even with AI and all the technological advancements that have been achieved, the world has come to realise that exceptional customer service is at the core of running and maintaining a successful business. So, we have identified a few ways in which a CPaaS could benefit your business!

    Continue reading