diff --git a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md index fb19947067b6..7640489dc270 100644 --- a/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md +++ b/sdk/communication/azure-communication-phonenumbers/CHANGELOG.md @@ -1,4 +1,9 @@ # Release History +## 1.1.0b3 (Unreleased) +- Users can now manage SIP configuration for Direct routing. + +### Features Added +- Added new SIP routing client for handling Direct routing numbers. ## 1.1.0b2 (2022-03-30) diff --git a/sdk/communication/azure-communication-phonenumbers/README.md b/sdk/communication/azure-communication-phonenumbers/README.md index 254035e63162..4906bf77c83a 100644 --- a/sdk/communication/azure-communication-phonenumbers/README.md +++ b/sdk/communication/azure-communication-phonenumbers/README.md @@ -20,9 +20,18 @@ pip install azure-communication-phonenumbers ## Key concepts -### Initializing Phone Numbers Client +This SDK provides functionality to easily manage `direct offer` and `direct routing` numbers. + +The `direct offer` numbers come in two types: Geographic and Toll-Free. Geographic phone plans are phone plans associated with a location, whose phone numbers' area codes are associated with the area code of a geographic location. Toll-Free phone plans are phone plans not associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888. +They are managed using the `PhoneNumbersClient` + +The `direct routing` feature enables connecting your existing telephony infrastructure to ACS. +The configuration is managed using the `SipRoutingClient`, which provides methods for setting up SIP trunks and voice routing rules, in order to properly handle calls for your telephony subnet. + +### Initializing Client +Client can be initialized using the AAD authentication. + ```python -# You can find your connection string from your resource in the Azure Portal import os from azure.communication.phonenumbers import PhoneNumbersClient from azure.identity import DefaultAzureCredential @@ -31,10 +40,20 @@ endpoint = "https://.communication.azure.com" # To use Azure Active Directory Authentication (DefaultAzureCredential) make sure to have your # AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET as env variables. phone_numbers_client = PhoneNumbersClient(endpoint, DefaultAzureCredential()) +``` +```python +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient +from azure.identity import DefaultAzureCredential + +endpoint = "https://.communication.azure.com" +# To use Azure Active Directory Authentication (DefaultAzureCredential) make sure to have your +# AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET as env variables. +sip_routing_client = SipRoutingClient(endpoint, DefaultAzureCredential()) ``` -### Initializing the Client Using Your Connection String -Connection string authentication is also available for Phone Numbers Client. + +Another option is to initialize the client using connection string of the resource. ```python # You can find your connection string from your resource in the Azure Portal @@ -45,19 +64,39 @@ connection_str = "endpoint=ENDPOINT;accessKey=KEY" phone_numbers_client = PhoneNumbersClient.from_connection_string(connection_str) ``` -### Phone Number Types overview +```python +# You can find your connection string from your resource in the Azure Portal +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient + +connection_str = "endpoint=ENDPOINT;accessKey=KEY" +sip_routing_client = SipRoutingClient.from_connection_string(connection_str) +``` + +### Phone numbers client + +#### Phone number types overview Phone numbers come in two types; Geographic and Toll-Free. Geographic phone numbers are phone numbers associated with a location, whose area codes are associated with the area code of a geographic location. Toll-Free phone numbers are phone numbers with no associated location. For example, in the US, toll-free numbers can come with area codes such as 800 or 888. -### Searching and Purchasing and Releasing numbers +#### Searching and Purchasing and Releasing numbers Phone numbers can be searched through the search creation API by providing an area code, quantity of phone numbers, application type, phone number type, and capabilities. The provided quantity of phone numbers will be reserved for ten minutes and can be purchased within this time. If the search is not purchased, the phone numbers will become available to others after ten minutes. If the search is purchased, then the phone numbers are acquired for the Azure resources. Phone numbers can also be released using the release API. +### SIP routing client + +Direct routing feature allows connecting customer-provided telephony infrastructure to Azure Communication Resources. In order to setup routing configuration properly, customer needs to supply the SIP trunk configuration and SIP routing rules for calls. SIP routing client provides the necessary interface for setting this configuration. + +When the call arrives, system tries to match the destination number with regex number patterns of defined routes. The first route to match the number will be selected. The order of regex matching is the same as the order of routes in configuration, therefore the order of routes matters. +Once a route is matched, the call is routed to the first trunk in the route's trunks list. If the trunk is not available, next trunk in the list is selected. + ## Examples -### Get All Purchased Phone Numbers +### PhoneNumbersClient + +#### Get All Purchased Phone Numbers Lists all of your purchased phone numbers @@ -67,7 +106,7 @@ for acquired_phone_number in purchased_phone_numbers: print(acquired_phone_number.phone_number) ``` -### Get Purchased Phone Number +#### Get Purchased Phone Number Gets the information from the specified phone number @@ -77,11 +116,11 @@ print(result.country_code) print(result.phone_number) ``` -## Long Running Operations +### Long Running Operations The Phone Number Client supports a variety of long running operations that allow indefinite polling time to the functions listed down below. -### Search for Available Phone Number +#### Search for Available Phone Number You can search for available phone numbers by providing the capabilities of the phone you want to acquire, the phone number type, the assignment type, and the country code. It's worth mentioning that for the toll-free phone number type, proving the area code is optional. The result of the search can then be used to purchase the number in the corresponding API. @@ -103,7 +142,7 @@ poller = phone_numbers_client.begin_search_available_phone_numbers( search_result = poller.result() ``` -### Purchase Phone Numbers +#### Purchase Phone Numbers The result of your search can be used to purchase the specified phone numbers. This can be done by passing the `search_id` from the search response to the purchase phone number API. @@ -114,7 +153,7 @@ purchase_poller = phone_numbers_client.begin_purchase_phone_numbers( ) ``` -### Release Phone Number +#### Release Phone Number Releases an acquired phone number. @@ -125,7 +164,7 @@ poller = self.phone_number_client.begin_release_phone_number( ) ``` -### Updating Phone Number Capabilities +#### Updating Phone Number Capabilities Updates the specified phone number capabilities for Calling and SMS to one of: @@ -143,6 +182,58 @@ poller = self.phone_number_client.begin_update_phone_number_capabilities( ) ``` +### SipRoutingClient + +#### Retrieve SIP trunks and routes + +Get the list of currently configured trunks or routes. + +```python +trunks = sip_routing_client.get_trunks() +for trunk in trunks: + print(trunk.fqdn) + print(trunk.sip_signaling_port) +routes = sip_routing_client.get_routes() +for route in routes: + print(route.name) + print(route.description) + print(route.number_pattern) + for trunk_fqdn in route.trunks: + print(trunk_fqdn) +``` + +#### Replace SIP trunks and routes + +Replace the list of currently configured trunks or routes with new values. + +```python +new_trunks = [SipTrunk(fqdn="sbs1.contoso.com", sip_signaling_port=1122), SipTrunk(fqdn="sbs2.contoso.com", sip_signaling_port=1123)] +new_routes = [SipTrunkRoute(name="First rule", description="Handle numbers starting with '+123'", number_pattern="\+123[0-9]+", trunks=["sbs1.sipconfigtest.com"])] +sip_routing_client.set_trunks(new_trunks) +sip_routing_client.set_routes(new_routes) +``` + +#### Retrieve single trunk + +```python +trunk = sip_routing_client.get_trunk("sbs1.contoso.com") +``` + +#### Set single trunk + +```python +# Set function will either modify existing item or add new item to the collection. +# The trunk is matched based on it's FQDN. +new_trunk = SipTrunk(fqdn="sbs3.contoso.com", sip_signaling_port=5555) +sip_routing_client.set_trunk(new_trunk) +``` + +#### Delete single trunk + +```python +sip_routing_client.delete_trunk("sbs1.contoso.com") +``` + # Troubleshooting The Phone Numbers Administration client will raise exceptions defined in [Azure Core][azure_core]. diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/__init__.py index 4af1eafae585..d0f5e41152fa 100644 --- a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/__init__.py +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/__init__.py @@ -26,5 +26,5 @@ 'PhoneNumberAssignmentType', 'PhoneNumberCapabilityType', 'PhoneNumberType', - 'PhoneNumbersClient', + 'PhoneNumbersClient' ] diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_version.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_version.py index 62db382362d2..cb0d1aadbe89 100644 --- a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_version.py +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_version.py @@ -4,6 +4,6 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "1.1.0b2" +VERSION = "1.1.0b3" SDK_MONIKER = "communication-phonenumbers/{}".format(VERSION) # type: str diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/__init__.py new file mode 100644 index 000000000000..5acebe42166f --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/__init__.py @@ -0,0 +1,16 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + + +from ._sip_routing_client import SipRoutingClient +from ._generated.models import SipTrunkRoute +from ._models import SipTrunk + +__all__ = [ + 'SipRoutingClient', + 'SipTrunk', + 'SipTrunkRoute' +] diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/__init__.py new file mode 100644 index 000000000000..4fd624f506ea --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._sip_routing_service import SIPRoutingService +__all__ = ['SIPRoutingService'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_configuration.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_configuration.py new file mode 100644 index 000000000000..fc539cb35bc7 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + +VERSION = "unknown" + +class SIPRoutingServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SIPRoutingService. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: The communication resource, for example + https://resourcename.communication.azure.com. + :type endpoint: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + super(SIPRoutingServiceConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + + self.endpoint = endpoint + self.api_version = api_version + kwargs.setdefault('sdk_moniker', 'siproutingservice/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_patch.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_sip_routing_service.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_sip_routing_service.py new file mode 100644 index 000000000000..4307dbdbc139 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_sip_routing_service.py @@ -0,0 +1,95 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core import PipelineClient + +from . import models +from ._configuration import SIPRoutingServiceConfiguration +from .operations import SIPRoutingServiceOperationsMixin + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.rest import HttpRequest, HttpResponse + +class SIPRoutingService(SIPRoutingServiceOperationsMixin): + """SipRouting Service. + + :param endpoint: The communication resource, for example + https://resourcename.communication.azure.com. + :type endpoint: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + endpoint, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + _base_url = '{endpoint}' + self._config = SIPRoutingServiceConfiguration(endpoint=endpoint, **kwargs) + self._client = PipelineClient(base_url=_base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs # type: Any + ): + # type: (...) -> HttpResponse + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> SIPRoutingService + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_vendor.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_vendor.py new file mode 100644 index 000000000000..9a223d15524c --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/_vendor.py @@ -0,0 +1,15 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/__init__.py new file mode 100644 index 000000000000..4fd624f506ea --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._sip_routing_service import SIPRoutingService +__all__ = ['SIPRoutingService'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_configuration.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_configuration.py new file mode 100644 index 000000000000..4f3b51093831 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_configuration.py @@ -0,0 +1,58 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +VERSION = "unknown" + +class SIPRoutingServiceConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for SIPRoutingService. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param endpoint: The communication resource, for example + https://resourcename.communication.azure.com. + :type endpoint: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + super(SIPRoutingServiceConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + + if endpoint is None: + raise ValueError("Parameter 'endpoint' must not be None.") + + self.endpoint = endpoint + self.api_version = api_version + kwargs.setdefault('sdk_moniker', 'siproutingservice/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_patch.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_sip_routing_service.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_sip_routing_service.py new file mode 100644 index 000000000000..2f2b9c446a36 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/_sip_routing_service.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable + +from msrest import Deserializer, Serializer + +from azure.core import AsyncPipelineClient +from azure.core.rest import AsyncHttpResponse, HttpRequest + +from .. import models +from ._configuration import SIPRoutingServiceConfiguration +from .operations import SIPRoutingServiceOperationsMixin + +class SIPRoutingService(SIPRoutingServiceOperationsMixin): + """SipRouting Service. + + :param endpoint: The communication resource, for example + https://resourcename.communication.azure.com. + :type endpoint: str + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + endpoint: str, + **kwargs: Any + ) -> None: + _base_url = '{endpoint}' + self._config = SIPRoutingServiceConfiguration(endpoint=endpoint, **kwargs) + self._client = AsyncPipelineClient(base_url=_base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "SIPRoutingService": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/operations/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/operations/__init__.py new file mode 100644 index 000000000000..f73fee5205e1 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._sip_routing_service_operations import SIPRoutingServiceOperationsMixin + +__all__ = [ + 'SIPRoutingServiceOperationsMixin', +] diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/operations/_sip_routing_service_operations.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/operations/_sip_routing_service_operations.py new file mode 100644 index 000000000000..9a01dcc1afb5 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/aio/operations/_sip_routing_service_operations.py @@ -0,0 +1,143 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sip_routing_service_operations import build_get_sip_configuration_request, build_patch_sip_configuration_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SIPRoutingServiceOperationsMixin: + + @distributed_trace_async + async def get_sip_configuration( + self, + **kwargs: Any + ) -> "_models.SipConfiguration": + """Gets SIP configuration for resource. + + Gets SIP configuration for resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SipConfiguration, or the result of cls(response) + :rtype: ~azure.communication.phonenumbers.siprouting.models.SipConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SipConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + + + request = build_get_sip_configuration_request( + api_version=api_version, + template_url=self.get_sip_configuration.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SipConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sip_configuration.metadata = {'url': "/sip"} # type: ignore + + + @distributed_trace_async + async def patch_sip_configuration( + self, + body: Optional["_models.SipConfiguration"] = None, + **kwargs: Any + ) -> "_models.SipConfiguration": + """Patches SIP configuration for resource. + + Patches SIP configuration for resource. + + :param body: Configuration patch. Default value is None. + :type body: ~azure.communication.phonenumbers.siprouting.models.SipConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SipConfiguration, or the result of cls(response) + :rtype: ~azure.communication.phonenumbers.siprouting.models.SipConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SipConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/merge-patch+json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SipConfiguration') + else: + _json = None + + request = build_patch_sip_configuration_request( + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.patch_sip_configuration.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SipConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch_sip_configuration.metadata = {'url': "/sip"} # type: ignore + diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/__init__.py new file mode 100644 index 000000000000..1195f3916992 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/__init__.py @@ -0,0 +1,28 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import CommunicationError + from ._models_py3 import CommunicationErrorResponse + from ._models_py3 import SipConfiguration + from ._models_py3 import SipTrunkInternal + from ._models_py3 import SipTrunkRoute +except (SyntaxError, ImportError): + from ._models import CommunicationError # type: ignore + from ._models import CommunicationErrorResponse # type: ignore + from ._models import SipConfiguration # type: ignore + from ._models import SipTrunkInternal # type: ignore + from ._models import SipTrunkRoute # type: ignore + +__all__ = [ + 'CommunicationError', + 'CommunicationErrorResponse', + 'SipConfiguration', + 'SipTrunkInternal', + 'SipTrunkRoute', +] diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/_models.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/_models.py new file mode 100644 index 000000000000..67ddb3f297f9 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/_models.py @@ -0,0 +1,214 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CommunicationError(msrest.serialization.Model): + """The Communication Services error. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. The error code. + :vartype code: str + :ivar message: Required. The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: Further details about specific errors that led to this error. + :vartype details: list[~azure.communication.phonenumbers.siprouting.models.CommunicationError] + :ivar inner_error: The inner error if any. + :vartype inner_error: ~azure.communication.phonenumbers.siprouting.models.CommunicationError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CommunicationError]'}, + 'inner_error': {'key': 'innererror', 'type': 'CommunicationError'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword code: Required. The error code. + :paramtype code: str + :keyword message: Required. The error message. + :paramtype message: str + """ + super(CommunicationError, self).__init__(**kwargs) + self.code = kwargs['code'] + self.message = kwargs['message'] + self.target = None + self.details = None + self.inner_error = None + + +class CommunicationErrorResponse(msrest.serialization.Model): + """The Communication Services error. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. The Communication Services error. + :vartype error: ~azure.communication.phonenumbers.siprouting.models.CommunicationError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CommunicationError'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword error: Required. The Communication Services error. + :paramtype error: ~azure.communication.phonenumbers.siprouting.models.CommunicationError + """ + super(CommunicationErrorResponse, self).__init__(**kwargs) + self.error = kwargs['error'] + + +class SipConfiguration(msrest.serialization.Model): + """Represents a SIP configuration. +When a call is being routed the routes are applied in the same order as in the routes list. +A route is matched by its number pattern. +Call is then directed into route's first available trunk, based on the order in the route's trunks list. + + :ivar trunks: SIP trunks for routing calls. + Map key is trunk's FQDN (1-249 characters). + :vartype trunks: dict[str, + ~azure.communication.phonenumbers.siprouting.models.SipTrunkInternal] + :ivar routes: Trunk routes for routing calls. + :vartype routes: list[~azure.communication.phonenumbers.siprouting.models.SipTrunkRoute] + """ + + _attribute_map = { + 'trunks': {'key': 'trunks', 'type': '{SipTrunkInternal}'}, + 'routes': {'key': 'routes', 'type': '[SipTrunkRoute]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword trunks: SIP trunks for routing calls. + Map key is trunk's FQDN (1-249 characters). + :paramtype trunks: dict[str, + ~azure.communication.phonenumbers.siprouting.models.SipTrunkInternal] + :keyword routes: Trunk routes for routing calls. + :paramtype routes: list[~azure.communication.phonenumbers.siprouting.models.SipTrunkRoute] + """ + super(SipConfiguration, self).__init__(**kwargs) + self.trunks = kwargs.get('trunks', None) + self.routes = kwargs.get('routes', None) + + +class SipTrunkInternal(msrest.serialization.Model): + """Represents a SIP trunk for routing calls. See RFC 4904. + + All required parameters must be populated in order to send to Azure. + + :ivar sip_signaling_port: Required. Gets or sets SIP signaling port of the trunk. + :vartype sip_signaling_port: int + """ + + _validation = { + 'sip_signaling_port': {'required': True}, + } + + _attribute_map = { + 'sip_signaling_port': {'key': 'sipSignalingPort', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword sip_signaling_port: Required. Gets or sets SIP signaling port of the trunk. + :paramtype sip_signaling_port: int + """ + super(SipTrunkInternal, self).__init__(**kwargs) + self.sip_signaling_port = kwargs['sip_signaling_port'] + + +class SipTrunkRoute(msrest.serialization.Model): + """Represents a trunk route for routing calls. + + All required parameters must be populated in order to send to Azure. + + :ivar description: Gets or sets description of the route. + :vartype description: str + :ivar name: Required. Gets or sets name of the route. + :vartype name: str + :ivar number_pattern: Required. Gets or sets regex number pattern for routing calls. .NET regex + format is supported. + The regex should match only digits with an optional '+' prefix without spaces. + I.e. "^+[1-9][0-9]{3,23}$". + :vartype number_pattern: str + :ivar trunks: Gets or sets list of SIP trunks for routing calls. Trunks are represented as + FQDN. + :vartype trunks: list[str] + """ + + _validation = { + 'description': {'max_length': 1024, 'min_length': 0}, + 'name': {'required': True, 'max_length': 256, 'min_length': 0}, + 'number_pattern': {'required': True, 'max_length': 1024, 'min_length': 0}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'number_pattern': {'key': 'numberPattern', 'type': 'str'}, + 'trunks': {'key': 'trunks', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword description: Gets or sets description of the route. + :paramtype description: str + :keyword name: Required. Gets or sets name of the route. + :paramtype name: str + :keyword number_pattern: Required. Gets or sets regex number pattern for routing calls. .NET + regex format is supported. + The regex should match only digits with an optional '+' prefix without spaces. + I.e. "^+[1-9][0-9]{3,23}$". + :paramtype number_pattern: str + :keyword trunks: Gets or sets list of SIP trunks for routing calls. Trunks are represented as + FQDN. + :paramtype trunks: list[str] + """ + super(SipTrunkRoute, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.name = kwargs['name'] + self.number_pattern = kwargs['number_pattern'] + self.trunks = kwargs.get('trunks', None) diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/_models_py3.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/_models_py3.py new file mode 100644 index 000000000000..d8fde711e0ba --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/models/_models_py3.py @@ -0,0 +1,231 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Dict, List, Optional + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class CommunicationError(msrest.serialization.Model): + """The Communication Services error. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar code: Required. The error code. + :vartype code: str + :ivar message: Required. The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: Further details about specific errors that led to this error. + :vartype details: list[~azure.communication.phonenumbers.siprouting.models.CommunicationError] + :ivar inner_error: The inner error if any. + :vartype inner_error: ~azure.communication.phonenumbers.siprouting.models.CommunicationError + """ + + _validation = { + 'code': {'required': True}, + 'message': {'required': True}, + 'target': {'readonly': True}, + 'details': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CommunicationError]'}, + 'inner_error': {'key': 'innererror', 'type': 'CommunicationError'}, + } + + def __init__( + self, + *, + code: str, + message: str, + **kwargs + ): + """ + :keyword code: Required. The error code. + :paramtype code: str + :keyword message: Required. The error message. + :paramtype message: str + """ + super(CommunicationError, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = None + self.details = None + self.inner_error = None + + +class CommunicationErrorResponse(msrest.serialization.Model): + """The Communication Services error. + + All required parameters must be populated in order to send to Azure. + + :ivar error: Required. The Communication Services error. + :vartype error: ~azure.communication.phonenumbers.siprouting.models.CommunicationError + """ + + _validation = { + 'error': {'required': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'CommunicationError'}, + } + + def __init__( + self, + *, + error: "CommunicationError", + **kwargs + ): + """ + :keyword error: Required. The Communication Services error. + :paramtype error: ~azure.communication.phonenumbers.siprouting.models.CommunicationError + """ + super(CommunicationErrorResponse, self).__init__(**kwargs) + self.error = error + + +class SipConfiguration(msrest.serialization.Model): + """Represents a SIP configuration. +When a call is being routed the routes are applied in the same order as in the routes list. +A route is matched by its number pattern. +Call is then directed into route's first available trunk, based on the order in the route's trunks list. + + :ivar trunks: SIP trunks for routing calls. + Map key is trunk's FQDN (1-249 characters). + :vartype trunks: dict[str, + ~azure.communication.phonenumbers.siprouting.models.SipTrunkInternal] + :ivar routes: Trunk routes for routing calls. + :vartype routes: list[~azure.communication.phonenumbers.siprouting.models.SipTrunkRoute] + """ + + _attribute_map = { + 'trunks': {'key': 'trunks', 'type': '{SipTrunkInternal}'}, + 'routes': {'key': 'routes', 'type': '[SipTrunkRoute]'}, + } + + def __init__( + self, + *, + trunks: Optional[Dict[str, "SipTrunkInternal"]] = None, + routes: Optional[List["SipTrunkRoute"]] = None, + **kwargs + ): + """ + :keyword trunks: SIP trunks for routing calls. + Map key is trunk's FQDN (1-249 characters). + :paramtype trunks: dict[str, + ~azure.communication.phonenumbers.siprouting.models.SipTrunkInternal] + :keyword routes: Trunk routes for routing calls. + :paramtype routes: list[~azure.communication.phonenumbers.siprouting.models.SipTrunkRoute] + """ + super(SipConfiguration, self).__init__(**kwargs) + self.trunks = trunks + self.routes = routes + + +class SipTrunkInternal(msrest.serialization.Model): + """Represents a SIP trunk for routing calls. See RFC 4904. + + All required parameters must be populated in order to send to Azure. + + :ivar sip_signaling_port: Required. Gets or sets SIP signaling port of the trunk. + :vartype sip_signaling_port: int + """ + + _validation = { + 'sip_signaling_port': {'required': True}, + } + + _attribute_map = { + 'sip_signaling_port': {'key': 'sipSignalingPort', 'type': 'int'}, + } + + def __init__( + self, + *, + sip_signaling_port: int, + **kwargs + ): + """ + :keyword sip_signaling_port: Required. Gets or sets SIP signaling port of the trunk. + :paramtype sip_signaling_port: int + """ + super(SipTrunkInternal, self).__init__(**kwargs) + self.sip_signaling_port = sip_signaling_port + + +class SipTrunkRoute(msrest.serialization.Model): + """Represents a trunk route for routing calls. + + All required parameters must be populated in order to send to Azure. + + :ivar description: Gets or sets description of the route. + :vartype description: str + :ivar name: Required. Gets or sets name of the route. + :vartype name: str + :ivar number_pattern: Required. Gets or sets regex number pattern for routing calls. .NET regex + format is supported. + The regex should match only digits with an optional '+' prefix without spaces. + I.e. "^+[1-9][0-9]{3,23}$". + :vartype number_pattern: str + :ivar trunks: Gets or sets list of SIP trunks for routing calls. Trunks are represented as + FQDN. + :vartype trunks: list[str] + """ + + _validation = { + 'description': {'max_length': 1024, 'min_length': 0}, + 'name': {'required': True, 'max_length': 256, 'min_length': 0}, + 'number_pattern': {'required': True, 'max_length': 1024, 'min_length': 0}, + } + + _attribute_map = { + 'description': {'key': 'description', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'number_pattern': {'key': 'numberPattern', 'type': 'str'}, + 'trunks': {'key': 'trunks', 'type': '[str]'}, + } + + def __init__( + self, + *, + name: str, + number_pattern: str, + description: Optional[str] = None, + trunks: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword description: Gets or sets description of the route. + :paramtype description: str + :keyword name: Required. Gets or sets name of the route. + :paramtype name: str + :keyword number_pattern: Required. Gets or sets regex number pattern for routing calls. .NET + regex format is supported. + The regex should match only digits with an optional '+' prefix without spaces. + I.e. "^+[1-9][0-9]{3,23}$". + :paramtype number_pattern: str + :keyword trunks: Gets or sets list of SIP trunks for routing calls. Trunks are represented as + FQDN. + :paramtype trunks: list[str] + """ + super(SipTrunkRoute, self).__init__(**kwargs) + self.description = description + self.name = name + self.number_pattern = number_pattern + self.trunks = trunks diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/__init__.py new file mode 100644 index 000000000000..f73fee5205e1 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/__init__.py @@ -0,0 +1,13 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._sip_routing_service_operations import SIPRoutingServiceOperationsMixin + +__all__ = [ + 'SIPRoutingServiceOperationsMixin', +] diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/_sip_routing_service_operations.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/_sip_routing_service_operations.py new file mode 100644 index 000000000000..1de42380b4c5 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/operations/_sip_routing_service_operations.py @@ -0,0 +1,211 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace + +from .. import models as _models +from .._vendor import _convert_request + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Optional, TypeVar + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_sip_configuration_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/sip") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_patch_sip_configuration_request( + **kwargs # type: Any +): + # type: (...) -> HttpRequest + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/sip") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +# fmt: on +class SIPRoutingServiceOperationsMixin(object): + + @distributed_trace + def get_sip_configuration( + self, + **kwargs # type: Any + ): + # type: (...) -> "_models.SipConfiguration" + """Gets SIP configuration for resource. + + Gets SIP configuration for resource. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SipConfiguration, or the result of cls(response) + :rtype: ~azure.communication.phonenumbers.siprouting.models.SipConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SipConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + + + request = build_get_sip_configuration_request( + api_version=api_version, + template_url=self.get_sip_configuration.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SipConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_sip_configuration.metadata = {'url': "/sip"} # type: ignore + + + @distributed_trace + def patch_sip_configuration( + self, + body=None, # type: Optional["_models.SipConfiguration"] + **kwargs # type: Any + ): + # type: (...) -> "_models.SipConfiguration" + """Patches SIP configuration for resource. + + Patches SIP configuration for resource. + + :param body: Configuration patch. Default value is None. + :type body: ~azure.communication.phonenumbers.siprouting.models.SipConfiguration + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SipConfiguration, or the result of cls(response) + :rtype: ~azure.communication.phonenumbers.siprouting.models.SipConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SipConfiguration"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2021-05-01-preview") # type: str + content_type = kwargs.pop('content_type', "application/merge-patch+json") # type: Optional[str] + + if body is not None: + _json = self._serialize.body(body, 'SipConfiguration') + else: + _json = None + + request = build_patch_sip_configuration_request( + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.patch_sip_configuration.metadata['url'], + ) + request = _convert_request(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), + } + request.url = self._client.format_url(request.url, **path_format_arguments) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error) + + deserialized = self._deserialize('SipConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + patch_sip_configuration.metadata = {'url': "/sip"} # type: ignore + diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/py.typed b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_generated/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_models.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_models.py new file mode 100644 index 000000000000..ff54f4e1e2f3 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_models.py @@ -0,0 +1,33 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +class SipTrunk(object): + """Represents a SIP trunk for routing calls. See RFC 4904. + + :ivar fqdn: FQDN of the trunk. + :vartype fqdn: str + :ivar sip_signaling_port: Gets or sets SIP signaling port of the trunk. + :vartype sip_signaling_port: int + """ + + _attribute_map = { + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'sip_signaling_port': {'key': 'sipSignalingPort', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword fqdn: FQDN of the trunk. + :paramtype fqdn: str + :keyword sip_signaling_port: Gets or sets SIP signaling port of the trunk. + :paramtype sip_signaling_port: int + """ + self.fqdn = kwargs.get('fqdn', None) + self.sip_signaling_port = kwargs.get('sip_signaling_port', None) + \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_sip_routing_client.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_sip_routing_client.py new file mode 100644 index 000000000000..32d0d315a041 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/_sip_routing_client.py @@ -0,0 +1,263 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING # pylint: disable=unused-import + +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse # type: ignore + +from azure.core.tracing.decorator import distributed_trace + +from._models import SipTrunk +from ._generated.models import ( + SipConfiguration, + SipTrunkRoute, + SipTrunkInternal +) +from ._generated._sip_routing_service import SIPRoutingService +from .._shared.utils import ( + parse_connection_str, + get_authentication_policy +) +from .._version import SDK_MONIKER + +if TYPE_CHECKING: + from typing import Optional, Iterable, List, Any + from azure.core.credentials import TokenCredential + + +class SipRoutingClient(object): + """A client to interact with the AzureCommunicationService SIP routing gateway. + This client provides operations to retrieve and manage SIP routing configuration. + + :param endpoint: The endpoint url for Azure Communication Service resource. + :type endpoint: str + :param credential: The credentials with which to authenticate. + :type credential: TokenCredential + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + endpoint, # type: str + credential, # type: TokenCredential + **kwargs # type: Any + ): # type: (...) -> SipRoutingClient + + if not credential: + raise ValueError("credential can not be None") + try: + if not endpoint.lower().startswith("http"): + endpoint = "https://" + endpoint + except AttributeError: + raise ValueError("Host URL must be a string") + + parsed_url = urlparse(endpoint.rstrip("/")) + if not parsed_url.netloc: + raise ValueError("Invalid URL: {}".format(endpoint)) + + self._endpoint = endpoint + self._authentication_policy = get_authentication_policy(endpoint, credential) + + self._rest_service = SIPRoutingService( + self._endpoint, + authentication_policy=self._authentication_policy, + sdk_moniker=SDK_MONIKER, + **kwargs + ) + + @classmethod + def from_connection_string( + cls, + conn_str, # type: str + **kwargs # type: Any + ): + # type: (...) -> SipRoutingClient + """Factory method for creating client from connection string. + + :param str conn_str: Connection string containing endpoint and credentials. + :returns: The newly created client. + :rtype: ~azure.communication.siprouting.SipRoutingClient + """ + endpoint, credential = parse_connection_str(conn_str) + return cls(endpoint, credential, **kwargs) + + @distributed_trace + def get_trunk( + self, + trunk_fqdn, # type: str + **kwargs # type: Any + ): # type: (...) -> Optional[SipTrunk] + """Retrieve a single SIP trunk. + + :param trunk_fqdn: FQDN of the desired SIP trunk. + :type trunk_fqdn: str + :returns: SIP trunk with specified trunk_fqdn. If it doesn't exist, returns None. + :rtype: ~azure.communication.siprouting.models.SipTrunk or None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError, LookupError + """ + if trunk_fqdn is None: + raise ValueError("Parameter 'trunk_fqdn' must not be None.") + + config = self._rest_service.get_sip_configuration( + **kwargs) + + if trunk_fqdn in config.trunks: + trunk = config.trunks[trunk_fqdn] + return SipTrunk(fqdn=trunk_fqdn,sip_signaling_port=trunk.sip_signaling_port) + + return None + + @distributed_trace + def set_trunk( + self, + trunk, # type: SipTrunk + **kwargs # type: Any + ): # type: (...) -> None + """Modifies SIP trunk with the given FQDN. If it doesn't exist, adds a new trunk. + + :param trunk: Trunk object to be set. + :type trunk: ~azure.communication.siprouting.models.SipTrunk + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if trunk is None: + raise ValueError("Parameter 'trunk' must not be None.") + + self._patch_trunks_([trunk],**kwargs) + + @distributed_trace + def delete_trunk( + self, + trunk_fqdn, # type: str + **kwargs # type: Any + ): # type: (...) -> None + """Deletes SIP trunk. + + :param trunk_fqdn: FQDN of the trunk to be deleted. + :type trunk_fqdn: str + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if trunk_fqdn is None: + raise ValueError("Parameter 'trunk_fqdn' must not be None.") + + self._rest_service.patch_sip_configuration( + body=SipConfiguration(trunks={trunk_fqdn:None}), + **kwargs) + + @distributed_trace + def get_trunks( + self, + **kwargs # type: Any + ): # type: (...) -> Iterable[SipTrunk] + """Retrieves an iterable of currently configured SIP trunks. + + :returns: Current SIP trunks configuration. + :rtype: Iterable[~azure.communication.siprouting.models.SipTrunk] + :raises: ~azure.core.exceptions.HttpResponseError + """ + return self._get_trunks_(**kwargs) + + @distributed_trace + def get_routes( + self, + **kwargs # type: Any + ): # type: (...) -> Iterable[SipTrunkRoute] + """Retrieves an iterable of currently configured SIP routes. + + :returns: Current SIP routes configuration. + :rtype: Iterable[~azure.communication.siprouting.models.SipTrunkRoute] + :raises: ~azure.core.exceptions.HttpResponseError + """ + config = self._rest_service.get_sip_configuration( + **kwargs + ) + return config.routes + + @distributed_trace + def set_trunks( + self, + trunks, # type: List[SipTrunk] + **kwargs # type: Any + ): # type: (...) -> None + """Overwrites the list of SIP trunks. + + :param trunks: New list of trunks to be set. + :type trunks: List[SipTrunk] + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if trunks is None: + raise ValueError("Parameter 'trunks' must not be None.") + + trunks_dictionary = {x.fqdn: SipTrunkInternal(sip_signaling_port=x.sip_signaling_port) for x in trunks} + config = SipConfiguration(trunks=trunks_dictionary) + + old_trunks = self._get_trunks_(**kwargs) + + for x in old_trunks: + if x.fqdn not in [o.fqdn for o in trunks]: + config.trunks[x.fqdn] = None + + self._rest_service.patch_sip_configuration( + body=config, **kwargs + ) + + @distributed_trace + def set_routes( + self, + routes, # type: List[SipTrunkRoute] + **kwargs # type: Any + ): # type: (...) -> None + """Overwrites the list of SIP routes. + + :param routes: New list of routes to be set. + :type routes: List[SipTrunkRoute] + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if routes is None: + raise ValueError("Parameter 'routes' must not be None.") + + self._rest_service.patch_sip_configuration( + body=SipConfiguration(routes=routes), **kwargs + ) + + def _get_trunks_(self, **kwargs): + config = self._rest_service.get_sip_configuration( + **kwargs) + return [SipTrunk(fqdn=k,sip_signaling_port=v.sip_signaling_port) for k,v in config.trunks.items()] + + def _patch_trunks_(self, + trunks, # type: List[SipTrunk] + **kwargs # type: Any + ): # type: (...) -> SipTrunk + trunks_internal = {x.fqdn: SipTrunkInternal(sip_signaling_port=x.sip_signaling_port) for x in trunks} + modified_config = SipConfiguration(trunks=trunks_internal) + + new_config = self._rest_service.patch_sip_configuration( + body=modified_config, **kwargs + ) + return [SipTrunk(fqdn=k,sip_signaling_port=v.sip_signaling_port) for k,v in new_config.trunks.items()] + + def close(self) -> None: + self._rest_service.close() + + def __enter__(self) -> "SipRoutingClient": + self._rest_service.__enter__() + return self + + def __exit__(self, *args) -> None: + self._rest_service.__exit__(*args) diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/__init__.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/__init__.py new file mode 100644 index 000000000000..75a7c5a76ac0 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/__init__.py @@ -0,0 +1,11 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from ._sip_routing_client_async import SipRoutingClient + +__all__ = [ + 'SipRoutingClient' +] diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/_sip_routing_client_async.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/_sip_routing_client_async.py new file mode 100644 index 000000000000..035a475b5df6 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/siprouting/aio/_sip_routing_client_async.py @@ -0,0 +1,269 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING # pylint: disable=unused-import + +try: + from urllib.parse import urlparse +except ImportError: + from urlparse import urlparse # type: ignore + +from azure.core.tracing.decorator_async import distributed_trace_async + +from .._models import SipTrunk +from .._generated.models import ( + SipConfiguration, + SipTrunkRoute, + SipTrunkInternal +) +from .._generated.aio._sip_routing_service import SIPRoutingService +from ..._shared.utils import ( + parse_connection_str, + get_authentication_policy +) +from ..._version import SDK_MONIKER + +if TYPE_CHECKING: + from typing import Optional, Iterable, List, Any + from azure.core.credentials_async import AsyncTokenCredential + + +class SipRoutingClient(object): + """A client to interact with the SIP routing gateway asynchronously. + This client provides operations to retrieve and update SIP routing configuration. + + :param endpoint: The endpoint url for Azure Communication Service resource. + :type endpoint: str + :param credential: The credentials with which to authenticate. + :type credential: AsyncTokenCredential + :keyword api_version: Api Version. Default value is "2021-05-01-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + endpoint, # type: str + credential, # type: AsyncTokenCredential + **kwargs # type: Any + ): # type: (...) -> SipRoutingClient + + if not credential: + raise ValueError("credential can not be None") + try: + if not endpoint.lower().startswith("http"): + endpoint = "https://" + endpoint + except AttributeError as attribute_error: + raise ValueError("Host URL must be a string") from attribute_error + + parsed_url = urlparse(endpoint.rstrip("/")) + if not parsed_url.netloc: + raise ValueError("Invalid URL: {}".format(endpoint)) + + self._endpoint = endpoint + self._authentication_policy = get_authentication_policy( + endpoint, credential, + is_async=True + ) + + self._rest_service = SIPRoutingService( + self._endpoint, + authentication_policy=self._authentication_policy, + sdk_moniker=SDK_MONIKER, + **kwargs + ) + + @classmethod + def from_connection_string( + cls, + conn_str, # type: str + **kwargs # type: Any + ): # type: (...) -> SipRoutingClient + """Factory method for creating client from connection string. + + :param conn_str: Connection string containing endpoint and credentials + :type conn_str: str + :returns: The newly created client. + :rtype: ~azure.communication.siprouting.models.SipRoutingClient + """ + + endpoint, credential = parse_connection_str(conn_str) + return cls(endpoint, credential, **kwargs) + + @distributed_trace_async + async def get_trunk( + self, + trunk_fqdn, # type: str + **kwargs # type: Any + ): # type: (...) -> Optional[SipTrunk] + """Retrieve a single SIP trunk. + + :param trunk_fqdn: FQDN of the desired SIP trunk. + :type trunk_fqdn: str + :returns: SIP trunk with specified trunk_fqdn. If it doesn't exist, returns None. + :rtype: ~azure.communication.siprouting.models.SipTrunk or None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError, LookupError + """ + if trunk_fqdn is None: + raise ValueError("Parameter 'trunk_fqdn' must not be None.") + + config = await self._rest_service.get_sip_configuration( + **kwargs) + + if trunk_fqdn in config.trunks: + trunk = config.trunks[trunk_fqdn] + return SipTrunk(fqdn=trunk_fqdn,sip_signaling_port=trunk.sip_signaling_port) + + return None + + @distributed_trace_async + async def set_trunk( + self, + trunk, # type: SipTrunk + **kwargs # type: Any + ): # type: (...) -> None + """Modifies SIP trunk with the given FQDN. If it doesn't exist, adds a new trunk. + + :param trunk: Trunk object to be set. + :type trunk: ~azure.communication.siprouting.models.SipTrunk + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if trunk is None: + raise ValueError("Parameter 'trunk' must not be None.") + + await self._patch_trunks_([trunk],**kwargs) + + @distributed_trace_async + async def delete_trunk( + self, + trunk_fqdn, # type: str + **kwargs # type: Any + ): # type: (...) -> None + """Deletes SIP trunk. + + :param trunk_fqdn: FQDN of the trunk to be deleted. + :type trunk_fqdn: str + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if trunk_fqdn is None: + raise ValueError("Parameter 'trunk_fqdn' must not be None.") + + await self._rest_service.patch_sip_configuration( + body=SipConfiguration(trunks={trunk_fqdn:None}), + **kwargs) + + @distributed_trace_async + async def get_trunks( + self, + **kwargs # type: Any + ): # type: (...) -> Iterable[SipTrunk] + """Retrieves an iterable of currently configured SIP trunks. + + :returns: Current SIP trunks configuration. + :rtype: Iterable[~azure.communication.siprouting.models.SipTrunk] + :raises: ~azure.core.exceptions.HttpResponseError + """ + return await self._get_trunks_(**kwargs) + + @distributed_trace_async + async def get_routes( + self, + **kwargs # type: Any + ): # type: (...) -> Iterable[SipTrunkRoute] + """Retrieves an iterable of currently configured SIP routes. + + :returns: Current SIP routes configuration. + :rtype: Iterable[~azure.communication.siprouting.models.SipTrunkRoute] + :raises: ~azure.core.exceptions.HttpResponseError + """ + config = await self._rest_service.get_sip_configuration( + **kwargs + ) + return config.routes + + @distributed_trace_async + async def set_trunks( + self, + trunks, # type: List[SipTrunk] + **kwargs # type: Any + ): # type: (...) -> None + """Overwrites the list of SIP trunks. + + :param trunks: New list of trunks to be set. + :type trunks: List[SipTrunk] + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if trunks is None: + raise ValueError("Parameter 'trunks' must not be None.") + + trunks_dictionary = {x.fqdn: SipTrunkInternal(sip_signaling_port=x.sip_signaling_port) for x in trunks} + config = SipConfiguration(trunks=trunks_dictionary) + + old_trunks = await self._get_trunks_(**kwargs) + + for x in old_trunks: + if x.fqdn not in [o.fqdn for o in trunks]: + config.trunks[x.fqdn] = None + + await self._rest_service.patch_sip_configuration( + body=config, **kwargs + ) + + @distributed_trace_async + async def set_routes( + self, + routes, # type: List[SipTrunkRoute] + **kwargs # type: Any + ): # type: (...) -> None + """Overwrites the list of SIP routes. + + :param routes: New list of routes to be set. + :type routes: List[SipTrunkRoute] + :returns: None + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError, ValueError + """ + if routes is None: + raise ValueError("Parameter 'routes' must not be None.") + + await self._rest_service.patch_sip_configuration( + body=SipConfiguration(routes=routes), + **kwargs + ) + + async def _get_trunks_(self, **kwargs): + config = await self._rest_service.get_sip_configuration( + **kwargs + ) + return [SipTrunk(fqdn=k,sip_signaling_port=v.sip_signaling_port) for k,v in config.trunks.items()] + + async def _patch_trunks_(self, + trunks, # type: List[SipTrunk] + **kwargs # type: Any + ): # type: (...) -> SipTrunk + trunks_internal = {x.fqdn: SipTrunkInternal(sip_signaling_port=x.sip_signaling_port) for x in trunks} + modified_config = SipConfiguration(trunks=trunks_internal) + + new_config = await self._rest_service.patch_sip_configuration( + body=modified_config, **kwargs + ) + return [SipTrunk(fqdn=k,sip_signaling_port=v.sip_signaling_port) for k,v in new_config.trunks.items()] + + async def close(self) -> None: + await self._rest_service.close() + + async def __aenter__(self) -> "SipRoutingClient": + await self._rest_service.__aenter__() + return self + + async def __aexit__(self, *args) -> None: + await self._rest_service.__aexit__(*args) diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/delete_sip_trunk_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/delete_sip_trunk_sample.py new file mode 100644 index 000000000000..4ff0afda7a84 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/delete_sip_trunk_sample.py @@ -0,0 +1,31 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: delete_sip_trunk_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for deleting the configuration + of a single SIP trunk. + +USAGE: + python delete_sip_trunk_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_TRUNK_FQDN - fqdn of the trunk to be deleted +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +def delete_sip_trunk_sample(): + trunk_fqdn = os.getenv("COMMUNICATION_SAMPLES_TRUNK_FQDN") + client.delete_trunk(trunk_fqdn) + +if __name__ == "__main__": + delete_sip_trunk_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/delete_sip_trunk_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/delete_sip_trunk_sample_async.py new file mode 100644 index 000000000000..8516bfa17002 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/delete_sip_trunk_sample_async.py @@ -0,0 +1,33 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: delete_sip_trunk_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for deleting the configuration + of a single SIP trunk. + +USAGE: + python delete_sip_trunk_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_TRUNK_FQDN - fqdn of the trunk to be deleted +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +async def delete_sip_trunk_sample(): + trunk_fqdn = os.getenv("COMMUNICATION_SAMPLES_TRUNK_FQDN") + async with client: + await client.delete_trunk(trunk_fqdn) + +if __name__ == "__main__": + asyncio.run(delete_sip_trunk_sample()) \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_routes_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_routes_sample.py new file mode 100644 index 000000000000..5d6a100ad089 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_routes_sample.py @@ -0,0 +1,37 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: get_sip_routes_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for retrieving the collection of + currently configured SIP routes. + +USAGE: + python get_sip_routes_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +def get_sip_routes_sample(): + sip_routes = client.get_routes() + + for route in sip_routes: + print(route.name) + print(route.description) + print(route.number_pattern) + + for trunk_fqdn in route.trunks: + print(trunk_fqdn) + +if __name__ == "__main__": + get_sip_routes_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_routes_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_routes_sample_async.py new file mode 100644 index 000000000000..bd47abb0c3a5 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_routes_sample_async.py @@ -0,0 +1,39 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: get_sip_routes_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for retrieving the collection of + currently configured SIP routes. + +USAGE: + python get_sip_routes_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +async def get_sip_routes_sample(): + async with client: + sip_routes = await client.get_routes() + + for route in sip_routes: + print(route.name) + print(route.description) + print(route.number_pattern) + + for trunk_fqdn in route.trunks: + print(trunk_fqdn) + +if __name__ == "__main__": + asyncio.run(get_sip_routes_sample()) \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunk_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunk_sample.py new file mode 100644 index 000000000000..72fce7a91928 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunk_sample.py @@ -0,0 +1,33 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: get_sip_trunk_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for retrieving the configuration + of a single SIP trunk. + +USAGE: + python get_sip_trunk_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_TRUNK_FQDN - fqdn of the trunk to be retrieved +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +def get_sip_trunk_sample(): + trunk_fqdn = os.getenv("COMMUNICATION_SAMPLES_TRUNK_FQDN") + sip_trunk = client.get_trunk(trunk_fqdn) + print(sip_trunk.fqdn) + print(sip_trunk.sip_signaling_port) + +if __name__ == "__main__": + get_sip_trunk_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunk_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunk_sample_async.py new file mode 100644 index 000000000000..3ecc02251019 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunk_sample_async.py @@ -0,0 +1,35 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: get_sip_trunk_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for retrieving the configuration + of a single SIP trunk. + +USAGE: + python get_sip_trunk_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_TRUNK_FQDN - fqdn of the trunk to be retrieved +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +async def get_sip_trunk_sample(): + trunk_fqdn = os.getenv("COMMUNICATION_SAMPLES_TRUNK_FQDN") + async with client: + sip_trunk = await client.get_trunk(trunk_fqdn) + print(sip_trunk.fqdn) + print(sip_trunk.sip_signaling_port) + +if __name__ == "__main__": + asyncio.run(get_sip_trunk_sample()) diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunks_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunks_sample.py new file mode 100644 index 000000000000..d29a8b8b823a --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunks_sample.py @@ -0,0 +1,33 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: get_sip_trunks_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for retrieving the collection of + currently configured SIP trunks. + +USAGE: + python get_sip_trunks_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +def get_sip_trunks_sample(): + sip_trunks = client.get_trunks() + + for trunk in sip_trunks: + print(trunk.fqdn) + print(trunk.sip_signaling_port) + +if __name__ == "__main__": + get_sip_trunks_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunks_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunks_sample_async.py new file mode 100644 index 000000000000..0cf9fd1264c6 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/get_sip_trunks_sample_async.py @@ -0,0 +1,36 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: get_sip_trunks_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for retrieving the collection of + currently configured SIP trunks. + +USAGE: + python get_sip_trunks_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +async def get_sip_trunks_sample(): + async with client: + sip_trunks = await client.get_trunks() + + for trunk in sip_trunks: + print(trunk.fqdn) + print(trunk.sip_signaling_port) + +if __name__ == "__main__": + asyncio.run(get_sip_trunks_sample()) + diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_routes_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_routes_sample.py new file mode 100644 index 000000000000..52cd65cc9393 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_routes_sample.py @@ -0,0 +1,30 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: set_sip_routes_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for replacing current + configuration of SIP routes with new values. + +USAGE: + python set_sip_routes_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient, SipTrunkRoute + +ROUTES = [SipTrunkRoute(name="First rule", description="Handle numbers starting with '+123'", number_pattern="\+123[0-9]+", trunks=["sbs1.sipsampletest.com"])] +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +def set_sip_routes_sample(): + client.set_routes(ROUTES) + +if __name__ == "__main__": + set_sip_routes_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_routes_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_routes_sample_async.py new file mode 100644 index 000000000000..b5067f5a8f55 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_routes_sample_async.py @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: set_sip_routes_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for replacing current + configuration of SIP routes with new values. + +USAGE: + python set_sip_routes_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient +from azure.communication.phonenumbers.siprouting import SipTrunkRoute + +ROUTES = [SipTrunkRoute(name="First rule", description="Handle numbers starting with '+123'", number_pattern="\+123[0-9]+", trunks=["sbs1.sipsampletest.com"])] +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +async def set_sip_routes_sample(): + async with client: + await client.set_routes(ROUTES) + +if __name__ == "__main__": + asyncio.run(set_sip_routes_sample()) + diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunk_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunk_sample.py new file mode 100644 index 000000000000..a735fa677067 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunk_sample.py @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: set_sip_trunk_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for setting the configuration + of a single SIP trunk. + +USAGE: + python set_sip_trunk_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_FQDN - FQDN of SipTrunk object to be set + 3) COMMUNICATION_SAMPLES_SIGNALING_PORT - SIP signaling port of SipTrunk object to be set +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient, SipTrunk + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +fqdn = os.getenv("COMMUNICATION_SAMPLES_FQDN") +signaling_port = os.getenv("COMMUNICATION_SAMPLES_SIGNALING_PORT") +client = SipRoutingClient.from_connection_string(connection_string) +new_trunk = SipTrunk(fqdn=fqdn, sip_signaling_port=signaling_port) + +def set_sip_trunk_sample(): + client.set_trunk(new_trunk) + +if __name__ == "__main__": + set_sip_trunk_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunk_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunk_sample_async.py new file mode 100644 index 000000000000..8e3ef086ec0a --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunk_sample_async.py @@ -0,0 +1,38 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: set_sip_trunk_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for setting the configuration + of a single SIP trunk. + +USAGE: + python set_sip_trunk_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account + 2) COMMUNICATION_SAMPLES_FQDN - FQDN of SipTrunk object to be set + 3) COMMUNICATION_SAMPLES_SIGNALING_PORT - SIP signaling port of SipTrunk object to be set +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient +from azure.communication.phonenumbers.siprouting import SipTrunk + +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +fqdn = os.getenv("COMMUNICATION_SAMPLES_FQDN") +signaling_port = os.getenv("COMMUNICATION_SAMPLES_SIGNALING_PORT") +client = SipRoutingClient.from_connection_string(connection_string) +new_trunk = SipTrunk(fqdn=fqdn, sip_signaling_port=signaling_port) + +async def set_sip_trunk_sample(): + async with client: + await client.set_trunk(new_trunk) + +if __name__ == "__main__": + asyncio.run(set_sip_trunk_sample()) + diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunks_sample.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunks_sample.py new file mode 100644 index 000000000000..01e999003f5b --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunks_sample.py @@ -0,0 +1,30 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: set_sip_trunks_sample.py +DESCRIPTION: + This sample shows the usage of SIP routing client for replacing the collection of + currently configured SIP trunks with new values. + +USAGE: + python set_sip_trunks_sample.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +from azure.communication.phonenumbers.siprouting import SipRoutingClient, SipTrunk + +TRUNKS = [SipTrunk(fqdn="sbs1.sipsampletest.com", sip_signaling_port=1122), SipTrunk(fqdn="sbs2.sipsampletest.com", sip_signaling_port=1123)] +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +def set_sip_trunks_sample(): + client.set_trunks(TRUNKS) + +if __name__ == "__main__": + set_sip_trunks_sample() diff --git a/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunks_sample_async.py b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunks_sample_async.py new file mode 100644 index 000000000000..fc7796b271c9 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/samples/siprouting/set_sip_trunks_sample_async.py @@ -0,0 +1,34 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +""" +FILE: set_sip_trunks_sample_async.py +DESCRIPTION: + This sample shows the usage of asynchronous SIP routing client for replacing the collection of + currently configured SIP trunks with new values. + +USAGE: + python set_sip_trunks_sample_async.py + Set the environment variables with your own values before running the sample: + 1) COMMUNICATION_SAMPLES_CONNECTION_STRING - the connection string in your ACS account +""" + +import os +import asyncio +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient +from azure.communication.phonenumbers.siprouting import SipTrunk + +TRUNKS = [SipTrunk(fqdn="sbs1.sipsampletest.com", sip_signaling_port=1122), SipTrunk(fqdn="sbs2.sipsampletest.com", sip_signaling_port=1123)] +connection_string = os.getenv("COMMUNICATION_SAMPLES_CONNECTION_STRING") +client = SipRoutingClient.from_connection_string(connection_string) + +async def set_sip_trunks_sample(): + async with client: + await client.set_trunks(TRUNKS) + +if __name__ == "__main__": + asyncio.run(set_sip_trunks_sample()) + diff --git a/sdk/communication/azure-communication-phonenumbers/swagger/SIP_ROUTING_SWAGGER.md b/sdk/communication/azure-communication-phonenumbers/swagger/SIP_ROUTING_SWAGGER.md new file mode 100644 index 000000000000..8347a1dd5f76 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/swagger/SIP_ROUTING_SWAGGER.md @@ -0,0 +1,97 @@ +# Azure Communication Configuration for Python + +> see https://aka.ms/autorest + +### Setup +```ps +npm install -g autorest +``` + +### Generation +```ps +cd +autorest SWAGGER.md +``` + +### Settings +``` yaml +require: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/15d66311cc2b64f04692fdf021d1b235b538e1bc/specification/communication/data-plane/SipRouting/readme.md +tag: package-2021-05-01-preview +output-folder: ../azure/communication/phonenumbers/siprouting/_generated +namespace: azure.communication.phonenumbers.siprouting +no-namespace-folders: true +license-header: MICROSOFT_MIT_NO_VERSION +clear-output-folder: true +python: true +v3: true +title: SIP Routing Service +model-namespace: false +``` + +### Remove the -Patch types and use simple types instead, to simplify user interface +``` yaml +directive: + from: swagger-document + where: $.paths.*[?(@.operationId == "PatchSipConfiguration")].parameters..[?(@.description == "Configuration patch.")] + transform: > + $.schema = {"$ref": "#/definitions/SipConfiguration"} +``` + +``` yaml +directive: + from: swagger-document + where: $.definitions + transform: > + delete $.TrunkPatch +``` + +``` yaml +directive: + from: swagger-document + where: $.definitions + transform: > + delete $.SipConfigurationPatch +``` + +### Directive renaming "Trunk" model to "SipTrunkInternal" +``` yaml +directive: + from: swagger-document + where: "$.definitions.Trunk" + transform: > + $["x-ms-client-name"] = "SipTrunkInternal"; +``` + +### Directive renaming "TrunkRoute" model to "SipTrunkRoute" +``` yaml +directive: + from: swagger-document + where: "$.definitions.TrunkRoute" + transform: > + $["x-ms-client-name"] = "SipTrunkRoute"; +``` + +### Remove additional responses from Swagger, because they should be treated as errors and throw exception +``` yaml +directive: + from: swagger-document + where: $.paths.*[?(@.operationId == "PatchSipConfiguration")] + transform: > + delete $.responses["422"] +``` + +``` yaml +directive: + from: swagger-document + where: $.paths.*[?(@.operationId == "PatchSipConfiguration")] + transform: > + delete $.responses["415"] +``` + +``` yaml +directive: + from: swagger-document + where: $.paths.*[?(@.operationId == "PatchSipConfiguration")] + transform: > + delete $.responses["500"] +``` \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/test/_shared/uri_replacer_processor.py b/sdk/communication/azure-communication-phonenumbers/test/_shared/uri_replacer_processor.py new file mode 100644 index 000000000000..b0d8a504d283 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/_shared/uri_replacer_processor.py @@ -0,0 +1,30 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- +import re + +from azure_devtools.scenario_tests import RecordingProcessor + +class URIReplacerProcessor(RecordingProcessor): + def __init__(self, keys=None, replacement="sanitized"): + self._keys = keys if keys else [] + self._replacement = replacement + + def process_request(self, request): + request.uri = re.sub( + "https://([^/?])*.communication", + "https://sanitized.communication", + request.uri, + ) + return request + + def process_response(self, response): + if 'url' in response : + response['url'] = re.sub( + "https://([^/?])*.communication", + "https://sanitized.communication", + response['url'], + ) + return response \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_add_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_add_trunk.yaml new file mode 100644 index 000000000000..0d656951c27c --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_add_trunk.yaml @@ -0,0 +1,247 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:37 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:36 GMT + ms-cv: + - U7nV6phSLUuBlPzdqktkKg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 297ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:38 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:37 GMT + ms-cv: + - yy/oHFR/s0SNJSV9H3MB+A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 233ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:38 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:37 GMT + ms-cv: + - wGVCBVFi4k+74cdXc/K+jg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 607ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:39 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:38 GMT + ms-cv: + - ocyEfv4oEk6IDTY4neLreA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 802ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:40 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:39 GMT + ms-cv: + - WAZkBMF4bESPGxfakFooaA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 856ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:41 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:40 GMT + ms-cv: + - 7yqT1dZ5SU2BfunFQ5R03A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 162ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_add_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_add_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..3a9b0828a05d --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_add_trunk_from_managed_identity.yaml @@ -0,0 +1,240 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:41 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:40 GMT + ms-cv: + - fC4LVcYgsE+Qi3AeUQbOQA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 331ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:42 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:41 GMT + ms-cv: + - gzWSgsnNuUqt5KV0VCKe4Q.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 251ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null, + "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '108' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:42 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:41 GMT + ms-cv: + - nmk6XHTGhkKZyMwfTH0QyQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 501ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:43 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:42 GMT + ms-cv: + - 54BFwJeXeUi4GDgwrQQivw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 924ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:45 GMT + ms-cv: + - z2GyN1S5P0SbxJ41vdaZ7w.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 1673ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:46 GMT + ms-cv: + - xqx3gRgUg02gk4Q8ujf/ng.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 741ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_delete_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_delete_trunk.yaml new file mode 100644 index 000000000000..f58d09d536ec --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_delete_trunk.yaml @@ -0,0 +1,248 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:48 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:47 GMT + ms-cv: + - t/kQ2LLC+UqLrehdBhj91g.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 261ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:49 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:48 GMT + ms-cv: + - SvGrtlt9lkK4rdWwu85rsQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 169ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null, + "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '108' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:49 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:49 GMT + ms-cv: + - o0ekirlpx0eY99lvDS956g.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 582ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:50 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:50 GMT + ms-cv: + - FBiPqJqgR0uvICs87Mgcrg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 733ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:51 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:50 GMT + ms-cv: + - dJnLzyfXQk6ppj8d5j5Gtg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 317ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:51 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:50 GMT + ms-cv: + - k3yBMQVhR0W4cqpgR7GUBw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 136ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_delete_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_delete_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..782131d0cb25 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_delete_trunk_from_managed_identity.yaml @@ -0,0 +1,239 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:52 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:52 GMT + ms-cv: + - fCVs7Qi/U02aHHdNAgXGpg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 327ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:53 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:52 GMT + ms-cv: + - dLaLN3I4FEqEQakkxmAk8g.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 258ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:53 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:53 GMT + ms-cv: + - awi15oSbKkSeagOrfK7FCg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 345ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:54 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:54 GMT + ms-cv: + - hMN/XL4uQEiIG5zs6qAGGQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 796ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:55 GMT + ms-cv: + - NF/T4tDDRkOv/nmEq6+p7A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 418ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:56 GMT + ms-cv: + - mOVJ6heCr0WHQmLOBuPsJQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 213ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_routes.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_routes.yaml new file mode 100644 index 000000000000..109acb146b31 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_routes.yaml @@ -0,0 +1,250 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:57 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:57 GMT + ms-cv: + - 4+R//0q1rkGyyBTCiGgJxw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 247ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:58 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:57 GMT + ms-cv: + - j+jjTlVujEatGxOzpFLcgg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 185ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:58 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:58 GMT + ms-cv: + - gpCYLjEBJki9qLgq0z2Jrg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 346ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:00:59 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:59 GMT + ms-cv: + - 9zornMI6Ukif4NXrcT8UDQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 820ms + status: + code: 200 + message: OK +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:00 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:59 GMT + ms-cv: + - HhsgYYule0qEdgLRPxX24w.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 229ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:00 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:00:59 GMT + ms-cv: + - 461609NZ20GeOHv9ZVYcIw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 244ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_routes_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_routes_from_managed_identity.yaml new file mode 100644 index 000000000000..e926c71612b9 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_routes_from_managed_identity.yaml @@ -0,0 +1,242 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:00 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:00 GMT + ms-cv: + - 8Sy5DWPpYUSHwMOZG787DA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 236ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:02 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:00 GMT + ms-cv: + - CtpUbcpTv0mGQoqHm+9Qcg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 134ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:02 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:01 GMT + ms-cv: + - fDjZ9kvD80KiTU95oi2vYw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 334ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:02 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:02 GMT + ms-cv: + - eXbstW3/aE+dfGs6Z5ebRw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 676ms + status: + code: 200 + message: OK +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:03 GMT + ms-cv: + - cLF/2go/K0es1Oo4SiIBmg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 239ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:04 GMT + ms-cv: + - ZvtEQTBDOEihKDx+1k90IA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 219ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunk.yaml new file mode 100644 index 000000000000..dd36c7ab794c --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunk.yaml @@ -0,0 +1,205 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:05 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:04 GMT + ms-cv: + - XMr9L76nOkOthEmRXnMj2Q.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 300ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:06 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:04 GMT + ms-cv: + - uPLtIO7hC0Chz6ikWDjo4Q.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 252ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:06 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:05 GMT + ms-cv: + - YDq+Jmazj0eAcB7WK1izZg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 411ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:07 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:08 GMT + ms-cv: + - H6QwzYiD3keptTwxLGlzWQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 790ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:08 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:08 GMT + ms-cv: + - Dh8FbRdqOkOYFqFSsBorFw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 225ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..255ed4e306eb --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunk_from_managed_identity.yaml @@ -0,0 +1,201 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:09 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:08 GMT + ms-cv: + - rmW1g9yIfkKDrK4bQLvxQw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 339ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:10 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:09 GMT + ms-cv: + - 4HZVmbr6fEOXk4+s+Tww1g.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 253ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:11 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:09 GMT + ms-cv: + - 8Al9DThBEUa5JFIjuS941w.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 387ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:11 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:10 GMT + ms-cv: + - fLd9o2baBUCx0gzyQtLZ+A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 615ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:12 GMT + ms-cv: + - 5hgplNTEqkawK1xCt0IabQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 226ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunks.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunks.yaml new file mode 100644 index 000000000000..4a051eb65b51 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunks.yaml @@ -0,0 +1,205 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:13 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:13 GMT + ms-cv: + - 1ak1rfSH3EOJfQ56uIaGxQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 266ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:14 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:13 GMT + ms-cv: + - 1ZKvQ5T+GEyb52icwsE/eA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 139ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:14 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:13 GMT + ms-cv: + - VtRZRT2PekmilA53v5qCBw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 316ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:14 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:14 GMT + ms-cv: + - 3YrWCDKJdkOdptYnvOJZog.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 706ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:15 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:14 GMT + ms-cv: + - CLmW5wS/vUOly8YDcpPVeQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 156ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunks_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunks_from_managed_identity.yaml new file mode 100644 index 000000000000..559267e7b813 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_get_trunks_from_managed_identity.yaml @@ -0,0 +1,201 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:16 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:15 GMT + ms-cv: + - 5tVD9Ma/dU6tWC0E66DGGA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 235ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:16 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:16 GMT + ms-cv: + - cgol26ErYEuyRnDuKQFCtw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 174ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:17 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:16 GMT + ms-cv: + - 81zuKezH9EG1R+qihA7Wzw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 295ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:17 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:17 GMT + ms-cv: + - CLfprdS52UiLF+B2jg3Lag.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 629ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:18 GMT + ms-cv: + - 4VGwmzAB5UO5A1aVpnYycg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 124ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_routes.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_routes.yaml new file mode 100644 index 000000000000..4b39891bc3f0 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_routes.yaml @@ -0,0 +1,294 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:19 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:18 GMT + ms-cv: + - bqIaeym27UOC0pgCL0sU/A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 258ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:20 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:19 GMT + ms-cv: + - PhBhUtBACEKxZn3wLaR9sw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 151ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:20 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:19 GMT + ms-cv: + - QtfWNTovJ0GNtn4Rpi0CeQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 359ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:21 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:20 GMT + ms-cv: + - bRIitbNMcUWW5/zHgL3TTQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 640ms + status: + code: 200 + message: OK +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:22 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:21 GMT + ms-cv: + - gXreYa0IyEKg4520u7Y+ww.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 281ms + status: + code: 200 + message: OK +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+999''", "name": + "Alternative rule", "numberPattern": "\\+999[0-9]+", "trunks": ["sbs2.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '167' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:22 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:21 GMT + ms-cv: + - E/MAvQcnxEihPedXNSS6eg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 281ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:22 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:21 GMT + ms-cv: + - D9rR21rBj0q6VrKkUi2xiQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 137ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_routes_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_routes_from_managed_identity.yaml new file mode 100644 index 000000000000..a2303f931ce1 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_routes_from_managed_identity.yaml @@ -0,0 +1,282 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:23 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:24 GMT + ms-cv: + - u7DxMj8200eopMwuIyzA/A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 960ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:25 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:24 GMT + ms-cv: + - p8c2sKbjhEi8XCPkvKderQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 125ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:25 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:24 GMT + ms-cv: + - Mw5oCsL3d0ufJ3TZY4mwHA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 354ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:25 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:25 GMT + ms-cv: + - E+ilUIm3YUqQIYVyDx2FFQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 688ms + status: + code: 200 + message: OK +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:26 GMT + ms-cv: + - zXvgpj+y40qxoSy9xBWxhg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 508ms + status: + code: 200 + message: OK +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+999''", "name": + "Alternative rule", "numberPattern": "\\+999[0-9]+", "trunks": ["sbs2.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '167' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:26 GMT + ms-cv: + - eoIdssDIb0mGJu3GSjFqeQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 234ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:27 GMT + ms-cv: + - p7VfrTRCOUaVdFijO1O3zA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 126ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunk.yaml new file mode 100644 index 000000000000..6d236633eb5d --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunk.yaml @@ -0,0 +1,247 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:28 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:28 GMT + ms-cv: + - ispDysMj+Ui35yfo3+J5gA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 289ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:29 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:28 GMT + ms-cv: + - NngSNCyovk69bcO1p5xDlw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 141ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:30 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:29 GMT + ms-cv: + - /HGeqBNnzUKWOFjos4BTqQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 377ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:30 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:30 GMT + ms-cv: + - w/pKr0H0SEWvSvEJnMhedw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 636ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": {"sipSignalingPort": 7777}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:31 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:31 GMT + ms-cv: + - AxArr8cWRkWx1ciVzZrgXg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 580ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:32 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:31 GMT + ms-cv: + - ma6TZn+aU0C5SQsqX0PeOw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 197ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..fe1337d01375 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunk_from_managed_identity.yaml @@ -0,0 +1,239 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:32 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:32 GMT + ms-cv: + - ST45WmDs90qd2czf9u9Htg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 316ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:33 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:33 GMT + ms-cv: + - cw/8t1KWrkKfb+fy742JVw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 121ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:34 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:33 GMT + ms-cv: + - qJb+AtWot0yegD0LVivk4g.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 378ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 12:01:34 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:34 GMT + ms-cv: + - YuD6NqKQc0+FAw2gxK2Pzg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 674ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": {"sipSignalingPort": 7777}}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:35 GMT + ms-cv: + - V6usiS+Eu0yUL7PgTcPIng.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 498ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Mon, 23 May 2022 12:01:35 GMT + ms-cv: + - r1EVfOCqAEey4EnscF81KA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 184ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunks.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunks.yaml new file mode 100644 index 000000000000..51fe4e84d10f --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunks.yaml @@ -0,0 +1,244 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:45 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:46 GMT + ms-cv: + - T4BRgksRPECCxhnj/ppbow.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 917ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:46 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:46 GMT + ms-cv: + - ROLMC4p2skOGcWneNOe2xw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 213ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}, "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '152' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:47 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:47 GMT + ms-cv: + - IuWINSpJx06f0tUYLZPmvg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 1035ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:48 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:48 GMT + ms-cv: + - H3T6H4aUHk6uGANHGTmEWA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 245ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}, "sbs1.sipconfigtest.com": + null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '130' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:48 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:49 GMT + ms-cv: + - Jz28/zJUTkmanyjQjWAcoA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 1315ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:50 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:50 GMT + ms-cv: + - 22mzNHTc00+rK02w9bIWuw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 373ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunks_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunks_from_managed_identity.yaml new file mode 100644 index 000000000000..7077f6ccd6a7 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e.test_set_trunks_from_managed_identity.yaml @@ -0,0 +1,232 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:51 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:51 GMT + ms-cv: + - c2pUt7Mpo0OPoclNhkyR4A.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 547ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:52 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:52 GMT + ms-cv: + - KB58yN/OqEWN0SOLSP0sPw.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 270ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}, "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '152' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:39:52 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:54 GMT + ms-cv: + - 5m8KcBxVyUG9UVmPgxTimA.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 1858ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:56 GMT + ms-cv: + - eOqgZNziJEOr7R5IaWXD+g.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 328ms + status: + code: 200 + message: OK +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}, "sbs1.sipconfigtest.com": + null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '130' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:57 GMT + ms-cv: + - LzZC5xePc0264g2vR1T4zQ.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 1099ms + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/json + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: + - application/json; charset=utf-8 + date: + - Thu, 09 Jun 2022 08:39:57 GMT + ms-cv: + - YfP9BqdjnUCxinfLuLF6Kg.0 + strict-transport-security: + - max-age=2592000 + transfer-encoding: + - chunked + x-cache: + - CONFIG_NOCACHE + x-processing-time: + - 261ms + status: + code: 200 + message: OK +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_add_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_add_trunk.yaml new file mode 100644 index 000000000000..b53b56ce7a5d --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_add_trunk.yaml @@ -0,0 +1,187 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:42 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:42 GMT + ms-cv: 7sx2yqZDrkOOM33MVUsJTg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 451ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:43 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:42 GMT + ms-cv: smXs4FC9FE+Uj8XxWV9I8Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 262ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:43 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:43 GMT + ms-cv: zFW+oiEpZEq+p5G7oq+xuw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 699ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:44 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:45 GMT + ms-cv: fIBZ6R0dr0KC9NPhUnaOwA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1140ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}}}' + headers: + Accept: + - application/json + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:45 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:46 GMT + ms-cv: ADaGvSErtk2HXW+MeCnkWw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1047ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:47 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:46 GMT + ms-cv: VB3hCx4W4Uq3hyr8VL2zzg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 212ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_add_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_add_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..d9611050d242 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_add_trunk_from_managed_identity.yaml @@ -0,0 +1,180 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:47 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:47 GMT + ms-cv: rZmEte2MWE2PhwnzSsNIBQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 426ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:48 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:47 GMT + ms-cv: Z0ZYpNVNHEiZF1OgqrGe2w.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 372ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null, + "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '108' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:48 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:48 GMT + ms-cv: yt2kI2FhUUaHCQVoCMCkfA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 627ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:49 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:50 GMT + ms-cv: sWzxpTQWpky++j2w6N2hhA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1641ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}}}' + headers: + Accept: + - application/json + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:52 GMT + ms-cv: 2dtkpUCl8kO5Nqv8fleLag.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1440ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:53 GMT + ms-cv: IyJACuJOaEqMwCldzrjhDA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 220ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_delete_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_delete_trunk.yaml new file mode 100644 index 000000000000..97ea11fdfe49 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_delete_trunk.yaml @@ -0,0 +1,188 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:54 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:54 GMT + ms-cv: aNCLtJTwu0mNEdta/Nidfw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 340ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:55 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123},"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:55 GMT + ms-cv: Qo+nYMjPzkaDV+urpQjZbw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 193ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null, + "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '108' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:56 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:55 GMT + ms-cv: 1mV3Sf9ZRUW73RrqzcU3nQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 461ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:56 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:56 GMT + ms-cv: k1cvggReSEOmPb5Mltf/mA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 789ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:57 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:57 GMT + ms-cv: +N2uxm0C6EiKvtrgKNHjZA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 436ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:58 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:57 GMT + ms-cv: gjmgQ2G4DE+2rImAejkT2A.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 287ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_delete_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_delete_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..7556af1e28ec --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_delete_trunk_from_managed_identity.yaml @@ -0,0 +1,179 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:58 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:58 GMT + ms-cv: 4z5niFhQMEmKRNQIAqzaZA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 345ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:59 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:59 GMT + ms-cv: 6SHxlnvi6EurzL4lzo5QaA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 261ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:40:59 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:40:59 GMT + ms-cv: fZM6sNqXE0uG2D1MrdttRg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 523ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:00 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:00 GMT + ms-cv: NZHZVo2FqUqujnIjSw3rTQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 720ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:01 GMT + ms-cv: ih2rU+YfZE6EGz7ZyGsUDA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 480ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:02 GMT + ms-cv: G197N3/0cE2/4/2/35E3Og.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 330ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_routes.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_routes.yaml new file mode 100644 index 000000000000..8fda145f85de --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_routes.yaml @@ -0,0 +1,190 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:03 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:03 GMT + ms-cv: aBmtuPXkikSCebqojpbw4w.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 372ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:03 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:03 GMT + ms-cv: xMXz1+8tz0KpO4DMrBa+cQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 262ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '44' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:04 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:04 GMT + ms-cv: xthAFIIZVUGiM/44mebsog.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 448ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:04 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:05 GMT + ms-cv: AXueh08tiEWxVJ5wFKo6UA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 982ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:05 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:05 GMT + ms-cv: lcRB/lYApUWkmGjOv8eA9A.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 298ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:06 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:05 GMT + ms-cv: O3e2GNxLik+etpDcuzRcYQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 282ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_routes_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_routes_from_managed_identity.yaml new file mode 100644 index 000000000000..07d58ecc6ca6 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_routes_from_managed_identity.yaml @@ -0,0 +1,186 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:06 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:06 GMT + ms-cv: NqCl8cPBdU68wXu8femS/w.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 330ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:07 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:06 GMT + ms-cv: F9WtIQzC5kmzwScGuu3nEw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 288ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:08 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:07 GMT + ms-cv: QHKFD+wPYE+0J4Iv3TTfPg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 461ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:08 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:08 GMT + ms-cv: 3BB4TaRLuEiFRBKFay+XkA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 836ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:09 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:08 GMT + ms-cv: +/6RN3pXzUyhRuOwjqX5Eg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 396ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:09 GMT + ms-cv: rRi7QEtsfk61KkCLm5JvTQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 371ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunk.yaml new file mode 100644 index 000000000000..34613fbb49f4 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunk.yaml @@ -0,0 +1,155 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:11 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:10 GMT + ms-cv: RxMkkYe09kOdUjhtg5Ie1A.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 378ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:12 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:11 GMT + ms-cv: ypgrPJlD+EK6UMiAI9TaAg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 180ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:12 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:11 GMT + ms-cv: jxr6gqEIyEueyR5LjGYZQg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 383ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:12 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:12 GMT + ms-cv: ScPo21KWG0i4yTyVKk8Eow.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1035ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:14 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:13 GMT + ms-cv: dAn2upDPK0uATB9n75zSpg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 162ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..1ee7f08ef214 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunk_from_managed_identity.yaml @@ -0,0 +1,151 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:14 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:13 GMT + ms-cv: wGJFymw7WUehKdvldGrMJg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 361ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:15 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:14 GMT + ms-cv: GL3UQFhuMEuWI4OKRCe5vQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 255ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:15 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:14 GMT + ms-cv: hkVbbKhjwUG5hWIvFEB0aQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 423ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:16 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:15 GMT + ms-cv: cYB+sOW6H0CP1GCGDlTG+Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 986ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:17 GMT + ms-cv: +9g2vvu35UWaO9nKXAEOlA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 176ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunks.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunks.yaml new file mode 100644 index 000000000000..06a9acfd145c --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunks.yaml @@ -0,0 +1,155 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:18 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:17 GMT + ms-cv: 5dLeLfV6N0+qp68ERFlw2Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 277ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:19 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:17 GMT + ms-cv: YZFpybMfw0arS8W8GDeQeQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 206ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:19 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:18 GMT + ms-cv: HRqC9h2tBE+9EpvhkGLbEA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 377ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:19 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:19 GMT + ms-cv: QobxS5cZkk68/pCiSoRSUQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 963ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:20 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:19 GMT + ms-cv: TEPgXVyVdkGTQOmrWQrenQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 224ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunks_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunks_from_managed_identity.yaml new file mode 100644 index 000000000000..3843f566c0ec --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_get_trunks_from_managed_identity.yaml @@ -0,0 +1,151 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:21 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:21 GMT + ms-cv: uuT+de6TMkOPGWZoSF3aMg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 343ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:22 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:21 GMT + ms-cv: nBkBq6PRRUSsi6TK3HTEnQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 345ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:22 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:22 GMT + ms-cv: ZFB7PJVRn0ayNM0wmzufUw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 382ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:23 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:23 GMT + ms-cv: wH7wjwovJUO7tO0I0c2+Sg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 961ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:23 GMT + ms-cv: kn+uFDLjhUCnd811y/9DzA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 298ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_routes.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_routes.yaml new file mode 100644 index 000000000000..d8a26ddf07d9 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_routes.yaml @@ -0,0 +1,224 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:24 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:23 GMT + ms-cv: IoKRLyuMKU2X9vw2++a5Uw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 310ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:25 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:24 GMT + ms-cv: g137mBts/UmhMXBYTmrOIA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 180ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:25 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:24 GMT + ms-cv: 7+gt6pi5aEO4++3QmzLzmw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 403ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:26 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:25 GMT + ms-cv: EWi0MxIHf06HujoZ+wU/6w.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 875ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:27 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:26 GMT + ms-cv: IUrNuBzLYkyx+FiUa8F2+g.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 304ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+999''", "name": + "Alternative rule", "numberPattern": "\\+999[0-9]+", "trunks": ["sbs2.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Content-Length: + - '167' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:27 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:26 GMT + ms-cv: jTF0GTdW3USv/1vp54rOjA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 296ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:27 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:26 GMT + ms-cv: qX7GZD0d6ke3KVm8v9F3GA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 293ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_routes_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_routes_from_managed_identity.yaml new file mode 100644 index 000000000000..fad1d6042e42 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_routes_from_managed_identity.yaml @@ -0,0 +1,212 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:28 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:28 GMT + ms-cv: uZVAUEDU0EOgI+LRXxuCOg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 263ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:29 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:28 GMT + ms-cv: iZyQw4u7eU+WHNN7TlWGlA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 215ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:29 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:28 GMT + ms-cv: XzCDESMYM0SLUW+tHzNLnw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 407ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:30 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:29 GMT + ms-cv: J3cuD0RU7EGOiHOOyt30ug.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 935ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+123''", "name": + "First rule", "numberPattern": "\\+123[0-9]+", "trunks": ["sbs1.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Content-Length: + - '161' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+123''","name":"First rule","numberPattern":"\\+123[0-9]+","trunks":["sbs1.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:30 GMT + ms-cv: bCU+uDwkckSqF+8kZjTn7g.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 415ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"routes": [{"description": "Handle numbers starting with ''+999''", "name": + "Alternative rule", "numberPattern": "\\+999[0-9]+", "trunks": ["sbs2.sipconfigtest.com"]}]}' + headers: + Accept: + - application/json + Content-Length: + - '167' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:31 GMT + ms-cv: l3KNbnHqoUCwq+kL2j+hOQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 361ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[{"description":"Handle + numbers starting with ''+999''","name":"Alternative rule","numberPattern":"\\+999[0-9]+","trunks":["sbs2.sipconfigtest.com"]}]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:31 GMT + ms-cv: fCU3l3JTI0iztQnZHESRBg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 323ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunk.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunk.yaml new file mode 100644 index 000000000000..aed0abf32a6e --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunk.yaml @@ -0,0 +1,187 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:33 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:32 GMT + ms-cv: jvxsnY/ZVE2qhqGluIjJrA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 313ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:33 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:32 GMT + ms-cv: biiy3dwpVkCjYyrTTpHtpg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 254ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:34 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:33 GMT + ms-cv: SS5PNuXixU+NxaK8F5IW9Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 346ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:34 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:34 GMT + ms-cv: puoqX43rPkaxBvbzPAa+/w.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 813ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": {"sipSignalingPort": 7777}}}' + headers: + Accept: + - application/json + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:35 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:34 GMT + ms-cv: JDI+1NyHsk+dHx4EjhdlgA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 568ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:36 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:35 GMT + ms-cv: /5DPURkkgUSdPVCss8B67Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 306ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunk_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunk_from_managed_identity.yaml new file mode 100644 index 000000000000..67555448eda3 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunk_from_managed_identity.yaml @@ -0,0 +1,179 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:36 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:35 GMT + ms-cv: X4HwEgBEGUKqVDMO86zYnw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 378ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:37 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:37 GMT + ms-cv: 0WoreQhsP0Say2m0ZzwQ9g.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 224ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '76' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:37 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:37 GMT + ms-cv: UHZUwQc3OUCfZkQK05X9YQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 483ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}}}' + headers: + Accept: + - application/json + Content-Length: + - '120' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Mon, 23 May 2022 17:41:38 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:38 GMT + ms-cv: 27Y4uRBg70CH+YSbeZUwHw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 854ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs2.sipconfigtest.com": {"sipSignalingPort": 7777}}}' + headers: + Accept: + - application/json + Content-Length: + - '66' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:39 GMT + ms-cv: 6+h5Zo47cUSZuJr0OhjX8Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 719ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b2 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":7777}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Mon, 23 May 2022 17:41:39 GMT + ms-cv: vo9r5GGUlEWWqJqP/9O2Dw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 222ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunks.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunks.yaml new file mode 100644 index 000000000000..b80198edd112 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunks.yaml @@ -0,0 +1,184 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:10 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:10 GMT + ms-cv: 40DhLCcvP0WTTDFY44NfGA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 372ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:10 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:11 GMT + ms-cv: kzsm/yKy+ESBMvxrnipOJw.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 154ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}, "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '152' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:11 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:12 GMT + ms-cv: K2EKoH/EB0mJMud7G8rSqg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1296ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:12 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:12 GMT + ms-cv: gVba07k8r0uoQJ8PRccHaQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 174ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}, "sbs1.sipconfigtest.com": + null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '130' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:12 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:13 GMT + ms-cv: Xj7GFpakmka4O5moqmA2og.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 850ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:13 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:14 GMT + ms-cv: +UGpRBRHHEaHklk8HX1AVQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 159ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunks_from_managed_identity.yaml b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunks_from_managed_identity.yaml new file mode 100644 index 000000000000..d9faeab5d8d6 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/recordings/test_sip_routing_client_e2e_async.test_set_trunks_from_managed_identity.yaml @@ -0,0 +1,172 @@ +interactions: +- request: + body: '{"routes": []}' + headers: + Accept: + - application/json + Content-Length: + - '14' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:14 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:14 GMT + ms-cv: iDmo4wmVO06eA6E5m93LoA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 223ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '' + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:15 GMT + x-ms-return-client-request-id: + - 'true' + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:14 GMT + ms-cv: GMwQXKillkOEhNqoDm82oQ.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 164ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs1.sipconfigtest.com": {"sipSignalingPort": 1122}, "sbs2.sipconfigtest.com": + {"sipSignalingPort": 1123}, "sbs3.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '152' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + x-ms-date: + - Thu, 09 Jun 2022 08:35:15 GMT + x-ms-return-client-request-id: + - 'true' + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:15 GMT + ms-cv: R6kvkTPtGke3VPqIPEY3DA.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 963ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs1.sipconfigtest.com":{"sipSignalingPort":1122},"sbs2.sipconfigtest.com":{"sipSignalingPort":1123}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:17 GMT + ms-cv: aqYtZOYluEu11ml/cWOt6Q.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 318ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: '{"trunks": {"sbs3.sipconfigtest.com": {"sipSignalingPort": 2222}, "sbs1.sipconfigtest.com": + null, "sbs2.sipconfigtest.com": null}}' + headers: + Accept: + - application/json + Content-Length: + - '130' + Content-Type: + - application/merge-patch+json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: PATCH + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:18 GMT + ms-cv: xREcXDs9uk+mL2LqqG3LGg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 1266ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +- request: + body: null + headers: + Accept: + - application/json + User-Agent: + - azsdk-python-communication-phonenumbers/1.1.0b3 Python/3.10.0 (Windows-10-10.0.22000-SP0) + method: GET + uri: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview + response: + body: + string: '{"trunks":{"sbs3.sipconfigtest.com":{"sipSignalingPort":2222}},"routes":[]}' + headers: + content-type: application/json; charset=utf-8 + date: Thu, 09 Jun 2022 08:35:18 GMT + ms-cv: y9AQR8XOiEyTZgvyobowvg.0 + strict-transport-security: max-age=2592000 + transfer-encoding: chunked + x-cache: CONFIG_NOCACHE + x-processing-time: 272ms + status: + code: 200 + message: OK + url: https://sanitized.communication.azure.com/sip?api-version=2021-05-01-preview +version: 1 diff --git a/sdk/communication/azure-communication-phonenumbers/test/test_sip_routing_client_e2e.py b/sdk/communication/azure-communication-phonenumbers/test/test_sip_routing_client_e2e.py new file mode 100644 index 000000000000..2d1933afe00e --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/test_sip_routing_client_e2e.py @@ -0,0 +1,166 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +from _shared.testcase import CommunicationTestCase +from _shared.uri_replacer_processor import URIReplacerProcessor +from _shared.utils import create_token_credential, get_http_logging_policy + +from azure.communication.phonenumbers.siprouting import SipRoutingClient, SipTrunk, SipTrunkRoute +from azure.communication.phonenumbers._shared.utils import parse_connection_str + +class TestSipRoutingClientE2E(CommunicationTestCase): + TRUNKS = [SipTrunk(fqdn="sbs1.sipconfigtest.com", sip_signaling_port=1122), SipTrunk(fqdn="sbs2.sipconfigtest.com", sip_signaling_port=1123)] + ROUTES = [SipTrunkRoute(name="First rule", description="Handle numbers starting with '+123'", number_pattern="\\+123[0-9]+", trunks=["sbs1.sipconfigtest.com"])] + + def __init__(self, method_name): + super(TestSipRoutingClientE2E, self).__init__(method_name) + + def setUp(self): + super(TestSipRoutingClientE2E, self).setUp() + + self._sip_routing_client = SipRoutingClient.from_connection_string( + self.connection_str, http_logging_policy=get_http_logging_policy() + ) + self.recording_processors.extend([URIReplacerProcessor()]) + self._sip_routing_client.set_routes([]) + self._sip_routing_client.set_trunks(self.TRUNKS) + + def test_get_trunks_from_managed_identity(self): + client = self._get_sip_client_managed_identity() + trunks = client.get_trunks() + assert trunks is not None, "No trunks were returned." + self._trunks_are_equal(trunks,self.TRUNKS) + + def test_get_trunks(self): + trunks = self._sip_routing_client.get_trunks() + assert trunks is not None, "No trunks were returned." + self._trunks_are_equal(trunks,self.TRUNKS) + + def test_get_trunks_from_managed_identity(self): + client = self._get_sip_client_managed_identity() + trunks = client.get_trunks() + assert trunks is not None, "No trunks were returned." + self._trunks_are_equal(trunks,self.TRUNKS) + + def test_get_routes(self): + self._sip_routing_client.set_routes(self.ROUTES) + routes = self._sip_routing_client.get_routes() + assert routes is not None, "No routes were returned." + self._routes_are_equal(routes,self.ROUTES) + + def test_get_routes_from_managed_identity(self): + client = self._get_sip_client_managed_identity() + client.set_routes(self.ROUTES) + routes = client.get_routes() + assert routes is not None, "No routes were returned." + self._routes_are_equal(routes,self.ROUTES) + + def test_set_trunks(self): + new_trunks = [SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222)] + self._sip_routing_client.set_trunks(new_trunks) + result_trunks = self._sip_routing_client.get_trunks() + assert result_trunks is not None, "No trunks were returned." + self._trunks_are_equal(result_trunks,new_trunks) + + def test_set_trunks_from_managed_identity(self): + new_trunks = [SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222)] + client = self._get_sip_client_managed_identity() + client.set_trunks(new_trunks) + result_trunks = client.get_trunks() + assert result_trunks is not None, "No trunks were returned." + self._trunks_are_equal(result_trunks,new_trunks) + + def test_set_routes(self): + new_routes = [SipTrunkRoute(name="Alternative rule", description="Handle numbers starting with '+999'", number_pattern="\\+999[0-9]+", trunks=["sbs2.sipconfigtest.com"])] + self._sip_routing_client.set_routes(self.ROUTES) + self._sip_routing_client.set_routes(new_routes) + result_routes = self._sip_routing_client.get_routes() + assert result_routes is not None, "No routes were returned." + self._routes_are_equal(result_routes,new_routes) + + def test_set_routes_from_managed_identity(self): + new_routes = [SipTrunkRoute(name="Alternative rule", description="Handle numbers starting with '+999'", number_pattern="\\+999[0-9]+", trunks=["sbs2.sipconfigtest.com"])] + client = self._get_sip_client_managed_identity() + client.set_routes(self.ROUTES) + client.set_routes(new_routes) + result_routes = client.get_routes() + assert result_routes is not None, "No routes were returned." + self._routes_are_equal(result_routes,new_routes) + + def test_delete_trunk(self): + trunk_to_delete = self.TRUNKS[1].fqdn + self._sip_routing_client.delete_trunk(trunk_to_delete) + new_trunks = self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0]]) + + def test_delete_trunk_from_managed_identity(self): + trunk_to_delete = self.TRUNKS[1].fqdn + client = self._get_sip_client_managed_identity() + client.delete_trunk(trunk_to_delete) + new_trunks = client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0]]) + + def test_add_trunk(self): + new_trunk = SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222) + self._sip_routing_client.set_trunk(new_trunk) + new_trunks = self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],self.TRUNKS[1],new_trunk]) + + def test_add_trunk_from_managed_identity(self): + new_trunk = SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222) + client = self._get_sip_client_managed_identity() + client.set_trunk(new_trunk) + new_trunks = client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],self.TRUNKS[1],new_trunk]) + + def test_get_trunk(self): + trunk = self._sip_routing_client.get_trunk(self.TRUNKS[0].fqdn) + assert trunk is not None, "No trunk was returned." + trunk == self.TRUNKS[0] + + def test_get_trunk_from_managed_identity(self): + client = self._get_sip_client_managed_identity() + trunk = client.get_trunk(self.TRUNKS[0].fqdn) + assert trunk is not None, "No trunk was returned." + trunk == self.TRUNKS[0] + + def test_set_trunk(self): + modified_trunk = SipTrunk(fqdn=self.TRUNKS[1].fqdn,sip_signaling_port=7777) + self._sip_routing_client.set_trunk(modified_trunk) + new_trunks = self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],modified_trunk]) + + def test_set_trunk_from_managed_identity(self): + modified_trunk = SipTrunk(fqdn=self.TRUNKS[1].fqdn,sip_signaling_port=7777) + client = self._get_sip_client_managed_identity() + client.set_trunk(modified_trunk) + new_trunks = client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],modified_trunk]) + + def _get_sip_client_managed_identity(self): + endpoint, accesskey = parse_connection_str(self.connection_str) + credential = create_token_credential() + return SipRoutingClient(endpoint, credential) + + def _trunks_are_equal(self, response_trunks, request_trunks): + assert len(response_trunks) == len(request_trunks), "Trunks have different length." + + for k in range(len(request_trunks)): + assert response_trunks[k].fqdn==request_trunks[k].fqdn, "Trunk FQDNs don't match." + assert ( + response_trunks[k].sip_signaling_port==request_trunks[k].sip_signaling_port + ), "SIP signaling ports don't match." + + def _routes_are_equal(self, response_routes, request_routes): + assert len(response_routes) == len(request_routes) + + for k in range(len(request_routes)): + assert request_routes[k].name == response_routes[k].name, "Names don't match." + assert request_routes[k].description == response_routes[k].description, "Descriptions don't match." + assert ( + request_routes[k].number_pattern == response_routes[k].number_pattern + ), "Number patterns don't match." + assert request_routes[k].trunks == response_routes[k].trunks, "Trunk lists don't match." \ No newline at end of file diff --git a/sdk/communication/azure-communication-phonenumbers/test/test_sip_routing_client_e2e_async.py b/sdk/communication/azure-communication-phonenumbers/test/test_sip_routing_client_e2e_async.py new file mode 100644 index 000000000000..96f5eb1d4908 --- /dev/null +++ b/sdk/communication/azure-communication-phonenumbers/test/test_sip_routing_client_e2e_async.py @@ -0,0 +1,200 @@ +# ------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# -------------------------------------------------------------------------- + +import asyncio + +from _shared.asynctestcase import AsyncCommunicationTestCase +from _shared.uri_replacer_processor import URIReplacerProcessor +from _shared.utils import async_create_token_credential, get_http_logging_policy + +from azure.communication.phonenumbers.siprouting.aio import SipRoutingClient +from azure.communication.phonenumbers.siprouting._generated.models import SipTrunkRoute +from azure.communication.phonenumbers.siprouting._models import SipTrunk +from azure.communication.phonenumbers._shared.utils import parse_connection_str + +class TestSipRoutingClientE2EAsync(AsyncCommunicationTestCase): + TRUNKS = [SipTrunk(fqdn="sbs1.sipconfigtest.com", sip_signaling_port=1122), SipTrunk(fqdn="sbs2.sipconfigtest.com", sip_signaling_port=1123)] + ROUTES = [SipTrunkRoute(name="First rule", description="Handle numbers starting with '+123'", number_pattern="\\+123[0-9]+", trunks=["sbs1.sipconfigtest.com"])] + + def __init__(self, method_name): + super(TestSipRoutingClientE2EAsync, self).__init__(method_name) + + def setUp(self): + super(TestSipRoutingClientE2EAsync, self).setUp() + + self._sip_routing_client = SipRoutingClient.from_connection_string( + self.connection_str, http_logging_policy=get_http_logging_policy() + ) + self.recording_processors.extend([URIReplacerProcessor()]) + loop = asyncio.get_event_loop() + coroutine = self._sip_routing_client.set_routes([]) + loop.run_until_complete(coroutine) + loop = asyncio.get_event_loop() + coroutine = self._sip_routing_client.set_trunks(self.TRUNKS) + loop.run_until_complete(coroutine) + + @AsyncCommunicationTestCase.await_prepared_test + async def test_get_trunks(self): + async with self._sip_routing_client: + trunks = await self._sip_routing_client.get_trunks() + assert trunks is not None, "No trunks were returned." + self._trunks_are_equal(trunks,self.TRUNKS), "Trunks are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_get_trunks_from_managed_identity(self): + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + trunks = await self._sip_routing_client.get_trunks() + assert trunks is not None, "No trunks were returned." + self._trunks_are_equal(trunks,self.TRUNKS), "Trunks are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_get_routes(self): + async with self._sip_routing_client: + await self._sip_routing_client.set_routes(self.ROUTES) + routes = await self._sip_routing_client.get_routes() + assert routes is not None, "No routes were returned." + self._routes_are_equal(routes,self.ROUTES), "Routes are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_get_routes_from_managed_identity(self): + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + await self._sip_routing_client.set_routes(self.ROUTES) + routes = await self._sip_routing_client.get_routes() + assert routes is not None, "No routes were returned." + self._routes_are_equal(routes,self.ROUTES), "Routes are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_set_trunks(self): + new_trunks = [SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222)] + async with self._sip_routing_client: + await self._sip_routing_client.set_trunks(new_trunks) + result_trunks = await self._sip_routing_client.get_trunks() + assert result_trunks is not None, "No trunks were returned." + self._trunks_are_equal(result_trunks,new_trunks), "Trunks are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_set_trunks_from_managed_identity(self): + new_trunks = [SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222)] + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + await self._sip_routing_client.set_trunks(new_trunks) + result_trunks = await self._sip_routing_client.get_trunks() + assert result_trunks is not None, "No trunks were returned." + self._trunks_are_equal(result_trunks,new_trunks), "Trunks are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_set_routes(self): + new_routes = [SipTrunkRoute(name="Alternative rule", description="Handle numbers starting with '+999'", number_pattern="\\+999[0-9]+", trunks=["sbs2.sipconfigtest.com"])] + async with self._sip_routing_client: + await self._sip_routing_client.set_routes(self.ROUTES) + await self._sip_routing_client.set_routes(new_routes) + result_routes = await self._sip_routing_client.get_routes() + assert result_routes is not None, "No routes were returned." + self._routes_are_equal(result_routes,new_routes), "Routes are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_set_routes_from_managed_identity(self): + new_routes = [SipTrunkRoute(name="Alternative rule", description="Handle numbers starting with '+999'", number_pattern="\\+999[0-9]+", trunks=["sbs2.sipconfigtest.com"])] + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + await self._sip_routing_client.set_routes(self.ROUTES) + await self._sip_routing_client.set_routes(new_routes) + result_routes = await self._sip_routing_client.get_routes() + assert result_routes is not None, "No routes were returned." + self._routes_are_equal(result_routes,new_routes), "Routes are not equal." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_delete_trunk(self): + trunk_to_delete = self.TRUNKS[1].fqdn + async with self._sip_routing_client: + await self._sip_routing_client.delete_trunk(trunk_to_delete) + new_trunks = await self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0]]), "Trunk was not deleted." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_delete_trunk_from_managed_identity(self): + trunk_to_delete = self.TRUNKS[1].fqdn + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + await self._sip_routing_client.delete_trunk(trunk_to_delete) + new_trunks = await self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0]]), "Trunk was not deleted." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_add_trunk(self): + new_trunk = SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222) + async with self._sip_routing_client: + await self._sip_routing_client.set_trunk(new_trunk) + new_trunks = await self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],self.TRUNKS[1],new_trunk]) + + @AsyncCommunicationTestCase.await_prepared_test + async def test_add_trunk_from_managed_identity(self): + new_trunk = SipTrunk(fqdn="sbs3.sipconfigtest.com", sip_signaling_port=2222) + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + await self._sip_routing_client.set_trunk(new_trunk) + new_trunks = await self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],self.TRUNKS[1],new_trunk]) + + @AsyncCommunicationTestCase.await_prepared_test + async def test_get_trunk(self): + async with self._sip_routing_client: + trunk = await self._sip_routing_client.get_trunk(self.TRUNKS[0].fqdn) + assert trunk is not None, "No trunk was returned." + self._trunks_are_equal([trunk],[self.TRUNKS[0]]), "Returned trunk does not match the required trunk." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_get_trunk_from_managed_identity(self): + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + trunk = await self._sip_routing_client.get_trunk(self.TRUNKS[0].fqdn) + assert trunk is not None, "No trunk was returned." + self._trunks_are_equal([trunk],[self.TRUNKS[0]]), "Returned trunk does not match the required trunk." + + @AsyncCommunicationTestCase.await_prepared_test + async def test_set_trunk(self): + modified_trunk = SipTrunk(fqdn=self.TRUNKS[1].fqdn,sip_signaling_port=7777) + async with self._sip_routing_client: + await self._sip_routing_client.set_trunk(modified_trunk) + new_trunks = await self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],modified_trunk]) + + @AsyncCommunicationTestCase.await_prepared_test + async def test_set_trunk_from_managed_identity(self): + modified_trunk = SipTrunk(fqdn=self.TRUNKS[1].fqdn,sip_signaling_port=7777) + self._sip_routing_client = self._get_sip_client_managed_identity() + async with self._sip_routing_client: + await self._sip_routing_client.set_trunk(modified_trunk) + new_trunks = await self._sip_routing_client.get_trunks() + self._trunks_are_equal(new_trunks,[self.TRUNKS[0],modified_trunk]) + + def _get_sip_client_managed_identity(self): + endpoint, accesskey = parse_connection_str(self.connection_str) + credential = async_create_token_credential() + return SipRoutingClient(endpoint, credential, http_logging_policy=get_http_logging_policy()) + + def _trunks_are_equal(self, response_trunks, request_trunks): + assert len(response_trunks) == len(request_trunks) + + for k in range(len(request_trunks)): + assert response_trunks[k].fqdn==request_trunks[k].fqdn, "Trunk FQDNs don't match." + assert ( + response_trunks[k].sip_signaling_port==request_trunks[k].sip_signaling_port + ), "SIP signaling ports don't match." + + def _routes_are_equal(self, response_routes, request_routes): + assert len(response_routes) == len(request_routes) + + for k in range(len(request_routes)): + assert request_routes[k].name == response_routes[k].name, "Names don't match." + assert request_routes[k].description == response_routes[k].description, "Descriptions don't match." + assert ( + request_routes[k].number_pattern == response_routes[k].number_pattern + ), "Number patterns don't match." + assert request_routes[k].trunks == response_routes[k].trunks, "Trunk lists don't match."