createProxySession method

Future<CreateProxySessionResponse> createProxySession({
  1. required List<Capability> capabilities,
  2. required List<String> participantPhoneNumbers,
  3. required String voiceConnectorId,
  4. int? expiryMinutes,
  5. GeoMatchLevel? geoMatchLevel,
  6. GeoMatchParams? geoMatchParams,
  7. String? name,
  8. NumberSelectionBehavior? numberSelectionBehavior,
})

Creates a proxy session on the specified Amazon Chime Voice Connector for the specified participant phone numbers.

May throw UnauthorizedClientException. May throw NotFoundException. May throw ForbiddenException. May throw BadRequestException. May throw ThrottledClientException. May throw ServiceUnavailableException. May throw ServiceFailureException.

Parameter capabilities : The proxy session capabilities.

Parameter participantPhoneNumbers : The participant phone numbers.

Parameter voiceConnectorId : The Amazon Chime voice connector ID.

Parameter expiryMinutes : The number of minutes allowed for the proxy session.

Parameter geoMatchLevel : The preference for matching the country or area code of the proxy phone number with that of the first participant.

Parameter geoMatchParams : The country and area code for the proxy phone number.

Parameter name : The name of the proxy session.

Parameter numberSelectionBehavior : The preference for proxy phone number reuse, or stickiness, between the same participants across sessions.

Implementation

Future<CreateProxySessionResponse> createProxySession({
  required List<Capability> capabilities,
  required List<String> participantPhoneNumbers,
  required String voiceConnectorId,
  int? expiryMinutes,
  GeoMatchLevel? geoMatchLevel,
  GeoMatchParams? geoMatchParams,
  String? name,
  NumberSelectionBehavior? numberSelectionBehavior,
}) async {
  ArgumentError.checkNotNull(capabilities, 'capabilities');
  ArgumentError.checkNotNull(
      participantPhoneNumbers, 'participantPhoneNumbers');
  ArgumentError.checkNotNull(voiceConnectorId, 'voiceConnectorId');
  _s.validateStringLength(
    'voiceConnectorId',
    voiceConnectorId,
    1,
    128,
    isRequired: true,
  );
  _s.validateNumRange(
    'expiryMinutes',
    expiryMinutes,
    1,
    1152921504606846976,
  );
  final $payload = <String, dynamic>{
    'Capabilities': capabilities.map((e) => e.toValue()).toList(),
    'ParticipantPhoneNumbers': participantPhoneNumbers,
    if (expiryMinutes != null) 'ExpiryMinutes': expiryMinutes,
    if (geoMatchLevel != null) 'GeoMatchLevel': geoMatchLevel.toValue(),
    if (geoMatchParams != null) 'GeoMatchParams': geoMatchParams,
    if (name != null) 'Name': name,
    if (numberSelectionBehavior != null)
      'NumberSelectionBehavior': numberSelectionBehavior.toValue(),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/voice-connectors/${Uri.encodeComponent(voiceConnectorId)}/proxy-sessions',
    exceptionFnMap: _exceptionFns,
  );
  return CreateProxySessionResponse.fromJson(response);
}