Skip to content

Commit f6a5b34

Browse files
authored
[Communication] Add moveParticipants functionality to Call Automation (#41448)
* Move Participants addition * Updating the test case to move one participant
1 parent cc5f253 commit f6a5b34

File tree

19 files changed

+1298
-137
lines changed

19 files changed

+1298
-137
lines changed

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
RecordingProperties,
1919
AddParticipantResult,
2020
RemoveParticipantResult,
21+
MoveParticipantsResult,
2122
TransferCallResult,
2223
MediaStreamingOptions,
2324
TranscriptionOptions,
@@ -78,6 +79,7 @@
7879
"RecordingProperties",
7980
"AddParticipantResult",
8081
"RemoveParticipantResult",
82+
"MoveParticipantsResult",
8183
"TransferCallResult",
8284
"MuteParticipantResult",
8385
"SendDtmfTonesResult",

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_call_connection_client.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
CallConnectionProperties,
2222
AddParticipantResult,
2323
RemoveParticipantResult,
24+
MoveParticipantsResult,
2425
TransferCallResult,
2526
MuteParticipantResult,
2627
SendDtmfTonesResult,
@@ -31,6 +32,7 @@
3132
from ._generated.models import (
3233
AddParticipantRequest,
3334
RemoveParticipantRequest,
35+
MoveParticipantsRequest,
3436
TransferToParticipantRequest,
3537
PlayRequest,
3638
RecognizeRequest,
@@ -374,6 +376,46 @@ def remove_participant(
374376

375377
return RemoveParticipantResult._from_generated(response) # pylint:disable=protected-access
376378

379+
@distributed_trace
380+
def move_participants(
381+
self,
382+
target_participants: List["CommunicationIdentifier"],
383+
from_call: str,
384+
*,
385+
operation_context: Optional[str] = None,
386+
operation_callback_url: Optional[str] = None,
387+
**kwargs,
388+
) -> MoveParticipantsResult:
389+
"""Move participants from another call to this call.
390+
391+
:param target_participants: The participants to move to this call.
392+
:type target_participants: list[~azure.communication.callautomation.CommunicationIdentifier]
393+
:param from_call: The CallConnectionId for the call you want to move the participant from.
394+
:type from_call: str
395+
:keyword operation_context: Value that can be used to track this call and its associated events.
396+
:paramtype operation_context: str
397+
:keyword operation_callback_url: Set a callback URL that overrides the default callback URL set
398+
by CreateCall/AnswerCall for this operation.
399+
This setup is per-action. If this is not set, the default callback URL set by
400+
CreateCall/AnswerCall will be used.
401+
:paramtype operation_callback_url: str or None
402+
:return: MoveParticipantsResult
403+
:rtype: ~azure.communication.callautomation.MoveParticipantsResult
404+
:raises ~azure.core.exceptions.HttpResponseError:
405+
"""
406+
move_participants_request = MoveParticipantsRequest(
407+
target_participants=[serialize_identifier(participant) for participant in target_participants],
408+
from_call=from_call,
409+
operation_context=operation_context,
410+
operation_callback_uri=operation_callback_url,
411+
)
412+
process_repeatability_first_sent(kwargs)
413+
response = self._call_connection_client.move_participants(
414+
self._call_connection_id, move_participants_request, **kwargs
415+
)
416+
417+
return MoveParticipantsResult._from_generated(response) # pylint:disable=protected-access
418+
377419
@overload
378420
def play_media(
379421
self,

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_content_downloader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from azure.core.utils import case_insensitive_dict
2121

2222
from ._generated import models as _models
23-
from ._generated._serialization import Serializer
23+
from ._generated._utils.serialization import Serializer
2424
from ._generated.operations import CallRecordingOperations
2525

2626
_SERIALIZER = Serializer()

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from . import models as _models
1919
from ._configuration import AzureCommunicationCallAutomationServiceConfiguration
20-
from ._serialization import Deserializer, Serializer
20+
from ._utils.serialization import Deserializer, Serializer
2121
from .operations import (
2222
AzureCommunicationCallAutomationServiceOperationsMixin,
2323
CallConnectionOperations,
@@ -53,6 +53,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any)
5353
self._config = AzureCommunicationCallAutomationServiceConfiguration(
5454
endpoint=endpoint, credential=credential, **kwargs
5555
)
56+
5657
_policies = kwargs.pop("policies", None)
5758
if _policies is None:
5859
_policies = [
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# --------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for license information.
4+
# Code generated by Microsoft (R) AutoRest Code Generator.
5+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
6+
# --------------------------------------------------------------------------
Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,10 @@
11
# pylint: disable=line-too-long,useless-suppression,too-many-lines
2+
# coding=utf-8
23
# --------------------------------------------------------------------------
3-
#
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
#
6-
# The MIT License (MIT)
7-
#
8-
# Permission is hereby granted, free of charge, to any person obtaining a copy
9-
# of this software and associated documentation files (the ""Software""), to
10-
# deal in the Software without restriction, including without limitation the
11-
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12-
# sell copies of the Software, and to permit persons to whom the Software is
13-
# furnished to do so, subject to the following conditions:
14-
#
15-
# The above copyright notice and this permission notice shall be included in
16-
# all copies or substantial portions of the Software.
17-
#
18-
# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23-
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24-
# IN THE SOFTWARE.
25-
#
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) AutoRest Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
268
# --------------------------------------------------------------------------
279

2810
# pyright: reportUnnecessaryTypeIgnoreComment=false
@@ -411,7 +393,7 @@ def from_dict(
411393
:param function key_extractors: A key extractor function.
412394
:param str content_type: JSON by default, set application/xml if XML.
413395
:returns: An instance of this model
414-
:raises: DeserializationError if something went wrong
396+
:raises DeserializationError: if something went wrong
415397
:rtype: Self
416398
"""
417399
deserializer = Deserializer(cls._infer_class_models())
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@
66
# --------------------------------------------------------------------------
77

88
from abc import ABC
9-
from typing import TYPE_CHECKING
10-
11-
from ._configuration import AzureCommunicationCallAutomationServiceConfiguration
9+
from typing import Generic, TYPE_CHECKING, TypeVar
1210

1311
if TYPE_CHECKING:
14-
from azure.core import PipelineClient
12+
from .serialization import Deserializer, Serializer
13+
1514

16-
from ._serialization import Deserializer, Serializer
15+
TClient = TypeVar("TClient")
16+
TConfig = TypeVar("TConfig")
1717

1818

19-
class AzureCommunicationCallAutomationServiceMixinABC(ABC): # pylint: disable=name-too-long
19+
class ClientMixinABC(ABC, Generic[TClient, TConfig]):
2020
"""DO NOT use this class. It is for internal typing use only."""
2121

22-
_client: "PipelineClient"
23-
_config: AzureCommunicationCallAutomationServiceConfiguration
22+
_client: TClient
23+
_config: TConfig
2424
_serialize: "Serializer"
2525
_deserialize: "Deserializer"

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from azure.core.rest import AsyncHttpResponse, HttpRequest
1717

1818
from .. import models as _models
19-
from .._serialization import Deserializer, Serializer
19+
from .._utils.serialization import Deserializer, Serializer
2020
from ._configuration import AzureCommunicationCallAutomationServiceConfiguration
2121
from .operations import (
2222
AzureCommunicationCallAutomationServiceOperationsMixin,
@@ -54,6 +54,7 @@ def __init__(self, endpoint: str, credential: AzureKeyCredential, **kwargs: Any)
5454
self._config = AzureCommunicationCallAutomationServiceConfiguration(
5555
endpoint=endpoint, credential=credential, **kwargs
5656
)
57+
5758
_policies = kwargs.pop("policies", None)
5859
if _policies is None:
5960
_policies = [

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/aio/_vendor.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)