createSipRule method

Future<CreateSipRuleResponse> createSipRule({
  1. required String name,
  2. required List<SipRuleTargetApplication> targetApplications,
  3. required SipRuleTriggerType triggerType,
  4. required String triggerValue,
  5. bool? disabled,
})

Creates a SIP rule which can be used to run a SIP media application as a target for a specific trigger type.

May throw BadRequestException. May throw ForbiddenException. May throw AccessDeniedException. May throw UnauthorizedClientException. May throw ThrottledClientException. May throw ResourceLimitExceededException. May throw ConflictException. May throw ServiceUnavailableException. May throw ServiceFailureException.

Parameter name : The name of the SIP rule.

Parameter targetApplications : List of SIP media applications with priority and AWS Region. Only one SIP application per AWS Region can be used.

Parameter triggerType : The type of trigger whose value is assigned to the SIP rule in TriggerValue. Allowed trigger values are RequestUriHostname and ToPhoneNumber.

Parameter triggerValue : If TriggerType is RequestUriHostname then the value can be the outbound host name of an Amazon Chime Voice Connector. If TriggerType is ToPhoneNumber then the value can be a customer-owned phone number in E164 format. SipRule is triggered if the SIP application requests a host name, or a If TriggerType is RequestUriHostname, then the value can be the outbound hostname of an Amazon Chime Voice Connector. If TriggerType is ToPhoneNumber, then the value can be a customer-owned phone number in E164 format. SipRule is triggered if the SIP application requests a host name, or a ToPhoneNumber value matches the incoming SIP request.

Parameter disabled : Enables or disables a rule. You must disable rules before you can delete them.

Implementation

Future<CreateSipRuleResponse> createSipRule({
  required String name,
  required List<SipRuleTargetApplication> targetApplications,
  required SipRuleTriggerType triggerType,
  required String triggerValue,
  bool? disabled,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(targetApplications, 'targetApplications');
  ArgumentError.checkNotNull(triggerType, 'triggerType');
  ArgumentError.checkNotNull(triggerValue, 'triggerValue');
  final $payload = <String, dynamic>{
    'Name': name,
    'TargetApplications': targetApplications,
    'TriggerType': triggerType.toValue(),
    'TriggerValue': triggerValue,
    if (disabled != null) 'Disabled': disabled,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/sip-rules',
    exceptionFnMap: _exceptionFns,
  );
  return CreateSipRuleResponse.fromJson(response);
}