Skip to content

Commit f38a0a9

Browse files
committed
SWI-3362 Add BXML Directory
1 parent d3cf5f4 commit f38a0a9

40 files changed

+2381
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ hs_err_pid*
1919
target
2020
.gradle
2121
build
22+
23+
.idea
24+
.DS_Store
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: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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+
6+
package org.openapitools.client.model.bxml;
7+
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;
18+
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+
@XmlElement(name = StartTranscription.TYPE_NAME, type = StartTranscription.class),
58+
@XmlElement(name = StopTranscription.TYPE_NAME, type = StopTranscription.class),
59+
60+
})
61+
62+
private List<Verb> verbs = new ArrayList<>();
63+
64+
public Bxml with(Verb verb) {
65+
this.verbs.add(verb);
66+
return this;
67+
}
68+
69+
public Bxml withVerbs(Verb... verbs) {
70+
this.verbs.addAll(Arrays.asList(verbs));
71+
return this;
72+
}
73+
74+
public String toBxml(JAXBContext jaxbContext) {
75+
OutputStream outputStream = new ByteArrayOutputStream();
76+
try {
77+
getMarshaller(jaxbContext).marshal(this, outputStream);
78+
} catch (JAXBException e) {
79+
throw new RuntimeException("Error creating BXML marshaller", e);
80+
}
81+
return outputStream.toString();
82+
}
83+
84+
private Marshaller getMarshaller(JAXBContext context) throws JAXBException {
85+
return context.createMarshaller();
86+
}
87+
}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
/**
2+
* The {@code <Conference>} verb is used to join the current call into a conference.
3+
* Conference names are created and specified by your application. Conferences are implicitly created the first time your application uses a conference name,
4+
* and they are implicitly deleted when the last member leaves the conference. We will create a unique ID for the conference,
5+
* so your conference names can be whatever you want. If the conference ends and then you later use the same conference name, a new unique ID will be created.
6+
*/
7+
8+
package org.openapitools.client.model.bxml;
9+
10+
import static org.openapitools.client.model.bxml.utils.BxmlConstants.DEFAULT_CALLBACK_METHOD;
11+
import static org.openapitools.client.model.bxml.utils.BxmlConstants.DEFAULT_EMPTY_STRING;
12+
13+
14+
import jakarta.xml.bind.annotation.XmlAccessType;
15+
import jakarta.xml.bind.annotation.XmlAccessorType;
16+
import jakarta.xml.bind.annotation.XmlAttribute;
17+
import jakarta.xml.bind.annotation.XmlType;
18+
import jakarta.xml.bind.annotation.XmlValue;
19+
import jakarta.xml.bind.annotation.adapters.CollapsedStringAdapter;
20+
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
21+
import lombok.AllArgsConstructor;
22+
import lombok.Builder;
23+
import lombok.Builder.Default;
24+
import lombok.EqualsAndHashCode;
25+
import lombok.Getter;
26+
import lombok.NoArgsConstructor;
27+
28+
@XmlAccessorType(XmlAccessType.FIELD)
29+
@XmlType
30+
@NoArgsConstructor
31+
@AllArgsConstructor
32+
@Builder
33+
@Getter
34+
@EqualsAndHashCode
35+
public class Conference implements Verb {
36+
37+
/**
38+
*
39+
* @param name (str): The name of the conference. Can contain up to 100 characters of letters, numbers, and the symbols -, _, and .
40+
* @param mute (str, optional): A boolean value to indicate whether the member should be on mute in the conference. When muted, a member can hear others speak, but others cannot hear them speak. Defaults to false.
41+
* @param hold (str, optional): A boolean value to indicate whether the member should be on hold in the conference. When on hold, a member cannot hear others, and they cannot be heard. Defaults to false.
42+
* @param callIdsToCoach (str, optional): A comma-separated list of call ids to coach. When a call joins a conference with this attribute set, it will coach the listed calls.
43+
* Those calls will be able to hear and be heard by the coach, but other calls in the conference will not hear the coach.
44+
* @param conferenceEventUrl (str, optional): URL to send Conference events to. The URL, method, username, and password are set by the BXML document that creates the conference,
45+
* and all events related to that conference will be delivered to that same endpoint. If more calls join afterwards and also have this property (or any other webhook related properties like username and password),
46+
* they will be ignored and the original webhook information will be used. This URL may be a relative endpoint.
47+
* @param conferenceEventMethod (str, optional): The HTTP method to use for the request to conferenceEventUrl. GET or POST. Default value is POST.
48+
* @param conferenceEventFallbackUrl (str, optional): A fallback url which, if provided, will be used to retry the conference webhook deliveries in case conferenceEventUrl fails to respond.
49+
* @param conferenceEventFallbackMethod (str, optional): The HTTP method to use to deliver the conference webhooks to conferenceEventFallbackUrl. GET or POST. Default value is POST.
50+
* @param username (str, optional):The username to send in the HTTP request to conferenceEventUrl.
51+
* @param password (str, optional): The password to send in the HTTP request to conferenceEventUrl.
52+
* @param fallbackUsername (str, optional): The username to send in the HTTP request to conferenceEventFallbackUrl.
53+
* @param fallbackPassword (str, optional): The password to send in the HTTP request to conferenceEventFallbackUrl.
54+
* @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 <Tag> verb, or cleared. May be cleared by setting tag="".
55+
* Max length 256 characters. Defaults to None.
56+
* @param callbackTimeout (str, optional): This is the timeout (in seconds) to use when delivering webhooks for the conference.
57+
* If not set, it will inherit the webhook timeout from the call that creates the conference. Can be any numeric value (including decimals) between 1 and 25 * @parameter
58+
* Nested Verbs:
59+
* @param PlayAudio: (optional)
60+
* @param SpeakSentence: (optional)
61+
* @param StartRecording: (optional)
62+
* @param StopRecording: (optional)
63+
* @param PauseRecording: (optional)
64+
* @param ResumeRecording: (optional)
65+
*/
66+
67+
public static final String TYPE_NAME = "Conference";
68+
69+
@XmlValue
70+
@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
71+
protected String name;
72+
73+
@XmlAttribute
74+
@Default
75+
protected Boolean mute = false;
76+
77+
@XmlAttribute
78+
@Default
79+
protected Boolean hold = false;
80+
81+
@XmlAttribute
82+
protected String conferenceEventUrl;
83+
84+
@XmlAttribute
85+
@Default
86+
protected String conferenceEventMethod = DEFAULT_CALLBACK_METHOD;
87+
88+
@XmlAttribute
89+
protected String conferenceEventFallbackUrl;
90+
91+
@XmlAttribute
92+
@Default
93+
protected String conferenceEventFallbackMethod = DEFAULT_CALLBACK_METHOD;
94+
95+
@XmlAttribute
96+
protected Double callbackTimeout;
97+
98+
@XmlAttribute
99+
protected String tag;
100+
101+
@XmlAttribute
102+
protected String username;
103+
104+
@XmlAttribute
105+
protected String password;
106+
107+
@XmlAttribute
108+
protected String fallbackUsername;
109+
110+
@XmlAttribute
111+
protected String fallbackPassword;
112+
113+
@XmlAttribute
114+
@Default
115+
protected String callIdsToCoach = DEFAULT_EMPTY_STRING;
116+
117+
@Override
118+
public String getVerbName() {
119+
return TYPE_NAME;
120+
}
121+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* The {@code <CustomParam>} verb is used to define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started.
3+
* You may specify up to 12 {@code <CustomParam>} elements nested within a {@code <StartTranscription>} tag.
4+
*/
5+
6+
package org.openapitools.client.model.bxml;
7+
8+
9+
import jakarta.xml.bind.annotation.XmlAccessType;
10+
import jakarta.xml.bind.annotation.XmlAccessorType;
11+
import jakarta.xml.bind.annotation.XmlAttribute;
12+
import jakarta.xml.bind.annotation.XmlType;
13+
import lombok.AllArgsConstructor;
14+
import lombok.Builder;
15+
import lombok.Data;
16+
import lombok.NoArgsConstructor;
17+
18+
@XmlType(name = CustomParam.TYPE_NAME)
19+
@XmlAccessorType(XmlAccessType.FIELD)
20+
@Data
21+
@Builder
22+
@NoArgsConstructor
23+
@AllArgsConstructor
24+
public class CustomParam {
25+
/**
26+
*
27+
* @param name (str): The name of this parameter, up to 256 characters.
28+
* @param value (str): The value of this parameter, up to 2048 characters.
29+
*
30+
*/
31+
public static final String TYPE_NAME = "CustomParam";
32+
33+
@XmlAttribute
34+
protected String name;
35+
@XmlAttribute
36+
protected String value;
37+
}

0 commit comments

Comments
 (0)