start transcription Action

  Introduced in REST API Version 2.0

Starts transcribing the current call, sending the results to a specified results page. You can specify the language spoken on the call and you can request interim results for each phrase.

Note that speech recognition/transcription is a chargeable feature.

language wrappers and examples

The start transcription properties are:

PropertyRequired/OptionalDefaultDescription
results pagerequiredA web page request object that defines the web page that is going to receive the transcription results and any interim results if they are enabled. The request to this page happens asynchronously and its response is not considered part of the application flow.
transcription modeoptionalseparateOne of separate, mixed, inbound, outbound. How the inbound and outbound audio is transcribed. For modes other than mixed the inbound and/or outbound transcription results contain a property indicating direction. For inbound and outbound, only the specified direction of audio is transcribed.
idoptional""A user-defined string that can be used to uniquely identify each particular transcription.
speech recognition optionsoptional-A speech recognition options object that sets the language for the call and other options related to speech recognition.
enable interim resultsoptionalfalseWhether the transcription will send interim results before it has finalised recognition of each phrase.

Remarks

Only one transcription can be running at any one time in an application. If a transcription is running already a start transcription action will stop that transcription and start a new one.

Returns

The start transcription action has no return. The next action in the list will be run when start transcription completes.

Results

Each transcription result is sent to the results page in an action result as it becomes available.

Final transcription results (final = true) are sent to the results page when the speech recognition has finalised each phrase spoken. If interim results are enabled then additional results (final = false) are sent to the same page while the speech recognition is analysing each phrase.

