Skip to content

Commit 54e50b3

Browse files
DX-3190 DX-3197 DX-3181 DX-3182 DX-3184 DX-3185 DX-3186 DX-3187 DX-3188 DX-3189 DX-3191 DX-3193 DX-3194 DX-3195 DX-3196 DX-3198 DX-3201 DX-3202 DX-3203
1 parent de1361c commit 54e50b3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3312
-699
lines changed

pom.xml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -257,25 +257,32 @@
257257
</profiles>
258258

259259
<dependencies>
260-
261-
<dependency>
262-
<groupId>com.fasterxml.jackson.dataformat</groupId>
263-
<artifactId>jackson-dataformat-xml</artifactId>
264-
<version>2.13.0</version>
265-
</dependency>
266-
<dependency>
267-
<groupId>org.projectlombok</groupId>
268-
<artifactId>lombok</artifactId>
269-
<version>1.18.24</version>
270-
<scope>provided</scope>
271-
</dependency>
272-
260+
<dependency>
261+
<groupId>org.glassfish.jaxb</groupId>
262+
<artifactId>jaxb-core</artifactId>
263+
<version>${jaxb.version}</version>
264+
</dependency>
265+
<dependency>
266+
<groupId>org.glassfish.jaxb</groupId>
267+
<artifactId>jaxb-runtime</artifactId>
268+
<version>${jaxb.version}</version>
269+
</dependency>
270+
<dependency>
271+
<groupId>org.projectlombok</groupId>
272+
<artifactId>lombok</artifactId>
273+
<version>1.18.24</version>
274+
<scope>provided</scope>
275+
</dependency>
276+
<dependency>
277+
<groupId>jakarta.xml.bind</groupId>
278+
<artifactId>jakarta.xml.bind-api</artifactId>
279+
<version>${jaxb.version}</version>
280+
</dependency>
273281
<dependency>
274282
<groupId>org.hamcrest</groupId>
275283
<artifactId>hamcrest</artifactId>
276284
<version>2.2</version>
277285
</dependency>
278-
279286
<dependency>
280287
<groupId>io.swagger</groupId>
281288
<artifactId>swagger-annotations</artifactId>
@@ -354,14 +361,15 @@
354361
</dependency>
355362
</dependencies>
356363
<properties>
357-
<java.version>1.8</java.version>
364+
<java.version>15</java.version>
358365
<maven.compiler.source>${java.version}</maven.compiler.source>
359366
<maven.compiler.target>${java.version}</maven.compiler.target>
360367
<gson-fire-version>1.8.5</gson-fire-version>
361368
<swagger-core-version>1.6.5</swagger-core-version>
362369
<okhttp-version>4.9.3</okhttp-version>
363370
<gson-version>2.9.0</gson-version>
364371
<commons-lang3-version>3.12.0</commons-lang3-version>
372+
<jaxb.version>4.0.0</jaxb.version>
365373
<jackson-databind-nullable-version>0.2.3</jackson-databind-nullable-version>
366374
<jakarta-annotation-version>1.3.5</jakarta-annotation-version>
367375
<junit-version>5.8.2</junit-version>
@@ -376,11 +384,6 @@
376384

