All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bandwidth.voice.bxml.verbs.StartTranscription Maven / Gradle / Ivy

Go to download

The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs

There is a newer version: 12.0.1
Show newest version

package com.bandwidth.voice.bxml.verbs;

import lombok.Builder;

import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlElement;


/**
 * The StartTranscription verb allows a segment of a call to be transcribed and optionally for the live transcription to be sent off to another destination for additional processing.
 */
@Builder
@XmlType(name = StartTranscription.TYPE_NAME)
public class StartTranscription implements Verb {
    public static final String TYPE_NAME = "StartTranscription";

    @XmlElement(name = CustomParam.TYPE_NAME)
    private final List customParams;

    /**
     * (optional) A name to refer to this transcription by. Used when sending . If not provided, it will default to the generated transcription id as sent in the Real-Time Transcription Started webhook.
     */
    @XmlAttribute
    private String name;

    /**
     * (optional) the part of the call to send a transcription from. `inbound`, `outbound` or `both`. default is `inbound`. 
     */
    @XmlAttribute
    private String tracks;

    /**
     * (optional) a websocket uri to send the real-time transcription to. the audio from the specified tracks will be sent via websocket to this url encoded as base64 encoded pcmu/g711 audio. see below for more details on the websocket packet format.
     */
    @XmlAttribute
    private URI destination;

    /**
     * (optional) Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true.
     */
    @XmlAttribute
    private Boolean stabilized;

    /**
     * (optional) url to send the associated webhook events to during this real-time transcription's lifetime. Does not accept bxml. May be a relative URL. 
     */
    @XmlAttribute
    private URI transcriptionEventUrl;

    /**
     * (optional) the http method to use for the request to `transcriptioneventurl`. get or post. default value is post.
     */
    @XmlAttribute
    private Method transcriptionEventMethod;

    /**
     * (optional) the username to send in the http request to `transcriptioneventurl`. if specified, the urls must be tls-encrypted (i.e., `https`). 
     */
    @XmlAttribute
    protected String username;

    /**
     * (optional) the password to send in the http request to `transcriptioneventurl`. if specified, the urls must be tls-encrypted (i.e., `https`).
     */
    @XmlAttribute
    protected String password;


    public static class StartTranscriptionBuilder {

        /**
         * (optional) url to send the associated webhook events to during this real-time transcription's lifetime. does not accept bxml. may be a relative url.
         */
        public StartTranscriptionBuilder transcriptionEventUrl(URI uri ){
            this.transcriptionEventUrl = uri;
            return this;
        }

        /**
         * (optional) url to send the associated webhook events to during this real-time transcription's lifetime. does not accept bxml. may be a relative url.
         */
        public StartTranscriptionBuilder transcriptionEventUrl(String uri ){
            return transcriptionEventUrl(URI.create(uri));
        } 

        /**
         * (required) a websocket uri to send the real-time transcription to. the audio from the specified tracks will be sent via websocket to this url encoded as base64 encoded pcmu/g711 audio. see below for more details on the websocket packet format.
         */
        public StartTranscriptionBuilder destination(URI uri ){
            this.destination = uri;
            return this;
        }

        /**
         * (optional) a websocket uri to send the real-time transcription to. the audio from the specified tracks will be sent via websocket to this url encoded as base64 encoded pcmu/g711 audio. see below for more details on the websocket packet format.
         */
        public StartTranscriptionBuilder destination(String uri ){
            return destination(URI.create(uri));
        }        

        /**
         * (optional) the http method to use for the request to `transcriptioneventurl`. get or post. default value is post.
         */
        public StartTranscriptionBuilder transcriptionEventMethod(Method method){
            this.transcriptionEventMethod = method;
            return this;
        }

        /**
         * (optional) the http method to use for the request to `transcriptionEventUrl`. GET or POST. Default value is POST.
         */
        public StartTranscriptionBuilder transcriptionEventMethod(String method){
            return transcriptionEventMethod(Method.fromValue(method));
        }

        /**
         * (optional) you may specify up to 12  elements nested within a  tag. these elements define optional user specified parameters that will be sent to the destination url when the real-time transcription is first started.
         */
        public StartTranscriptionBuilder customParams(CustomParam ... customParams){
            this.customParams = Arrays.asList(customParams);
            return this;
        }

        /**
         * (optional) you may specify up to 12  elements nested within a  tag. these elements define optional user specified parameters that will be sent to the destination url when the real-time transcription is first started.
         */
        public StartTranscriptionBuilder customParams(List customParams){
            this.customParams = customParams;
            return this;
        }        
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy