createSipRule method
Creates a SIP rule, which can be used to run a SIP media application as a target for a specific trigger type. For more information about SIP rules, see Managing SIP media applications and rules in the Amazon Chime SDK Administrator Guide.
May throw AccessDeniedException.
May throw BadRequestException.
May throw ConflictException.
May throw ForbiddenException.
May throw ResourceLimitExceededException.
May throw ServiceFailureException.
May throw ServiceUnavailableException.
May throw ThrottledClientException.
May throw UnauthorizedClientException.
Parameter name :
The name of the SIP rule.
Parameter triggerType :
The type of trigger assigned to the SIP rule in TriggerValue,
currently RequestUriHostname or ToPhoneNumber.
Parameter triggerValue :
If TriggerType is RequestUriHostname, the value
can be the outbound host name of a Voice Connector. If
TriggerType is ToPhoneNumber, the value can be a
customer-owned phone number in the E164 format. The
SipMediaApplication specified in the SipRule is
triggered if the request URI in an incoming SIP request matches the
RequestUriHostname, or if the To header in the
incoming SIP request matches the ToPhoneNumber value.
Parameter disabled :
Disables or enables a SIP rule. You must disable SIP rules before you can
delete them.
Parameter targetApplications :
List of SIP media applications, with priority and AWS Region. Only one SIP
application per AWS Region can be used.
Implementation
Future<CreateSipRuleResponse> createSipRule({
required String name,
required SipRuleTriggerType triggerType,
required String triggerValue,
bool? disabled,
List<SipRuleTargetApplication>? targetApplications,
}) async {
final $payload = <String, dynamic>{
'Name': name,
'TriggerType': triggerType.value,
'TriggerValue': triggerValue,
if (disabled != null) 'Disabled': disabled,
if (targetApplications != null) 'TargetApplications': targetApplications,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/sip-rules',
exceptionFnMap: _exceptionFns,
);
return CreateSipRuleResponse.fromJson(response);
}