377385
<dependencyManagement>
378386
<dependencies>
379-
<dependency>
380-
<groupId>com.fasterxml.jackson.core</groupId>
381-
<artifactId>jackson-databind</artifactId>
382-
<version>2.13.3</version>
383-
</dependency>
384387
<dependency>
385388
<groupId>org.projectlombok</groupId>
386389
<artifactId>lombok</artifactId>
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package org.openapitools.client.model;
2+
3+
import static java.util.function.Function.identity;
4+
import static java.util.stream.Collectors.toMap;
5+
6+
import com.fasterxml.jackson.annotation.JsonCreator;
7+
import java.util.Arrays;
8+
import java.util.Map;
9+
import lombok.Getter;
10+
11+
@Getter
12+
public enum DiversionReason {
13+
AWAY("away"),
14+
DEFLECTION("deflection"),
15+
DO_NOT_DISTURB("do-not-disturb"),
16+
FOLLOW_ME("follow-me"),
17+
NO_ANSWER("no-answer"),
18+
OUT_OF_SERVICE("out-of-service"),
19+
TIME_OF_DAY("time-of-day"),
20+
UNAVAILABLE("unavailable"),
21+
UNCONDITIONAL("unconditional"),
22+
UNKNOWN("unknown"),
23+
USER_BUSY("user-busy"),
24+
;
25+
26+
private static final Map<String, DiversionReason> DESERIALIZATION_MAP =
27+
Arrays.stream(values())
28+
.collect(toMap(v -> v.name, identity()));
29+
30+
private final String name;
31+
32+
DiversionReason(String name) {
33+
this.name = name;
34+
}
35+
36+
@JsonCreator
37+
public static DiversionReason resolve(String name) {
38+
return DESERIALIZATION_MAP.get(name.toLowerCase());
39+
}
40+
41+
@Override
42+
public String toString() {
43+
return name;
44+
}
45+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package org.openapitools.client.model;
2+
3+
import static java.util.function.Function.identity;
4+
import static java.util.stream.Collectors.toMap;
5+
6+
import com.fasterxml.jackson.annotation.JsonCreator;
7+
import java.util.Arrays;
8+
import java.util.Map;
9+
import lombok.Getter;
10+
11+
@Getter
12+
public enum DiversionTreatment {
13+
NONE("none"),
14+
PROPAGATE("propagate"),
15+
STACK("stack"),
16+
;
17+
18+
private static final Map<String, DiversionTreatment> DESERIALIZATION_MAP =
19+
Arrays.stream(values())
20+
.collect(toMap(v -> v.name, identity()));
21+
22+
private final String name;
23+
24+
DiversionTreatment(String name) {
25+
this.name = name;
26+
}
27+
28+
@JsonCreator
29+
public static DiversionTreatment resolve(String name) {
30+
return DESERIALIZATION_MAP.get(name.toLowerCase());
31+
}
32+
33+
@Override
34+
public String toString() {
35+
return name;
36+
}
37+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package org.openapitools.client.model.bxml;
2+
3+
import com.fasterxml.jackson.annotation.JsonSubTypes;
4+
import com.fasterxml.jackson.annotation.JsonTypeInfo;
5+
6+
/**
7+
* A marker interface for BXML verbs that process audio output. The class annotations describe how
8+
* Jackson should serialize and deserialize verbs.
9+
*/
10+
@JsonSubTypes({
11+
@JsonSubTypes.Type(value = PlayAudio.class, name = PlayAudio.TYPE_NAME),
12+
@JsonSubTypes.Type(value = SpeakSentence.class, name = SpeakSentence.TYPE_NAME),
13+
})
14+
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "name")
15+
public interface AudioProducer extends Verb {
16+
}
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
/**
2+
* The {@code <Bridge>} verb is used to bridge another party (target call) onto the current call.
3+
* When the target call is bridged, any BXML being executed in it will be cancelled.
4+
* The bridge ends when one of the calls leaves the bridge. A call leaves the bridge when it is hung up or when it gets redirected to another BXML.
5+
* The Bridge Complete and Bridge Target Complete callbacks are sent when the bridge ends, to allow the call that remained in the bridge to execute new BXML.
6+
*
7+
*/
8+
9+
package org.openapitools.client.model.bxml;
10+
11+
import static org.openapitools.client.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD;
12+
13+
import jakarta.xml.bind.annotation.XmlAccessType;
14+
import jakarta.xml.bind.annotation.XmlAccessorType;
15+
import jakarta.xml.bind.annotation.XmlAttribute;
16+
import jakarta.xml.bind.annotation.XmlType;
17+
import jakarta.xml.bind.annotation.XmlValue;
18+
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
19+
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
20+
import lombok.AllArgsConstructor;
21+
import lombok.Builder;
22+
import lombok.Builder.Default;
23+
import lombok.EqualsAndHashCode;
24+
import lombok.Getter;
25+
import lombok.NoArgsConstructor;
26+
27+
@XmlAccessorType(XmlAccessType.FIELD)
28+
@XmlType
29+
@NoArgsConstructor
30+
@AllArgsConstructor
31+
@Builder
32+
@Getter
33+
@EqualsAndHashCode
34+
public class Bridge implements Verb {
35+
36+
/**
37+
*
38+
* @param targetCallId (str): String containing the callId of the call to be bridged.
39+
* @param bridgeCompleteUrl (str, optional): URL to send the Bridge Complete event to and request new BXML.
40+
* If this attribute is specified, then Verbs following the <Bridge> verb will be ignored and the BXML returned in this webhook is executed on the call.
41+
* If this attribute is not specified then no webhook will be sent, and execution of the verbs following the <Bridge> verb continues. May be a relative URL. Defaults to None.
42+
* @param bridgeCompleteMethod (str, optional): The HTTP method to use for the request to bridgeCompleteUrl. GET or POST. Default value is POST.
43+
* @param bridgeCompleteFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Bridge Complete webhook delivery in case bridgeCompleteUrl fails to respond. Defaults to None.
44+
* @param bridgeCompleteFallbackMethod (str, optional): The HTTP method to use to deliver the Bridge Complete webhook to bridgeCompleteFallbackUrl. GET or POST. Default value is POST.
45+
* @param bridgeTargetCompleteUrl (str, optional):URL to send the Bridge Target Complete event to and request new BXML.
46+
* If this attribute is specified, then the BXML returned in this webhook is executed on the target call.
47+
* If this attribute is not specified then no webhook will be sent, and the target call will be hung up. May be a relative URL. Defaults to None.
48+
* @param bridgeTargetCompleteMethod (str, optional): The HTTP method to use for the request to bridgeTargetCompleteUrl. GET or POST. Default value is POST.
49+
* @param bridgeTargetCompleteFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the Bridge Target Complete webhook delivery in case bridgeTargetCompleteUrl fails to respond. Defaults to None.
50+
* @param bridgeTargetCompleteFallbackMethod (str, optional): The HTTP method to use to deliver the Bridge Target Complete webhook to bridgeTargetCompleteFallbackUrl. GET or POST. Default value is POST.
51+
* @param username (str, optional): The username to send in the HTTP request to bridgeCompleteUrl and to bridgeTargetCompleteUrl. Defaults to None.
52+
* @param password (str, optional): The password to send in the HTTP request to bridgeCompleteUrl and to bridgeTargetCompleteUrl. Defaults to None.
53+
* @param fallbackUsername (str, optional): The username to send in the HTTP request to bridgeCompleteFallbackUrl and to bridgeTargetCompleteFallbackUrl. Defaults to None.
54+
* @param fallbackPassword (str, optional): The password to send in the HTTP request to bridgeCompleteFallbackUrl and to bridgeTargetCompleteFallbackUrl. Defaults to None.
55+
* @param tag (str, optional): A custom string that will be sent with the bridgeComplete webhook and all future webhooks of the call unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
56+
*
57+
*/
58+
59+
public static final String TYPE_NAME = "Bridge";
60+
61+
@XmlValue
62+
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
63+
protected String targetCallId;
64+
65+
@XmlAttribute
66+
protected String bridgeCompleteUrl;
67+
68+
@XmlAttribute
69+
@Default
70+
protected String bridgeCompleteMethod = DEFAULT_CALLBACK_METHOD;
71+
72+
@XmlAttribute
73+
protected String bridgeCompleteFallbackUrl;
74+
75+
@XmlAttribute
76+
@Default
77+
protected String bridgeCompleteFallbackMethod = DEFAULT_CALLBACK_METHOD;
78+
79+
@XmlAttribute
80+
protected String bridgeTargetCompleteUrl;
81+
82+
@XmlAttribute
83+
@Default
84+
protected String bridgeTargetCompleteMethod = DEFAULT_CALLBACK_METHOD;
85+
86+
@XmlAttribute
87+
protected String bridgeTargetCompleteFallbackUrl;
88+
89+
@XmlAttribute
90+
@Default
91+
protected String bridgeTargetCompleteFallbackMethod = DEFAULT_CALLBACK_METHOD;
92+
93+
@XmlAttribute
94+
protected String tag;
95+
96+
@XmlAttribute
97+
protected String username;
98+
99+
@XmlAttribute
100+
protected String password;
101+
102+
@XmlAttribute
103+
protected String fallbackUsername;
104+
105+
@XmlAttribute
106+
protected String fallbackPassword;
107+
108+
@Override
109+
public String getVerbName() {
110+
return TYPE_NAME;
111+
}
112+
}
Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,84 @@
1+
/**
2+
* The root {@code <Bxml>} verb. Other verbs get added to BXML and then the JAXB marshaller using the toBxml() method converts this to valid BXML.
3+
*
4+
*/
5+
16
package org.openapitools.client.model.bxml;
27

8+
import jakarta.xml.bind.JAXBContext;
9+
import jakarta.xml.bind.JAXBException;
10+
import jakarta.xml.bind.Marshaller;
11+
import jakarta.xml.bind.annotation.XmlElement;
12+
import jakarta.xml.bind.annotation.XmlElements;
13+
import jakarta.xml.bind.annotation.XmlRootElement;
14+
import java.io.ByteArrayOutputStream;
15+
import java.io.OutputStream;
16+
import java.util.ArrayList;
17+
import java.util.Arrays;
318
import java.util.List;
19+
import lombok.AllArgsConstructor;
20+
import lombok.Builder;
21+
import lombok.EqualsAndHashCode;
22+
import lombok.Getter;
23+
import lombok.NoArgsConstructor;
24+
25+
26+
@XmlRootElement(name = "Bxml")
27+
@NoArgsConstructor
28+
@AllArgsConstructor
29+
@Getter
30+
@Builder
31+
@EqualsAndHashCode
32+
public class Bxml {
33+
34+
@XmlElements({
35+
@XmlElement(name = Bridge.TYPE_NAME, type = Bridge.class),
36+
@XmlElement(name = Conference.TYPE_NAME, type = Conference.class),
37+
@XmlElement(name = Forward.TYPE_NAME, type = Forward.class),
38+
@XmlElement(name = Gather.TYPE_NAME, type = Gather.class),
39+
@XmlElement(name = Hangup.TYPE_NAME, type = Hangup.class),
40+
@XmlElement(name = Pause.TYPE_NAME, type = Pause.class),
41+
@XmlElement(name = PauseRecording.TYPE_NAME, type = PauseRecording.class),
42+
@XmlElement(name = PlayAudio.TYPE_NAME, type = PlayAudio.class),
43+
@XmlElement(name = Record.TYPE_NAME, type = Record.class),
44+
@XmlElement(name = Redirect.TYPE_NAME, type = Redirect.class),
45+
@XmlElement(name = ResumeRecording.TYPE_NAME, type = ResumeRecording.class),
46+
@XmlElement(name = Ring.TYPE_NAME, type = Ring.class),
47+
@XmlElement(name = SendDtmf.TYPE_NAME, type = SendDtmf.class),
48+
@XmlElement(name = SpeakSentence.TYPE_NAME, type = SpeakSentence.class),
49+
@XmlElement(name = StartRecording.TYPE_NAME, type = StartRecording.class),
50+
@XmlElement(name = StopRecording.TYPE_NAME, type = StopRecording.class),
51+
@XmlElement(name = StartGather.TYPE_NAME, type = StartGather.class),
52+
@XmlElement(name = StopGather.TYPE_NAME, type = StopGather.class),
53+
@XmlElement(name = Tag.TYPE_NAME, type = Tag.class),
54+
@XmlElement(name = Transfer.TYPE_NAME, type = Transfer.class),
55+
@XmlElement(name = StartStream.TYPE_NAME, type = StartStream.class),
56+
@XmlElement(name = StopStream.TYPE_NAME, type = StopStream.class),
57+
})
458

5-
public class Bxml extends Root {
59+
private List<Verb> verbs = new ArrayList<>();
60+
61+
public Bxml with(Verb verb) {
62+
this.verbs.add(verb);
63+
return this;
64+
}
65+
66+
public Bxml withVerbs(Verb... verbs) {
67+
this.verbs.addAll(Arrays.asList(verbs));
68+
return this;
69+
}
670

7-
public Bxml() {
8-
super("Bxml");
71+
public String toBxml(JAXBContext jaxbContext) {
72+
OutputStream outputStream = new ByteArrayOutputStream();
73+
try {
74+
getMarshaller(jaxbContext).marshal(this, outputStream);
75+
} catch (JAXBException e) {
76+
throw new RuntimeException("Error creating BXML marshaller", e);
77+
}
78+
return outputStream.toString();
979
}
1080

11-
public Bxml(List<Verb> nestedVerbs) {
12-
super("Bxml", nestedVerbs);
81+
private Marshaller getMarshaller(JAXBContext context) throws JAXBException {
82+
return context.createMarshaller();
1383
}
1484
}

0 commit comments

Comments
 (0)