diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Connect.java b/src/main/java/com/bandwidth/sdk/model/bxml/Connect.java index 485c1aba..f984a7dc 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/Connect.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Connect.java @@ -28,6 +28,7 @@ * * @param endpoints (list[Endpoint], optional): List of endpoints to connect the call to. * @param eventCallbackUrl (str, optional): URL to send events to during the connection lifecycle. May be a relative URL. + * @param eventFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the event callback delivery in case eventCallbackUrl fails to respond. * */ public class Connect implements Verb { @@ -40,6 +41,9 @@ public class Connect implements Verb { @XmlAttribute protected URI eventCallbackUrl; + @XmlAttribute + protected URI eventFallbackUrl; + @Override public String getVerbName() { return TYPE_NAME; diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java b/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java index f8e42c1c..98b73b22 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Forward.java @@ -53,6 +53,9 @@ * @param uui (str, optional): The value of the User-To-User header to send within the outbound INVITE when forwarding to a SIP URI. * Must include the encoding parameter as specified in RFC 7433. Only base64 and jwt encoding are currently allowed. * This value, including the encoding specifier, may not exceed 256 characters. + * @param privacy (bool, optional): A boolean value to indicate that the calling number should be hidden. Use callerDisplayName to customize the name shown to the recipient. Default is false. + * @param callerDisplayName (str, optional): The caller display name to use when the call is created. May not exceed 256 characters nor contain control characters such as new lines. + * If privacy is true, only the values Restricted, Anonymous, Private, or Unavailable are valid. */ public class Forward implements Verb { @@ -79,6 +82,12 @@ public class Forward implements Verb { @Builder.Default private DiversionReason diversionReason = DiversionReason.unknown; + @XmlAttribute + private Boolean privacy; + + @XmlAttribute + private String callerDisplayName; + @Override public String getVerbName() { return TYPE_NAME; diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java b/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java index 8f56ac51..162f8dbb 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Gather.java @@ -51,6 +51,14 @@ * Default value is 5. Range: decimal values between 0 - 60. * @param repeatCount (int, optional): The number of times the audio prompt should be played if no digits are pressed. For example, if this value is 3, the nested audio clip will be played a maximum of three times. * The delay between repetitions will be equal to first_digit_timeout. Default value is 1. repeat_count * number of verbs must not be greater than 20. + * @param input (str, optional): The input mode to collect from the caller: dtmf, speech, or dtmf_speech. Default value is dtmf. + * @param hints (str, optional): Words or phrases that improve speech recognition accuracy. Only used when input includes speech. + * @param language (str, optional): The language code to use for speech recognition. Only used when input includes speech. + * @param partialResultCallback (str, optional): URL to send the Partial Result event to as speech is recognized. May be a relative URL. Only used when input includes speech. + * @param partialResultCallbackMethod (str, optional): The HTTP method to use for the request to partialResultCallback. GET or POST. Default value is POST. + * @param profanityFilter (bool, optional): Whether profane words are filtered out of the transcription. Default value is true. Only used when input includes speech. + * @param speechModel (str, optional): The speech recognition model to use. Only used when input includes speech. + * @param speechTimeout (int, optional): Time (in seconds) to wait for speech input before terminating the Gather. Default value is 5. * * Nested Verbs: * @param PlayAudio: (optional) Using the PlayAudio inside the Gather verb will play the media until a digit is received. @@ -116,6 +124,30 @@ public class Gather implements Verb { @Default protected int repeatCount = DEFAULT_REPEAT_COUNT; + @XmlAttribute + protected String input; + + @XmlAttribute + protected String hints; + + @XmlAttribute + protected String language; + + @XmlAttribute + protected String partialResultCallback; + + @XmlAttribute + protected String partialResultCallbackMethod; + + @XmlAttribute + protected Boolean profanityFilter; + + @XmlAttribute + protected String speechModel; + + @XmlAttribute + protected Integer speechTimeout; + @Override public String getVerbName() { return TYPE_NAME; diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Record.java b/src/main/java/com/bandwidth/sdk/model/bxml/Record.java index 7ee6bc93..75bfbc12 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/Record.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Record.java @@ -38,6 +38,7 @@ * @param recordingAvailableUrl (str, optional): URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. * @param recordingAvailableMethod (str, optional): The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. Defaults to None. * @param transcribe (str, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. + * @param detectLanguage (bool, optional): A boolean value to indicate that the transcription service should detect the dominant language of the recording rather than assuming English. Ignored unless transcribe is true. Default is false. * @param transcriptionAvailableUrl (str, optional): URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. * @param transcriptionAvailableMethod (str, optional): The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. * @param username (str, optional): The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. @@ -49,6 +50,7 @@ * @param maxDuration (int, optional): Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None. * @param silenceTimeout (str, optional): Length of silence after which to end the recording (in seconds). Max is equivalent to the maximum maxDuration value. Default value is 0, which means no timeout. Defaults to None. * @param fileFormat (str, optional): The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. + * @param recordingName (str, optional): A name identifying this recording, returned in the Recording Available event. * */ public class Record implements TranscriptionProducer { @@ -94,6 +96,9 @@ public class Record implements TranscriptionProducer { @XmlAttribute protected Boolean transcribe; + @XmlAttribute + protected Boolean detectLanguage; + @XmlAttribute @Default protected Double silenceTimeout = DEFAULT_RECORD_SILENCE_TIMEOUT; @@ -116,6 +121,9 @@ public class Record implements TranscriptionProducer { @XmlAttribute protected String fallbackPassword; + @XmlAttribute + protected String recordingName; + @Override public String getVerbName() { return TYPE_NAME; diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java b/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java index e026f6ad..38585524 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StartRecording.java @@ -30,6 +30,7 @@ * @param recordingAvailableUrl (str, optional): URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. * @param recordingAvailableMethod (str, optional): The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST. * @param transcribe (str, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None. + * @param detectLanguage (bool, optional): A boolean value to indicate that the transcription service should detect the dominant language of the recording rather than assuming English. Ignored unless transcribe is true. Default is false. * @param transcriptionAvailableUrl (str, optional): URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None. * @param transcriptionAvailableMethod (str, optional): The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None. * @param username (str, optional): The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None. @@ -37,6 +38,7 @@ * @param tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. * @param fileFormat (str, optional): The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. max_duration (str, optional): Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None. * @param multiChannel (str, optional): A boolean value indicating whether or not the recording file should separate each side of the call into its own audio channel. Default value is false. + * @param recordingName (str, optional): A name identifying this recording, returned in the Recording Available event. * */ public class StartRecording implements TranscriptionProducer { @@ -53,6 +55,9 @@ public class StartRecording implements TranscriptionProducer { @XmlAttribute protected Boolean transcribe; + @XmlAttribute + protected Boolean detectLanguage; + @XmlAttribute protected String transcriptionAvailableUrl; @@ -76,6 +81,9 @@ public class StartRecording implements TranscriptionProducer { @Default protected Boolean multiChannel = false; + @XmlAttribute + protected String recordingName; + @Override public String getVerbName() { return TYPE_NAME; diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java b/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java index 7cb576ec..b2916926 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/StartTranscription.java @@ -40,6 +40,8 @@ * @param username (str, optional): The username to send in the HTTP request to transcriptionEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). * @param password (str, optional): The password to send in the HTTP request to transcriptionEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https). * @param stabilized (str, optional): Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true. + * @param detectLanguage (bool, optional): Whether to detect the dominant language being spoken rather than assuming English. Default is false. + * @param preferredLanguages (str, optional): A comma-separated list of language locales to transcribe in, for example "en-US,es-US". Requires detectLanguage to be false, and accepts only one dialect per language. Defaults to en-US. * * Nested Verbs: * @param CustomParam: (optional) You may specify up to 12 elements nested within a tag. @@ -78,6 +80,12 @@ public class StartTranscription implements Verb { @Default protected Boolean stabilized = true; + @XmlAttribute + protected Boolean detectLanguage; + + @XmlAttribute + protected String preferredLanguages; + @XmlElements({ @XmlElement(name = CustomParam.TYPE_NAME, type = CustomParam.class) }) diff --git a/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java b/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java index 580647e1..51f36fe2 100644 --- a/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java +++ b/src/main/java/com/bandwidth/sdk/model/bxml/Transfer.java @@ -66,6 +66,7 @@ * * This parameter is considered only when diversionTreatment is set to stack. Defaults is unknown. * Defaults to None. + * @param privacy (bool, optional): A boolean value to indicate that the calling number should be hidden. Use transferCallerDisplayName to customize the name shown to the recipient. Default is false. * */ public class Transfer implements Verb { @@ -128,6 +129,9 @@ public class Transfer implements Verb { @Default protected DiversionReason diversionReason = DiversionReason.unknown; + @XmlAttribute + protected Boolean privacy; + @Override public String getVerbName() { return TYPE_NAME; diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/ConnectVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/ConnectVerbTest.java index b1485599..bcc7da4c 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/ConnectVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/ConnectVerbTest.java @@ -31,6 +31,7 @@ public class ConnectVerbTest { Connect connectWithCallback = Connect.builder() .endpoints(List.of(endpoint)) .eventCallbackUrl(URI.create("https://example.com/callback")) + .eventFallbackUrl(URI.create("https://example.com/fallback")) .build(); Connect connectWithoutCallback = Connect.builder() @@ -40,7 +41,7 @@ public class ConnectVerbTest { @Test public void connectVerbWithCallbackWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expected = "test-endpoint-id"; + String expected = "test-endpoint-id"; assertThat(new Bxml().with(connectWithCallback).toBxml(jaxbContext), is(expected)); } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/ForwardVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/ForwardVerbTest.java index 3d2549e9..93b05579 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/ForwardVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/ForwardVerbTest.java @@ -32,12 +32,14 @@ public class ForwardVerbTest { .diversionTreatment(DiversionTreatment.propagate) .diversionReason(DiversionReason.away) .uui("93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt") + .privacy(true) + .callerDisplayName("Restricted") .build(); @Test public void forwardVerbWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expectedBxml = ""; + String expectedBxml = ""; assertThat(new Bxml().with(forward).toBxml(jaxbContext), is(expectedBxml)); } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/GatherVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/GatherVerbTest.java index 42dd5acd..bda579ec 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/GatherVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/GatherVerbTest.java @@ -47,13 +47,21 @@ public class GatherVerbTest { .interDigitTimeout(1d) .firstDigitTimeout(3d) .repeatCount(2) + .input("dtmf_speech") + .hints("yes | no | maybe") + .language("en-US") + .partialResultCallback("partial-test.com") + .partialResultCallbackMethod("POST") + .profanityFilter(true) + .speechModel("default") + .speechTimeout(10) .children(List.of(playAudio, speakSentence)) .build(); @Test public void gatherVerbWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expectedBxml = "test.comHello. Your number is <say-as interpret-as=\"telephone\">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished."; + String expectedBxml = "test.comHello. Your number is <say-as interpret-as=\"telephone\">asdf</say-as>, lets play a game. What is 10 + 3. Press the pound key when finished."; assertThat(new Bxml().with(gather).toBxml(jaxbContext), is(expectedBxml)); } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/RecordVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/RecordVerbTest.java index 025eaee2..0934cecd 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/RecordVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/RecordVerbTest.java @@ -25,12 +25,15 @@ public class RecordVerbTest { */ Record record = Record.builder() .maxDuration(10) + .transcribe(true) + .detectLanguage(true) + .recordingName("test-recording") .build(); @Test public void recordVerbWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expectedBxml = ""; + String expectedBxml = ""; assertThat(new Bxml().with(record).toBxml(jaxbContext), is(expectedBxml)); } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartRecordingVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartRecordingVerbTest.java index ccbfe514..2199f2d9 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartRecordingVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartRecordingVerbTest.java @@ -34,12 +34,14 @@ public class StartRecordingVerbTest { .tag("tag") .fileFormat("wav") .multiChannel(true) + .detectLanguage(true) + .recordingName("test-recording") .build(); @Test public void startRecordingVerbWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expectedBxml = ""; + String expectedBxml = ""; assertThat(new Bxml().with(startRecording).toBxml(jaxbContext), is(expectedBxml)); } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartTranscriptionVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartTranscriptionVerbTest.java index 21a99fe0..6ab45f4c 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartTranscriptionVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/StartTranscriptionVerbTest.java @@ -43,13 +43,15 @@ public class StartTranscriptionVerbTest { .transcriptionEventMethod("POST") .username("user") .password("pass") + .detectLanguage(false) + .preferredLanguages("en-US,es-US") .customParams(List.of(customParam1, customParam2)) .build(); @Test public void startTranscriptionVerbWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expectedBxml = ""; + String expectedBxml = ""; assertThat(new Bxml().with(startTranscription).toBxml(jaxbContext), is(expectedBxml)); } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/bxml/TransferVerbTest.java b/src/test/java/com/bandwidth/sdk/unit/models/bxml/TransferVerbTest.java index 6eec1c86..25dad468 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/bxml/TransferVerbTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/bxml/TransferVerbTest.java @@ -46,6 +46,7 @@ public class TransferVerbTest { .destinations(List.of(sipUri)) .transferCallerId("+19195554321") .tag("test") + .privacy(true) .build(); Transfer transfer2 = Transfer.builder() .callTimeout(15d) @@ -58,7 +59,7 @@ public class TransferVerbTest { @Test public void transferVerbWorks() throws JAXBException { JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class); - String expectedSipUriBxml = "sip@bw.com"; + String expectedSipUriBxml = "sip@bw.com"; String expectedPhoneNumberBxml = "+19195551234"; assertThat(new Bxml().with(transfer1).toBxml(jaxbContext), is(expectedSipUriBxml));