startOutboundVoiceContact method

Future<StartOutboundVoiceContactResponse> startOutboundVoiceContact({
  1. required String contactFlowId,
  2. required String destinationPhoneNumber,
  3. required String instanceId,
  4. AnswerMachineDetectionConfig? answerMachineDetectionConfig,
  5. Map<String, String>? attributes,
  6. String? campaignId,
  7. String? clientToken,
  8. String? description,
  9. String? name,
  10. OutboundStrategy? outboundStrategy,
  11. String? queueId,
  12. Map<String, Reference>? references,
  13. String? relatedContactId,
  14. int? ringTimeoutInSeconds,
  15. String? sourcePhoneNumber,
  16. TrafficType? trafficType,
})

Places an outbound call to a contact, and then initiates the flow. It performs the actions in the flow that's specified (in ContactFlowId).

Agents do not initiate the outbound API, which means that they do not dial the contact. If the flow places an outbound call to a contact, and then puts the contact in queue, the call is then routed to the agent, like any other inbound case.

Dialing timeout for this operation can be configured with the “RingTimeoutInSeconds” parameter. If not specified, the default dialing timeout will be 60 seconds which means if the call is not connected within 60 seconds, it fails.

May throw DestinationNotAllowedException. May throw InternalServiceException. May throw InvalidParameterException. May throw InvalidRequestException. May throw LimitExceededException. May throw OutboundContactNotPermittedException. May throw ResourceNotFoundException.

Parameter contactFlowId : The identifier of the flow for the outbound call. To see the ContactFlowId in the Connect Customer admin website, on the navigation menu go to Routing, Contact Flows. Choose the flow. On the flow page, under the name of the flow, choose Show additional flow information. The ContactFlowId is the last part of the ARN, shown here in bold:

arn:aws:connect:us-west-2:xxxxxxxxxxxx:instance/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/contact-flow/846ec553-a005-41c0-8341-xxxxxxxxxxxx

Parameter destinationPhoneNumber : The phone number of the customer, in E.164 format.

Parameter instanceId : The identifier of the Connect Customer instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.

Parameter answerMachineDetectionConfig : Configuration of the answering machine detection for this outbound call.

Parameter attributes : A custom key-value pair using an attribute map. The attributes are standard Connect Customer attributes, and can be accessed in flows just like any other contact attributes.

There can be up to 32,768 UTF-8 bytes across all key-value pairs per contact. Attribute keys can include only alphanumeric, dash, and underscore characters.

Parameter campaignId : The campaign identifier of the outbound communication.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see Making retries safe with idempotent APIs. The token is valid for 7 days after creation. If a contact is already started, the contact ID is returned.

Parameter description : A description of the voice contact that appears in the agent's snapshot in the CCP logs. For more information about CCP logs, see Download and review CCP logs in the Connect Customer Administrator Guide.

Parameter name : The name of a voice contact that is shown to an agent in the Contact Control Panel (CCP).

Parameter outboundStrategy : Information about the outbound strategy.

Parameter queueId : The queue for the call. If you specify a queue, the phone displayed for caller ID is the phone number specified in the queue. If you do not specify a queue, the queue defined in the flow is used. If you do not specify a queue, you must specify a source phone number.

Parameter references : A formatted URL that is shown to an agent in the Contact Control Panel (CCP). Contacts can have the following reference types at the time of creation: URL | NUMBER | STRING | DATE | EMAIL. ATTACHMENT is not a supported reference type during voice contact creation.

Parameter relatedContactId : The contactId that is related to this contact. Linking voice, task, or chat by using RelatedContactID copies over contact attributes from the related contact to the new contact. All updates to user-defined attributes in the new contact are limited to the individual contact ID. There are no limits to the number of contacts that can be linked by using RelatedContactId.

Parameter ringTimeoutInSeconds : The maximum time the outbound call will wait for the destination to answer the call, in seconds

Parameter sourcePhoneNumber : The phone number associated with the Connect Customer instance, in E.164 format. If you do not specify a source phone number, you must specify a queue.

Parameter trafficType : Denotes the class of traffic. Calls with different traffic types are handled differently by Connect Customer. The default value is GENERAL. Use CAMPAIGN if EnableAnswerMachineDetection is set to true. For all other cases, use GENERAL.

Implementation

Future<StartOutboundVoiceContactResponse> startOutboundVoiceContact({
  required String contactFlowId,
  required String destinationPhoneNumber,
  required String instanceId,
  AnswerMachineDetectionConfig? answerMachineDetectionConfig,
  Map<String, String>? attributes,
  String? campaignId,
  String? clientToken,
  String? description,
  String? name,
  OutboundStrategy? outboundStrategy,
  String? queueId,
  Map<String, Reference>? references,
  String? relatedContactId,
  int? ringTimeoutInSeconds,
  String? sourcePhoneNumber,
  TrafficType? trafficType,
}) async {
  _s.validateNumRange(
    'ringTimeoutInSeconds',
    ringTimeoutInSeconds,
    15,
    60,
  );
  final $payload = <String, dynamic>{
    'ContactFlowId': contactFlowId,
    'DestinationPhoneNumber': destinationPhoneNumber,
    'InstanceId': instanceId,
    if (answerMachineDetectionConfig != null)
      'AnswerMachineDetectionConfig': answerMachineDetectionConfig,
    if (attributes != null) 'Attributes': attributes,
    if (campaignId != null) 'CampaignId': campaignId,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (description != null) 'Description': description,
    if (name != null) 'Name': name,
    if (outboundStrategy != null) 'OutboundStrategy': outboundStrategy,
    if (queueId != null) 'QueueId': queueId,
    if (references != null) 'References': references,
    if (relatedContactId != null) 'RelatedContactId': relatedContactId,
    if (ringTimeoutInSeconds != null)
      'RingTimeoutInSeconds': ringTimeoutInSeconds,
    if (sourcePhoneNumber != null) 'SourcePhoneNumber': sourcePhoneNumber,
    if (trafficType != null) 'TrafficType': trafficType.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/contact/outbound-voice',
    exceptionFnMap: _exceptionFns,
  );
  return StartOutboundVoiceContactResponse.fromJson(response);
}