Skip to content

create_sip_rule

create_sip_rule(
    name: SipRuleName,
    trigger_type: SipRuleTriggerType,
    trigger_value: NonEmptyString,
    target_applications: SipRuleTargetApplicationList,
    *,
    config_overrides: Optional[ChimeSDKVoiceClientConfig] = None,
    disabled: Optional[NullableBoolean] = None,
) -> CreateSipRuleResponse

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.

Parameters:

  • name (SipRuleName) –

    The name of the SIP rule.

  • trigger_type (SipRuleTriggerType) –

    The type of trigger assigned to the SIP rule in TriggerValue, currently RequestUriHostname or ToPhoneNumber.

  • trigger_value (NonEmptyString) –

    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.

  • disabled (Optional[NullableBoolean], default: None ) –

    Disables or enables a SIP rule. You must disable SIP rules before you can delete them.

  • target_applications (SipRuleTargetApplicationList) –

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

Raises:

Source code in docs_src/capo_chime_sdk_voice/_services/chime_sdk_voice.py
def create_sip_rule(
    self,
    name: "capo_chime_sdk_voice.types.sip_rule_name.SipRuleName",
    trigger_type: "capo_chime_sdk_voice.types.sip_rule_trigger_type.SipRuleTriggerType",
    trigger_value: "capo_chime_sdk_voice.types.non_empty_string.NonEmptyString",
    target_applications: "capo_chime_sdk_voice.types.sip_rule_target_application_list.SipRuleTargetApplicationList",
    *,
    config_overrides: Optional[ChimeSDKVoiceClientConfig] = None,
    disabled: Optional[
        "capo_chime_sdk_voice.types.nullable_boolean.NullableBoolean"
    ] = None,
) -> "capo_chime_sdk_voice.types.create_sip_rule_response.CreateSipRuleResponse":
    """<p>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 <a href="https://docs.aws.amazon.com/chime-sdk/latest/ag/manage-sip-applications.html">Managing SIP media applications and rules</a> in the <i>Amazon Chime SDK Administrator Guide</i>.</p>

    Args:
        name: <p>The name of the SIP rule.</p>
        trigger_type: <p>The type of trigger assigned to the SIP rule in <code>TriggerValue</code>, currently <code>RequestUriHostname</code> or <code>ToPhoneNumber</code>.</p>
        trigger_value: <p>If <code>TriggerType</code> is <code>RequestUriHostname</code>, the value can be the outbound host name of a Voice Connector. If <code>TriggerType</code> is <code>ToPhoneNumber</code>, the value can be a customer-owned phone number in the E164 format. The <code>SipMediaApplication</code> specified in the <code>SipRule</code> is triggered if the request URI in an incoming SIP request matches the <code>RequestUriHostname</code>, or if the <code>To</code> header in the incoming SIP request matches the <code>ToPhoneNumber</code> value.</p>
        disabled: <p>Disables or enables a SIP rule. You must disable SIP rules before you can delete them.</p>
        target_applications: <p>List of SIP media applications, with priority and AWS Region. Only one SIP application per AWS Region can be used.</p>

    Raises:
        capo_chime_sdk_voice.errors.access_denied_exception.AccessDeniedException: <p>You don't have the permissions needed to run this action.</p>
        capo_chime_sdk_voice.errors.bad_request_exception.BadRequestException: <p>The input parameters don't match the service's restrictions.</p>
        capo_chime_sdk_voice.errors.conflict_exception.ConflictException: <p>Multiple instances of the same request were made simultaneously.</p>
        capo_chime_sdk_voice.errors.forbidden_exception.ForbiddenException: <p>The client is permanently forbidden from making the request.</p>
        capo_chime_sdk_voice.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>The request exceeds the resource limit.</p>
        capo_chime_sdk_voice.errors.service_failure_exception.ServiceFailureException: <p>The service encountered an unexpected error.</p>
        capo_chime_sdk_voice.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_chime_sdk_voice.errors.throttled_client_exception.ThrottledClientException: <p>The number of customer requests exceeds the request rate limit.</p>
        capo_chime_sdk_voice.errors.unauthorized_client_exception.UnauthorizedClientException: <p>The client isn't authorized to request a resource.</p>
        capo_chime_sdk_voice.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_chime_sdk_voice.types.create_sip_rule_request.CreateSipRuleRequest]",
    ) -> OperationResponse[
        "capo_chime_sdk_voice.types.create_sip_rule_response.CreateSipRuleResponse"
    ]:
        import capo_chime_sdk_voice._operations.chime_sdk_telephony_service.create_sip_rule

        output, http_response = (
            capo_chime_sdk_voice._operations.chime_sdk_telephony_service.create_sip_rule.create_sip_rule(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateSipRule")
    )
    input_: capo_chime_sdk_voice.types.create_sip_rule_request.CreateSipRuleRequest = {
        "name": name,
        "trigger_type": trigger_type,
        "trigger_value": trigger_value,
        "target_applications": target_applications,
    }
    if disabled is not None:
        input_["disabled"] = disabled

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output