Class ConnectOptions.Builder
- java.lang.Object
-
- com.twilio.voice.CallOptions.Builder
-
- com.twilio.voice.ConnectOptions.Builder
-
- Enclosing class:
- ConnectOptions
public static class ConnectOptions.Builder extends CallOptions.Builder
Build newConnectOptions
.All methods are optional.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectOptions
build()
BuildsConnectOptions
object.ConnectOptions.Builder
enableDscp(boolean enable)
Enable Differentiated Services Field Code Point (DSCP) with Expedited Forwarding (EF).ConnectOptions.Builder
enableIceGatheringOnAnyAddressPorts(boolean enable)
Enable gathering of ICE candidates on "any address" ports.ConnectOptions.Builder
iceOptions(IceOptions iceOptions)
Custom ICE configuration used to connect to a Call.ConnectOptions.Builder
params(java.util.Map<java.lang.String,java.lang.String> params)
Set the parameters that are passed to the TwiML application specified by the access token.ConnectOptions.Builder
preferAudioCodecs(java.util.List<AudioCodec> preferredAudioCodecs)
Set preferred audio codecs.
-
-
-
Constructor Detail
-
Builder
public Builder(@NonNull java.lang.String accessToken)
Use this Builder when making aCall
The maximum number of characters for the identity provided in the token is 121. The identity may only contain alpha-numeric and underscore characters. Other characters, including spaces, or exceeding the maximum number of characters, will result in not being able to place or receive calls.
- Parameters:
accessToken
- The accessToken that provides the identity and grants of the caller in a JSON Web Token(JWT) format.
-
-
Method Detail
-
params
@NonNull public ConnectOptions.Builder params(@NonNull java.util.Map<java.lang.String,java.lang.String> params)
Set the parameters that are passed to the TwiML application specified by the access token.Parameters specified in this map will be provided as HTTP GET query params or as part of the HTTP POST body to the request url specified in your TwiML Application (https://www.twilio.com/console/voice/twiml/apps). These parameters can be used to configure the behavior of your call within the context of your TwiML Application. NOTE: The Voice SDK URI encodes the parameters before passing them to your TwiML Application.
-
iceOptions
@NonNull public ConnectOptions.Builder iceOptions(@NonNull IceOptions iceOptions)
Custom ICE configuration used to connect to a Call.
-
enableDscp
@NonNull public ConnectOptions.Builder enableDscp(@NonNull boolean enable)
Enable Differentiated Services Field Code Point (DSCP) with Expedited Forwarding (EF).- Parameters:
enable
- Enable DSCP. Defaults totrue
.
-
enableIceGatheringOnAnyAddressPorts
@NonNull public ConnectOptions.Builder enableIceGatheringOnAnyAddressPorts(@NonNull boolean enable)
Enable gathering of ICE candidates on "any address" ports. When this flag is set, ports not bound to any specific network interface will be used, in addition to normal ports bound to the enumerated interfaces. This flag may need to be set to support certain network configurations (e.g. some VPN implementations) where ports are not bound to specific interfaces. Setting this flag means that additional candidates might need to be gathered and evaluated, which could lead to slower ICE connection times for regular networks.- Parameters:
enable
- Enable ICE candidates on "any address" ports. Defaults tofalse
.
-
preferAudioCodecs
@NonNull public ConnectOptions.Builder preferAudioCodecs(@NonNull java.util.List<AudioCodec> preferredAudioCodecs)
Set preferred audio codecs. The list specifies which audio codecs would be preferred when negotiating audio with the backend service. The preferences are applied in the order found in the list starting with the most preferred audio codec to the least preferred audio codec. Audio codec preferences are not guaranteed to be satisfied because the backend service is not guaranteed to support all audio codecs.The following snippet demonstrates how to prefer a single audio codec.
ConnectOptions connectOptions = new ConnectOptions.Builder(token) .preferAudioCodecs(Collections.<AudioCodec>singletonList(new PcmuCodec())) .build();
The following snippet demonstrates how to specify the exact order of codec preferences.
ConnectOptions connectOptions = new ConnectOptions.Builder(token) .preferAudioCodecs(Arrays.asList(new PcmuCodec(), new OpusCodec())) .build();
-
build
@NonNull public ConnectOptions build()
BuildsConnectOptions
object.
-
-