com.bandwidth.voice.bxml.verbs.Transfer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bandwidth-sdk Show documentation
Show all versions of bandwidth-sdk Show documentation
The official client SDK for Bandwidth's Voice, Messaging, MFA, and WebRTC APIs
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.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* The Transfer verb is used to bridge another party onto the current call.
*/
@Builder
@XmlType(name = Transfer.TYPE_NAME)
public class Transfer implements Verb {
public static final String TYPE_NAME = "Transfer";
/**
* A collection of phone numbers to transfer the call to. The first to answer will be transferred.
*/
@XmlElement(name = PhoneNumber.TYPE_NAME)
private final List phoneNumbers;
/**
* A collection of SipUris to transfer the call to. The first to answer will be transferred.
*/
@XmlElement(name = SipUri.TYPE_NAME)
private final List sipUris;
/**
* (optional) The caller ID to use when the call is transferred, if different. Must be in E.164 format (e.g. +15555555555).
*
* Note: Leave blank to pass along the number of the remote party
*/
@XmlAttribute
private String transferCallerId;
/**
* (optional) This is the timeout (in seconds) for the callee to answer the call. Range: decimal values between 1 - 300
*/
@XmlAttribute
private Double callTimeout;
/**
* (optional) URL to send the Transfer Complete event to and request new BXML.
*/
@XmlAttribute
private URI transferCompleteUrl;
/**
* (optional) The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST.
*/
@XmlAttribute
private Method transferCompleteMethod;
/**
* (optional) The username to send in the HTTP request to transferCompleteUrl.
*/
@XmlAttribute
protected String username;
/**
* (optional) The password to send in the HTTP request to transferCompleteUrl.
*/
@XmlAttribute
protected String password;
/**
* (optional) A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared.
*
* May be cleared by setting tag=""
*
* Max length 256 characters.
*/
@XmlAttribute
private String tag;
/**
* (optional) Can be any of the following:
*
* none: No diversion headers are sent on the outbound leg of the transferred call.
*
* propagate: Copy the Diversion header from the inbound leg to the outbound leg. Ignored if there is no Diversion header present on the inbound leg.
*
* stack: After propagating any Diversion header from the inbound leg to the outbound leg, stack on top another Diversion header based on the Request-URI of the inbound call.
*
*/
@XmlAttribute
private String diversionTreatment;
/**
* (optional) This parameter is considered only when diversionTreatment is set to stack.
*
* Can be any of the following Strings:
*
* unknown
*
* user-busy
*
* no-answer
*
* unavailable
*
* unconditional
*
* time-of-day
*
* do-not-disturb
*
* deflection
*
* follow-me
*
* out-of-service
*
* away
*
*/
@XmlAttribute
private String diversionReason;
@XmlAttribute
protected String fallbackUsername;
@XmlAttribute
protected String fallbackPassword;
@XmlAttribute
protected URI transferCompleteFallbackUrl;
@XmlAttribute
protected Method transferCompleteFallbackMethod;
public static class TransferBuilder {
/**
* (optional) URL to send the Transfer Complete event to and request new BXML.
*/
public TransferBuilder transferCompleteUrl(URI uri){
this.transferCompleteUrl = uri;
return this;
}
/**
* (optional) URL to send the Transfer Complete event to and request new BXML. Converts String using URI.create(uri)
*/
public TransferBuilder transferCompleteUrl(String uri){
return transferCompleteUrl(URI.create(uri));
}
public TransferBuilder transferCompleteFallbackUrl(URI uri){
this.transferCompleteFallbackUrl = uri;
return this;
}
public TransferBuilder transferCompleteFallbackUrl(String uri){
return transferCompleteFallbackUrl(URI.create(uri));
}
/**
* (optional) The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST.
*/
public TransferBuilder transferCompleteMethod(Method method){
this.transferCompleteMethod = method;
return this;
}
/**
* (optional) The HTTP method to use for the request to transferCompleteUrl. GET or POST. Default value is POST. Converts from String using Method.fromValue(method)
*/
public TransferBuilder transferCompleteMethod(String method){
return transferCompleteMethod(Method.fromValue(method));
}
public TransferBuilder transferCompleteFallbackMethod(Method method){
this.transferCompleteFallbackMethod = method;
return this;
}
public TransferBuilder transferCompleteFallbackMethod(String method){
return transferCompleteFallbackMethod(Method.fromValue(method));
}
/**
* A collection of phone numbers to transfer the call to. The first to answer will be transferred.
*/
public TransferBuilder phoneNumbers(PhoneNumber ... phoneNumbers){
this.phoneNumbers = Arrays.asList(phoneNumbers);
return this;
}
/**
* A collection of phone numbers to transfer the call to. The first to answer will be transferred.
*/
public TransferBuilder phoneNumbers(List phoneNumbers){
this.phoneNumbers = phoneNumbers;
return this;
}
}
}