PropertyAvailabilityDescription
transcriptionalwaysAn array of phrase objects representing sequential parts of the recognised speech. If transcription mode is in anything other than mixed then each phrase is labelled as either inbound or outbound. If enable interim results has been enabled then interim results (final = false) will be returned, concluding with a final result (final = true).
completedalwaystrue or false. true indicates that this is the last result of the transcription.
idalwaysThe string identifying the transcription, as specified in the start transcription action.

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:

    • Start transcribing both sides of the call separately in US English using defaults:

      "start_transcription": 
      {
          "results_page":
          {
              "url" : "my_transcription_results_page"
          }
      }
      

      The following is an example of the first three of a series of results that may be sent to the results page:

      Outbound result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "hello which department would you like",
      						"confidence" : 0.91
      					}
      				],
      				"final" : true,
      				"direction" : "outbound"
      			}
      		],
      		"completed" : false,
      		"id" : ""
      	}
      }
      

      Inbound result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "sales please",
      						"confidence" : 0.93
      					}
      				],
      				"final" : true,
      				"direction" : "inbound"
      			}
      		],
      		"completed" : false,
      		"id" : ""
      	}
      }
      

      Outbound result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "I'm putting you through now",
      						"confidence" : 0.94
      					}
      				],
      				"final" : true,
      				"direction" : "outbound"
      			}
      		],
      		"completed" : false,
      		"id" : ""
      	}
      }
      
    • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

      "start_transcription" :
      {
          "results_page" :
          {
              "url" : "my_transcription_results_page"
          },
      	"id" : "conv123",
      	"speech_recognition_options" : 
      	{
      		"language" : "en-GB"
      	},
      	"enable_interim_results" : true
      }
      

      The following is an example of a series of results that may be sent to the results page:

      Interim result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "hello"
      					}
      				],
      				"final" : false,
      				"stability" : 0.28,
      				"direction" : "outbound"
      			}
      		],
      		"id" : "conv123",
      		"completed" : false
      	}
      }
      

      Final result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "hello",
      						"confidence" : 0.94
      					}
      				],
      				"final" : true,
      				"direction" : "outbound"
      			}
      		],
      		"id" : "conv123",
      		"completed" : false
      	}
      }
      

      Interim result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "which department"
      					}
      				],
      				"final" : false,
      				"stability" : 0.15,
      				"direction": "outbound"
      			}
      		],
      		"id" : "conv123",
      		"completed" : false
      	}
      }
      

      Interim result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "which department would you like"
      					}
      				],
      				"final" : false,
      				"stability" : 0.18,
      				"direction" : "outbound"
      			}
      		],
      		"id" : "conv123",
      		"completed" : false
      	}
      }
      

      Final result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "which department would you like",
      						"confidence" : 0.92
      					}
      				],
      				"final" : true,
      				"direction" : "outbound"
      			}
      		],
      		"id" : "conv123",
      		"completed" : false
      	}
      }
      
    • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

      "start_transcription" :
      {
          "results_page" :
          {
      		"url" : "my_transcription_results_page"
          },
      	"id" : "conv5",
      	"transcription_mode" : "inbound",
      	"speech_recognition_options" : 
      	{
      		"max_alternatives" : 2
      	},
      	"enable_interim_results" : true
      }
      

      The following is an example of a series of results that may be sent to the results page:

      Interim result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "my"
      					}
      				],
      				"final" : false,
      				"stability" : 0.18,
      				"direction" : "inbound"
      			}
      		],
      		"id" : "conv5",
      		"completed" : false
      	}
      }
      

      Interim result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "my account"
      					},
      					{
      						"text" : "my count"
      					}
      				],
      				"final" : false,
      				"stability" : 0.13,
      				"direction" : "inbound"
      			}
      		],
      		"id" : "conv5",
      		"completed" : false
      	}
      }
      

      Interim result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "my account please"
      					},
      					{
      						"text" : "my account police"
      					}
      				],
      				"final" : false,
      				"stability" : 0.19,
      				"direction" : "inbound"
      			}
      		],
      		"id" : "conv5",
      		"completed" : false
      	}
      }
      

      Final result:

      "action_result" :
      {
      	"action" : "start_transcription",
      	"result" :
      	{   
      		"transcription" : 
      		[
      			{
      				"alternatives" : 
      				[
      					{
      						"text" : "my account please",
      						"confidence" : 0.92
      					},
      					{
      						"text" : "my account police"
      					}
      				],
      				"final" : true,
      				"direction": "inbound"
      			}
      		],
      		"id" : "conv5",
      		"completed" : false
      	}
      }
      
  • StartTranscription Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    An action to start transcribing the current call and send results to the specified results page.

    • public class StartTranscription : TelephonyAction
      {
          // Constructors
          public StartTranscription(WebPageRequest resultsPage, SpeechRecognitionOptions options = null, string id = "");
      
          // Members
          public WebPageRequest ResultsPage;
          public string Id;
          public TranscriptionMode? TranscriptionMode;
          public SpeechRecognitionOptions SpeechRecognitionOptions;
          public bool? EnableInterimResults;
      }
      

      Examples:

      • Start transcribing both sides of the call separately in US English using defaults:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"));
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
      • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var speechOptions = new SpeechRecognitionOptions("en-GB");
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions, id: "conv123");
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var id = transcriptionResult.Id;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
      • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var speechOptions = new SpeechRecognitionOptions
        {
            MaxAlternatives = 2
        };
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions);
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
    • public class StartTranscription : TelephonyAction
      {
          // Constructors
          public StartTranscription(WebPageRequest resultsPage, SpeechRecognitionOptions options = null, string id = "");
      
          // Members
          public WebPageRequest ResultsPage;
          public string Id;
          public TranscriptionMode? TranscriptionMode;
          public SpeechRecognitionOptions SpeechRecognitionOptions;
          public bool? EnableInterimResults;
      }
      

      Examples:

      • Start transcribing both sides of the call separately in US English using defaults:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"));
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
      • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var speechOptions = new SpeechRecognitionOptions("en-GB");
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions, id: "conv123");
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var id = transcriptionResult.Id;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
      • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var speechOptions = new SpeechRecognitionOptions
        {
            MaxAlternatives = 2
        };
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions);
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = new TelephonyRequest(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
    • public class StartTranscription : TelephonyAction
      {
          // Constructors
          public StartTranscription(WebPageRequest resultsPage, SpeechRecognitionOptions options = null, string id = "");
      
          // Members
          public WebPageRequest ResultsPage;
          public string Id;
          public TranscriptionMode? TranscriptionMode;
          public SpeechRecognitionOptions SpeechRecognitionOptions;
          public bool? EnableInterimResults;
      }
      

      Examples:

      • Start transcribing both sides of the call separately in US English using defaults:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"));
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
      • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var speechOptions = new SpeechRecognitionOptions("en-GB");
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions, id: "conv123");
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var id = transcriptionResult.Id;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
      • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

        List<TelephonyAction> actions = new List<TelephonyAction>();
        
        var speechOptions = new SpeechRecognitionOptions
        {
            MaxAlternatives = 2
        };
        var startTranscription = new StartTranscription(new WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions);
        actions.Add(startTranscription);
        

        Extract the transcription from the action result:

        // Unpack the request
        var telephonyRequest = await TelephonyRequest.UnpackRequestAsync(Request);
        
        var transcriptionResult = (StartTranscriptionResult)telephonyRequest.InstanceInfo.ActionResult;
        var completed = transcriptionResult.Completed;
        var phrases = transcriptionResult.Transcription;
        foreach (var phrase in phrases)
        {
            var direction = phrase.Direction;
            var alternatives = phrase.Alternatives;
            foreach (var alternative in alternatives)
            {
                if (phrase.Final)
                {
                    var text = alternative.Text;
                    var confidence = alternative.Confidence;
                    // process final speech result...
                }
                else
                {
                    var stability = phrase.Stability;
                    var text = alternative.Text;
                    // process interim speech result...
                }
            }
        }
        
  • StartTranscription Class
    Namespace: Aculab.Cloud.RestAPIWrapper
    Assembly: Aculab.Cloud.RestAPIWrapper.dll

    An action to start transcribing the current call and send results to the specified results page.

    • Public Class StartTranscription
          Inherits TelephonyAction
      
          ' Constructors
          Public Sub New (resultsPage As Webpagerequest, Optional options As Speechrecognitionoptions = Nothing, Optional id As String = "")
      
          ' Members
          Public Property ResultsPage As Webpagerequest
          Public Property Id As String
          Public Property TranscriptionMode As Transcriptionmode?
          Public Property SpeechRecognitionOptions As Speechrecognitionoptions
          Public Property EnableInterimResults As Bool?
      End Class
      

      Examples:

      • Start transcribing both sides of the call separately in US English using defaults:

        Dim actions = New List(Of TelephonyAction)
        
        Dim startTranscription = New StartTranscription(New WebPageRequest("MyTranscriptionResultsPage.aspx"))
        actions.Add(startTranscription)
        

        Extract the transcription from the action result:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As StartTranscriptionResult = telephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim direction = Phrase.Direction
            Dim alternatives = Phrase.Alternatives
            For Each alternative In alternatives
                If phrase.Final Then
                    Dim text = alternative.Text
                    Dim confidence = alternative.Confidence
                    ' process final speech result...
                Else
                    Dim stability = phrase.Stability
                    Dim text = alternative.Text
                    ' process interim speech result...
                End If
            Next
        Next
        
      • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

        Dim actions = New List(Of TelephonyAction)
        
        Dim speechOptions = New SpeechRecognitionOptions("en-GB")
        Dim startTranscription = New StartTranscription(New WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions, id:="conv123")
        actions.Add(startTranscription)
        

        Extract the transcription from the action result:

        ' Unpack the request
        Dim TelephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As StartTranscriptionResult = TelephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim ID = transcriptionResult.Id
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim direction = Phrase.Direction
            Dim alternatives = phrase.Alternatives
            For Each alternative In alternatives
                If phrase.Final Then
                    Dim text = alternative.Text
                    Dim confidence = alternative.Confidence
                    ' process final speech result...
                Else
                    Dim stability = phrase.Stability
                    Dim text = alternative.Text
                    ' process interim speech result...
                End If
            Next
        Next
        
      • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

        Dim actions = New List(Of TelephonyAction)
        
        Dim speechOptions = New SpeechRecognitionOptions
        speechOptions.MaxAlternatives = 2
        
        Dim startTranscription = New StartTranscription(New WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions)
        actions.Add(startTranscription)
        

        Extract the transcription from the action result:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As StartTranscriptionResult = telephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim direction = phrase.Direction
            Dim alternatives = phrase.Alternatives
            For Each alternative In alternatives
                If phrase.Final Then
                    Dim text = alternative.Text
                    Dim confidence = alternative.Confidence
                    ' process final speech result...
                Else
                    Dim stability = phrase.Stability
                    Dim text = alternative.Text
                    ' process interim speech result...
                End If
            Next
        Next
        
    • Public Class StartTranscription
          Inherits TelephonyAction
      
          ' Constructors
          Public Sub New (resultsPage As Webpagerequest, Optional options As Speechrecognitionoptions = Nothing, Optional id As String = "")
      
          ' Members
          Public Property ResultsPage As Webpagerequest
          Public Property Id As String
          Public Property TranscriptionMode As Transcriptionmode?
          Public Property SpeechRecognitionOptions As Speechrecognitionoptions
          Public Property EnableInterimResults As Bool?
      End Class
      

      Examples:

      • Start transcribing both sides of the call separately in US English using defaults:

        Dim actions = New List(Of TelephonyAction)
        
        Dim startTranscription = New StartTranscription(New WebPageRequest("MyTranscriptionResultsPage.aspx"))
        actions.Add(startTranscription)
        

        Extract the transcription from the action result:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As StartTranscriptionResult = telephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim direction = Phrase.Direction
            Dim alternatives = Phrase.Alternatives
            For Each alternative In alternatives
                If phrase.Final Then
                    Dim text = alternative.Text
                    Dim confidence = alternative.Confidence
                    ' process final speech result...
                Else
                    Dim stability = phrase.Stability
                    Dim text = alternative.Text
                    ' process interim speech result...
                End If
            Next
        Next
        
      • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

        Dim actions = New List(Of TelephonyAction)
        
        Dim speechOptions = New SpeechRecognitionOptions("en-GB")
        Dim startTranscription = New StartTranscription(New WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions, id:="conv123")
        actions.Add(startTranscription)
        

        Extract the transcription from the action result:

        ' Unpack the request
        Dim TelephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As StartTranscriptionResult = TelephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim ID = transcriptionResult.Id
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim direction = Phrase.Direction
            Dim alternatives = phrase.Alternatives
            For Each alternative In alternatives
                If phrase.Final Then
                    Dim text = alternative.Text
                    Dim confidence = alternative.Confidence
                    ' process final speech result...
                Else
                    Dim stability = phrase.Stability
                    Dim text = alternative.Text
                    ' process interim speech result...
                End If
            Next
        Next
        
      • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

        Dim actions = New List(Of TelephonyAction)
        
        Dim speechOptions = New SpeechRecognitionOptions
        speechOptions.MaxAlternatives = 2
        
        Dim startTranscription = New StartTranscription(New WebPageRequest("MyTranscriptionResultsPage.aspx"), speechOptions)
        actions.Add(startTranscription)
        

        Extract the transcription from the action result:

        ' Unpack the request
        Dim telephonyRequest = New TelephonyRequest(Request)
        
        Dim transcriptionResult As StartTranscriptionResult = telephonyRequest.InstanceInfo.ActionResult
        Dim completed = transcriptionResult.Completed
        Dim phrases = transcriptionResult.Transcription
        For Each phrase In phrases
            Dim direction = phrase.Direction
            Dim alternatives = phrase.Alternatives
            For Each alternative In alternatives
                If phrase.Final Then
                    Dim text = alternative.Text
                    Dim confidence = alternative.Confidence
                    ' process final speech result...
                Else
                    Dim stability = phrase.Stability
                    Dim text = alternative.Text
                    ' process interim speech result...
                End If
            Next
        Next
        
  • class StartTranscription extends TelephonyAction

    Represents a start transcription action.

    Class synopsis:

    // Constructors:
    public StartTranscription(WebPageRequest resultsPage)
    
    // Members:
    public void setTranscriptionMode(TranscriptionMode mode)
    public void setId(String id)
    public void setSpeechRecognitionOptions(SpeechRecognitionOptions options)
    public void setEnableInterimResults(boolean enabled)
    
    class StartTranscriptionResult extends TranscriptionResult

    Represents a start transcription result.

    Class synopsis:

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

    Examples:

    • Start transcribing both sides of the call separately in US English using defaults:

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      WebPageRequest resultsPage = new WebPageRequest("my_transcription_results_page");
      
      actions.add(new StartTranscription(resultsPage));
      

      Extract the transcription from the action result:

      StartTranscriptionResult transcriptionResult = (StartTranscriptionResult)ourRequest.getInstanceInfo().getActionResult();
      
      boolean completed = transcriptionResult.getCompleted();
      String id = transcriptionResult.getId();
      List<Phrase> phrases = transcriptionResult.getTranscription();
      
      for (Phrase phrase : phrases)
      {
          String dir = phrase.getDirection();
          List<Speech> alternatives = phrase.getAlternatives();
      
          for (Speech alternative : alternatives)
          {
              if (phrase.getFinal())
              {
                  String text = alternative.getText();
                  double confidence = alternative.getConfidence();
      
                  /* process final speech */
              }
              else
              {
                  String text = alternative.getText();
                  double stability = phrase.getStability();
      
                  /* process interim speech */
              }
          }
      }
      
    • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      WebPageRequest resultsPage = new WebPageRequest("my_transcription_results_page");
      
      SpeechRecognitionOptions options =  new SpeechRecognitionOptions();
      options.setLanguage("en-GB");
      
      StartTranscription transcriptionAction = new StartTranscription(resultsPage);
      transcriptionAction.setId("conv123");
      transcriptionAction.setSpeechRecognitionOptions(options);
      transcriptionAction.setEnableInterimResults(true);
      
      actions.add(transcriptionAction);
      

      Extract the transcription from the action result:

      StartTranscriptionResult transcriptionResult = (StartTranscriptionResult)ourRequest.getInstanceInfo().getActionResult();
      
      boolean completed = transcriptionResult.getCompleted();
      String id = transcriptionResult.getId();
      List<Phrase> phrases = transcriptionResult.getTranscription();
      
      for (Phrase phrase : phrases)
      {
          String dir = phrase.getDirection();
          List<Speech> alternatives = phrase.getAlternatives();
      
          for (Speech alternative : alternatives)
          {
              if (phrase.getFinal())
              {
                  String text = alternative.getText();
                  double confidence = alternative.getConfidence();
      
                  /* process final speech */
              }
              else
              {
                  String text = alternative.getText();
                  double stability = phrase.getStability();
      
                  /* process interim speech */
              }
          }
      }
      
    • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

      List<TelephonyAction> actions = new ArrayList<TelephonyAction>();
      
      WebPageRequest resultsPage = new WebPageRequest("my_transcription_results_page");
      
      SpeechRecognitionOptions options =  new SpeechRecognitionOptions();
      options.setMaxAlternatives(2);
      
      StartTranscription transcriptionAction = new StartTranscription(resultsPage);
      transcriptionAction.setId("conv5");
      transcriptionAction.setTranscriptionMode(TranscriptionMode.INBOUND);
      transcriptionAction.setSpeechRecognitionOptions(options);
      transcriptionAction.setEnableInterimResults(true);
      
      actions.add(transcriptionAction);
      

      Extract the transcription from the action result:

      StartTranscriptionResult transcriptionResult = (StartTranscriptionResult)ourRequest.getInstanceInfo().getActionResult();
      
      boolean completed = transcriptionResult.getCompleted();
      String id = transcriptionResult.getId();
      List<Phrase> phrases = transcriptionResult.getTranscription();
      
      for (Phrase phrase : phrases)
      {
          String dir = phrase.getDirection();
          List<Speech> alternatives = phrase.getAlternatives();
      
          for (Speech alternative : alternatives)
          {
              if (phrase.getFinal())
              {
                  String text = alternative.getText();
                  double confidence = alternative.getConfidence();
      
                  /* process final speech */
              }
              else
              {
                  String text = alternative.getText();
                  double stability = phrase.getStability();
      
                  /* process interim speech */
              }
          }
      }
      
  • class StartTranscription

    Represents a start transcription action.

    Class synopsis:

    # StartTranscription object:
    StartTranscription(results_page)
    
    # Instance methods:
    StartTranscription.set_transcription_mode(mode)
    StartTranscription.set_id(id)
    StartTranscription.set_speech_recognition_options(speech_recognition_options)
    StartTranscription.set_enable_interim_results(enabled)
    
    Start Transcription Result

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

    Obtaining the Start Transcription Result dictionary:

    my_request = TelephonyRequest(request)
    action_result = my_request.get_action_result()
    if action_result.get("action") == "start_transcription":
        start_transcription_result = action_result.get("result")
    

    Examples:

    • Start transcribing both sides of the call separately in US English using defaults:

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      list_of_actions.append(StartTranscription(WebPage(url="my_transcription_results_page")))
      

      Get the number of pages sent from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "start_transcription":
      
          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:
      
              alternatives = phrase.get("alternatives")
              direction = phrase.get("direction")
              final = phrase.get("final")
      
              for alternative in alternatives:
      
                  if final:
      
                      text = alternative.get("text")
                      confidence = alternative.get("confidence")
      
                      # Process final speech
      
                  else:
      
                      text = alternative.get("text")
                      stability = phrase.get("stability")
      
                      # Process interim speech
      
    • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      speech_recognition_opts = SpeechRecognitionOptions()
      speech_recognition_opts.set_language("en-GB")
      
      start_trans_action = StartTranscription(WebPage(url="my_transcription_results_page"))
      start_trans_action.set_id("conv123")
      start_trans_action.set_enable_interim_results(True)
      start_trans_action.set_speech_recognition_options(speech_recognition_opts)
      
      list_of_actions.append(start_trans_action)
      

      Get the number of pages sent from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "start_transcription":
      
          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:
      
              alternatives = phrase.get("alternatives")
              direction = phrase.get("direction")
              final = phrase.get("final")
      
              for alternative in alternatives:
      
                  if final:
      
                      text = alternative.get("text")
                      confidence = alternative.get("confidence")
      
                      # Process final speech
      
                  else:
      
                      text = alternative.get("text")
                      stability = phrase.get("stability")
      
                      # Process interim speech
      
    • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

      # Create a list of actions that will be passed to the TelephonyResponse constructor
      list_of_actions = []
      
      speech_recognition_opts = SpeechRecognitionOptions()
      speech_recognition_opts.set_max_alternatives(2)
      
      start_trans_action = StartTranscription(WebPage(url="my_transcription_results_page"))
      start_trans_action.set_id("conv5")
      start_trans_action.set_transcription_mode("inbound")
      start_trans_action.set_enable_interim_results(True)
      start_trans_action.set_speech_recognition_options(speech_recognition_opts)
      
      list_of_actions.append(start_trans_action)
      

      Get the number of pages sent from the action's next page request:

      my_request = TelephonyRequest(request)
      action_result = my_request.get_action_result()
      
      if action_result.get("action") == "start_transcription":
      
          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:
      
              alternatives = phrase.get("alternatives")
              direction = phrase.get("direction")
              final = phrase.get("final")
      
              for alternative in alternatives:
      
                  if final:
      
                      text = alternative.get("text")
                      confidence = alternative.get("confidence")
      
                      # Process final speech
      
                  else:
      
                      text = alternative.get("text")
                      stability = phrase.get("stability")
      
                      # Process interim speech
      
  • The StartTranscription class

    Introduction

    Represents a start transcription action.

    Class synopsis

    class StartTranscription extends ActionBase {
    
        /* methods */
        public __construct(WebPageRequest|string $results_page, array $opts = null)
        public self setTranscriptionMode(string $mode)
        public self setID(string $id)
        public self setSpeechRecognitionOptions(SpeechRecognitionOptions $opts)
        public self setEnableInterimResults(boolean $enabled)
    }
    
    The StartTranscriptionResult class

    Introduction

    Represents a transcription result from a start transcription action.

    Class synopsis

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

    Examples:

    • Start transcribing both sides of the call separately in US English using defaults:

      $response->addAction(new \Aculab\TelephonyRestAPI\StartTranscription("my_transcription_results_page.php"));
      

      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) {
          $dir = $phrase->getDirection();
          $alternatives = $phrase->getAlternatives();
          foreach($alternatives as $speech) {
              if ($phrase->getFinal()) {
                  if ($speech) {
                      $text = $speech->getText();
                      $confidence = $speech->getConfidence();
                      /* process final speech */
                  }
              } else {
                  $stability = $phrase->getStability();
                  if ($speech) {
                      $text = $speech->getText();
                      /* process interim speech */
                  }
              }
          }
      }
      
    • Start transcribing both sides of a British English call separately, specifying an id for the transcription and to receive interim results:

      $start_transcription = new \Aculab\TelephonyRestAPI\StartTranscription("my_transcription_results_page.php");
      $start_transcription->setID("conv123")
          ->setEnableInterimResults(true);
      
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setLanguage("en-GB");
      $start_transcription->setSpeechRecognitionOptions($speech_recognition_options);
      
      $response->addAction($start_transcription);
      

      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) {
          $dir = $phrase->getDirection();
          $alternatives = $phrase->getAlternatives();
          foreach($alternatives as $speech) {
              if ($phrase->getFinal()) {
                  if ($speech) {
                      $text = $speech->getText();
                      $confidence = $speech->getConfidence();
                      /* process final speech */
                  }
              } else {
                  $stability = $phrase->getStability();
                  if ($speech) {
                      $text = $speech->getText();
                      /* process interim speech */
                  }
              }
          }
      }
      
    • Start transcribing only the inbound audio of a call, specifying an id for the transcription and to receive interim results with up to two alternatives specified:

      $start_transcription = new \Aculab\TelephonyRestAPI\StartTranscription("my_transcription_results_page.php");
      $start_transcription->setID("conv5")
          ->setTranscriptionMode("inbound")
          ->setEnableInterimResults(true);
      
      $speech_recognition_options = new \Aculab\TelephonyRestAPI\SpeechRecognitionOptions();
      $speech_recognition_options->setMaxAlternatives(2);
      $start_transcription->setSpeechRecognitionOptions($speech_recognition_options);
      
      $response->addAction($start_transcription);
      

      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) {
          $dir = $phrase->getDirection();
          $alternatives = $phrase->getAlternatives();
          foreach($alternatives as $speech) {
              if ($phrase->getFinal()) {
                  if ($speech) {
                      $text = $speech->getText();
                      $confidence = $speech->getConfidence();
                      /* process final speech */
                  }
              } else {
                  $stability = $phrase->getStability();
                  if ($speech) {
                      $text = $speech->getText();
                      /* process interim speech */
                  }
              }
          }
      }