001package com.plivo.api.xml;
002
003import com.plivo.api.models.multipartycall.MultiPartyCallParticipantAdd;
004import com.plivo.api.serializers.DelimitedListXMLSerializer;
005import com.plivo.api.validators.InRange;
006import com.plivo.api.validators.MultiOf;
007import com.plivo.api.validators.OneOf;
008import com.plivo.api.validators.UrlValues;
009
010import javax.xml.bind.annotation.XmlAttribute;
011import javax.xml.bind.annotation.XmlRootElement;
012import javax.xml.bind.annotation.XmlValue;
013import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
014import java.util.Arrays;
015import java.util.List;
016
017@XmlRootElement(name = "MultiPartyCall")
018public class MultiPartyCall extends PlivoXml implements ResponseNestable {
019
020  @XmlAttribute
021  private String role;
022
023  @XmlAttribute
024  @InRange(message = "must be in range [300-28800]", min = 300, max = 28800)
025  private Integer maxDuration = 14400;
026
027  @XmlAttribute
028  @InRange(message = "must be in range [2-10]", min = 2, max = 10)
029  private Integer maxParticipants = 10;
030
031  @XmlAttribute
032  @InRange(message = "must be in range [1-2]", min = 1, max = 2)
033  private Integer recordMinMemberCount = 1;
034
035  @XmlAttribute
036  @UrlValues
037  private String waitMusicUrl;
038
039  @XmlAttribute
040  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
041  private String waitMusicMethod = "GET";
042
043  @XmlAttribute
044  @UrlValues
045  private String agentHoldMusicUrl;
046
047  @XmlAttribute
048  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
049  private String agentHoldMusicMethod = "GET";
050
051  @XmlAttribute
052  @UrlValues
053  private String customerHoldMusicUrl;
054
055  @XmlAttribute
056  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
057  private String customerHoldMusicMethod = "GET";
058
059  @XmlAttribute
060  private Boolean record = false;
061
062  @XmlAttribute
063  @OneOf(message = "should be one of [mp3, wav]", options = {"mp3", "wav"})
064  private String recordFileFormat = "mp3";
065
066  @XmlAttribute
067  @UrlValues
068  private String recordingCallbackUrl;
069
070  @XmlAttribute
071  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
072  private String recordingCallbackMethod = "POST";
073
074  @XmlAttribute
075  @XmlJavaTypeAdapter(DelimitedListXMLSerializer.class)
076  @MultiOf(message = "should be among [mpc-state-changes, participant-state-changes, participant-speak-events, participant-digit-input-events, add-participant-api-events]", options = {"mpc-state-changes", "participant-state-changes", "participant-speak-events", "participant-digit-input-events", "add-participant-api-events"})
077  private List<String> statusCallbackEvents = Arrays.asList("mpc-state-changes", "participant-state-changes");
078
079  @XmlAttribute
080  @UrlValues
081  private String statusCallbackUrl;
082
083  @XmlAttribute
084  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
085  private String statusCallbackMethod ="POST";
086
087  @XmlAttribute
088  private Boolean stayAlone = false;
089
090  @XmlAttribute
091  private Boolean coachMode = true;
092
093  @XmlAttribute
094  private Boolean mute = false;
095
096  @XmlAttribute
097  private Boolean hold = false;
098
099  @XmlAttribute
100  private Boolean startMpcOnEnter = true;
101
102  @XmlAttribute
103  private Boolean endMpcOnExit = false;
104
105  @XmlAttribute
106  @UrlValues(message = "should be a valid URL or one of ['beep:1', 'beep:2', 'none']", options = {"beep:1", "beep:2", "none"})
107  private String enterSound = "beep:1";
108
109  @XmlAttribute
110  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
111  private String enterSoundMethod = "GET";
112
113  @XmlAttribute
114  @UrlValues(message = "should be a valid URL or one of ['beep:1', 'beep:2', 'none']", options = {"beep:1", "beep:2", "none"})
115  private String exitSound = "beep:2";
116
117  @XmlAttribute
118  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
119  private String exitSoundMethod = "GET";
120
121  @XmlAttribute
122  @UrlValues
123  private String onExitActionUrl;
124
125  @XmlAttribute
126  @OneOf(message = "should be one of [GET, POST]", options = {"GET", "POST"})
127  private String onExitActionMethod ="POST";
128
129  @XmlAttribute
130  private Boolean relayDtmfInputs = false;
131
132  @XmlValue
133  private String name;
134
135  @XmlAttribute
136  @UrlValues
137  private String startRecordingAudio;
138
139  @XmlAttribute
140  @OneOf(message = "should be one of['GET',POST']", options = {"GET", "POST"})
141  private String startRecordingAudioMethod = "GET";
142
143  @XmlAttribute
144  @UrlValues
145  private String stopRecordingAudio;
146
147  @XmlAttribute
148  @OneOf(message = "should be one of['GET',POST']", options = {"GET", "POST"})
149  private String stopRecordingAudioMethod = "GET";
150
151  private MultiPartyCall() {
152
153  }
154
155  public MultiPartyCall(String name, String role) {
156    if (name == null) {
157      throw new IllegalArgumentException("multiPartyCall name cannot be null");
158    }
159
160    if (role == null) {
161      throw new IllegalArgumentException("multiPartyCall participant role cannot be null");
162    }
163
164    this.name = name;
165    this.role = role;
166  }
167
168  public String role() {
169    return role;
170  }
171
172  public Integer maxDuration() {
173    return maxDuration;
174  }
175
176  public Integer maxParticipants() {
177    return maxParticipants;
178  }
179
180  public Integer recordMinMemberCount() {
181    return recordMinMemberCount;
182  }
183
184  public String waitMusicUrl() {
185    return waitMusicUrl;
186  }
187
188  public String waitMusicMethod() {
189    return waitMusicMethod;
190  }
191
192  public String agentHoldMusicUrl() {
193    return agentHoldMusicUrl;
194  }
195
196  public String agentHoldMusicMethod() {
197    return agentHoldMusicMethod;
198  }
199
200  public String customerHoldMusicUrl() {
201    return customerHoldMusicUrl;
202  }
203
204  public String customerHoldMusicMethod() {
205    return customerHoldMusicMethod;
206  }
207
208  public Boolean record() {
209    return record;
210  }
211
212  public String recordFileFormat() {
213    return recordFileFormat;
214  }
215
216  public String recordingCallbackUrl() {
217    return recordingCallbackUrl;
218  }
219
220  public String recordingCallbackMethod() {
221    return recordingCallbackMethod;
222  }
223
224  public List<String> statusCallbackEvents() {
225    return statusCallbackEvents;
226  }
227
228  public String statusCallbackUrl() {
229    return statusCallbackUrl;
230  }
231
232  public String statusCallbackMethod() {
233    return statusCallbackMethod;
234  }
235
236  public Boolean stayAlone() {
237    return stayAlone;
238  }
239
240  public Boolean coachMode() {
241    return coachMode;
242  }
243
244  public Boolean mute() {
245    return mute;
246  }
247
248  public Boolean hold() {
249    return hold;
250  }
251
252  public Boolean startMpcOnEnter() {
253    return startMpcOnEnter;
254  }
255
256  public Boolean endMpcOnExit() {
257    return endMpcOnExit;
258  }
259
260  public String enterSound() {
261    return enterSound;
262  }
263
264  public String enterSoundMethod() {
265    return enterSoundMethod;
266  }
267
268  public String exitSound() {
269    return exitSound;
270  }
271
272  public String exitSoundMethod() {
273    return exitSoundMethod;
274  }
275
276  public String onExitActionUrl() {
277    return onExitActionUrl;
278  }
279
280  public String onExitActionMethod() {
281    return onExitActionMethod;
282  }
283
284  public Boolean relayDtmfInputs() {
285    return relayDtmfInputs;
286  }
287
288  public String name() {
289    return name;
290  }
291
292  public String startRecordingAudio() {
293    return startRecordingAudio;
294  }
295
296  public String startRecordingAudioMethod() {
297    return startRecordingAudioMethod;
298  }
299
300  public String stopRecordingAudio() {
301    return stopRecordingAudio;
302  }
303
304  public String stopRecordingAudioMethod() {
305    return stopRecordingAudioMethod;
306  }
307
308  public MultiPartyCall role(String role) {
309    this.role = role;
310    return this;
311  }
312
313  public MultiPartyCall maxDuration(Integer maxDuration) {
314    this.maxDuration = maxDuration;
315    return this;
316  }
317
318  public MultiPartyCall maxParticipants(Integer maxParticipants) {
319    this.maxParticipants = maxParticipants;
320    return this;
321  }
322
323  public MultiPartyCall recordMinMemberCount(Integer recordMinMemberCount) {
324    this.recordMinMemberCount = recordMinMemberCount;
325    return this;
326  }
327
328  public MultiPartyCall waitMusicUrl(String waitMusicUrl) {
329    this.waitMusicUrl = waitMusicUrl;
330    return this;
331  }
332
333  public MultiPartyCall waitMusicMethod(String waitMusicMethod) {
334    this.waitMusicMethod = waitMusicMethod;
335    return this;
336  }
337
338  public MultiPartyCall agentHoldMusicUrl(String agentHoldMusicUrl) {
339    this.agentHoldMusicUrl = agentHoldMusicUrl;
340    return this;
341  }
342
343  public MultiPartyCall agentHoldMusicMethod(String agentHoldMusicMethod) {
344    this.agentHoldMusicMethod = agentHoldMusicMethod;
345    return this;
346  }
347
348  public MultiPartyCall customerHoldMusicUrl(String customerHoldMusicUrl) {
349    this.customerHoldMusicUrl = customerHoldMusicUrl;
350    return this;
351  }
352
353  public MultiPartyCall customerHoldMusicMethod(String customerHoldMusicMethod) {
354    this.customerHoldMusicMethod = customerHoldMusicMethod;
355    return this;
356  }
357
358  public MultiPartyCall record(Boolean record) {
359    this.record = record;
360    return this;
361  }
362
363  public MultiPartyCall recordFileFormat(String recordFileFormat) {
364    this.recordFileFormat = recordFileFormat;
365    return this;
366  }
367
368  public MultiPartyCall recordingCallbackUrl(String recordingCallbackUrl) {
369    this.recordingCallbackUrl = recordingCallbackUrl;
370    return this;
371  }
372
373  public MultiPartyCall recordingCallbackMethod(String recordingCallbackMethod) {
374    this.recordingCallbackMethod = recordingCallbackMethod;
375    return this;
376  }
377
378  public MultiPartyCall statusCallbackEvents(List<String> statusCallbackEvents) {
379    this.statusCallbackEvents = statusCallbackEvents;
380    return this;
381  }
382
383  public MultiPartyCall statusCallbackUrl(String statusCallbackUrl) {
384    this.statusCallbackUrl = statusCallbackUrl;
385    return this;
386  }
387
388  public MultiPartyCall statusCallbackMethod(String statusCallbackMethod) {
389    this.statusCallbackMethod = statusCallbackMethod;
390    return this;
391  }
392
393  public MultiPartyCall stayAlone(Boolean stayAlone) {
394    this.stayAlone = stayAlone;
395    return this;
396  }
397
398  public MultiPartyCall coachMode(Boolean coachMode) {
399    this.coachMode = coachMode;
400    return this;
401  }
402
403  public MultiPartyCall mute(Boolean mute) {
404    this.mute = mute;
405    return this;
406  }
407
408  public MultiPartyCall hold(Boolean hold) {
409    this.hold = hold;
410    return this;
411  }
412
413  public MultiPartyCall startMpcOnEnter(Boolean startMpcOnEnter) {
414    this.startMpcOnEnter = startMpcOnEnter;
415    return this;
416  }
417
418  public MultiPartyCall endMpcOnExit(Boolean endMpcOnExit) {
419    this.endMpcOnExit = endMpcOnExit;
420    return this;
421  }
422
423  public MultiPartyCall enterSound(String enterSound) {
424    this.enterSound = enterSound;
425    return this;
426  }
427
428  public MultiPartyCall enterSoundMethod(String enterSoundMethod) {
429    this.enterSoundMethod = enterSoundMethod;
430    return this;
431  }
432
433  public MultiPartyCall exitSound(String exitSound) {
434    this.exitSound = exitSound;
435    return this;
436  }
437
438  public MultiPartyCall exitSoundMethod(String exitSoundMethod) {
439    this.exitSoundMethod = exitSoundMethod;
440    return this;
441  }
442
443  public MultiPartyCall onExitActionUrl(String onExitActionUrl) {
444    this.onExitActionUrl = onExitActionUrl;
445    return this;
446  }
447
448  public MultiPartyCall onExitActionMethod(String onExitActionMethod) {
449    this.onExitActionMethod = onExitActionMethod;
450    return this;
451  }
452
453  public MultiPartyCall relayDtmfInputs(Boolean relayDtmfInputs) {
454    this.relayDtmfInputs = relayDtmfInputs;
455    return this;
456  }
457
458  public MultiPartyCall name(String name) {
459    this.name = name;
460    return this;
461  }
462
463  public MultiPartyCall startRecordingAudio(String startRecordingAudio) {
464    this.startRecordingAudio = startRecordingAudio;
465    return this;
466  }
467
468  public MultiPartyCall startRecordingAudioMethod(String startRecordingAudioMethod) {
469    this.startRecordingAudioMethod = startRecordingAudioMethod;
470    return this;
471  }
472
473  public MultiPartyCall stopRecordingAudio(String stopRecordingAudio) {
474    this.stopRecordingAudio= stopRecordingAudio;
475    return this;
476  }
477
478  public MultiPartyCall stopRecordingAudioMethod(String stopRecordingAudioMethod) {
479    this.stopRecordingAudioMethod = stopRecordingAudioMethod;
480    return this;
481  }
482}