Skip to content

Commit b1291b0

Browse files
updated OPS outgoing call feature (Azure#38928)
* updated OPS outgoing call feature * fixed pipeline compliant
1 parent a1a6086 commit b1291b0

File tree

7 files changed

+92
-21
lines changed

7 files changed

+92
-21
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ def __init__(
9797
*,
9898
api_version: Optional[str] = None,
9999
source: Optional["CommunicationUserIdentifier"] = None,
100-
ops_source: Optional["MicrosoftTeamsAppIdentifier"] = None,
101100
**kwargs,
102101
) -> None:
103102
if not credential:
@@ -137,7 +136,6 @@ def __init__(
137136
self._call_recording_client = self._client.call_recording
138137
self._downloader = ContentDownloader(self._call_recording_client)
139138
self.source = source
140-
self.ops_source = ops_source
141139

142140
@classmethod
143141
def from_connection_string(cls, conn_str: str, **kwargs) -> "CallAutomationClient":
@@ -324,6 +322,7 @@ def create_call(
324322
voip_headers: Optional[Dict[str, str]] = None,
325323
media_streaming: Optional['MediaStreamingOptions'] = None,
326324
transcription: Optional['TranscriptionOptions'] = None,
325+
teams_app_source: Optional['MicrosoftTeamsAppIdentifier'] = None,
327326
**kwargs
328327
) -> CallConnectionProperties:
329328
"""Create a call connection request to a target identity.
@@ -354,6 +353,10 @@ def create_call(
354353
:keyword transcription: Configuration of live transcription.
355354
:paramtype transcription: ~azure.communication.callautomation.TranscriptionOptions
356355
or None
356+
:keyword teams_app_source: Overrides default client source by a MicrosoftTeamsAppIdentifier type source.
357+
Required for creating call with Teams resource account ID.
358+
This is per-operation setting and does not change the client's default source.
359+
:paramtype teams_app_source: ~azure.communication.callautomation.MicrosoftTeamsAppIdentifier or None
357360
:return: CallConnectionProperties
358361
:rtype: ~azure.communication.callautomation.CallConnectionProperties
359362
:raises ~azure.core.exceptions.HttpResponseError:
@@ -386,7 +389,7 @@ def create_call(
386389
source_caller_id_number=serialize_phone_identifier(source_caller_id_number),
387390
source_display_name=source_display_name,
388391
source=serialize_communication_user_identifier(self.source),
389-
ops_source=serialize_msft_teams_app_identifier(self.ops_source),
392+
teams_app_source=serialize_msft_teams_app_identifier(teams_app_source),
390393
operation_context=operation_context,
391394
call_intelligence_options=call_intelligence_options,
392395
media_streaming_options=media_config,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def _create_xml_node(tag, prefix=None, ns=None):
310310
return ET.Element(tag)
311311

312312

313-
class Model(object):
313+
class Model:
314314
"""Mixin for all client request body/response body models to support
315315
serialization and deserialization.
316316
"""
@@ -563,7 +563,7 @@ def _decode_attribute_map_key(key):
563563
return key.replace("\\.", ".")
564564

565565

566-
class Serializer(object): # pylint: disable=too-many-public-methods
566+
class Serializer: # pylint: disable=too-many-public-methods
567567
"""Request object model serializer."""
568568

569569
basic_types = {str: "str", int: "int", bool: "bool", float: "float"}
@@ -1441,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument
14411441
return children[0]
14421442

14431443

1444-
class Deserializer(object):
1444+
class Deserializer:
14451445
"""Response object model deserializer.
14461446
14471447
:param dict classes: Class type dictionary for deserializing complex types.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
HoldAudioStarted,
7373
HoldFailed,
7474
HoldRequest,
75+
IncomingCall,
7576
InterruptAudioAndAnnounceRequest,
7677
MediaStreamingFailed,
7778
MediaStreamingOptions,
@@ -235,6 +236,7 @@
235236
"HoldAudioStarted",
236237
"HoldFailed",
237238
"HoldRequest",
239+
"IncomingCall",
238240
"InterruptAudioAndAnnounceRequest",
239241
"MediaStreamingFailed",
240242
"MediaStreamingOptions",

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/_generated/models/_models.py

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2024,8 +2024,9 @@ class CreateCallRequest(_serialization.Model):
20242024
:ivar call_intelligence_options: AI options for the call.
20252025
:vartype call_intelligence_options:
20262026
~azure.communication.callautomation.models.CallIntelligenceOptions
2027-
:ivar ops_source: The identifier of the source in an OPS call.
2028-
:vartype ops_source:
2027+
:ivar teams_app_source: The identifier of the source for creating call with Teams resource
2028+
account ID.
2029+
:vartype teams_app_source:
20292030
~azure.communication.callautomation.models.MicrosoftTeamsAppIdentifierModel
20302031
:ivar custom_calling_context: Used by customer to send custom calling context to targets.
20312032
:vartype custom_calling_context:
@@ -2050,7 +2051,7 @@ class CreateCallRequest(_serialization.Model):
20502051
"operation_context": {"key": "operationContext", "type": "str"},
20512052
"callback_uri": {"key": "callbackUri", "type": "str"},
20522053
"call_intelligence_options": {"key": "callIntelligenceOptions", "type": "CallIntelligenceOptions"},
2053-
"ops_source": {"key": "opsSource", "type": "MicrosoftTeamsAppIdentifierModel"},
2054+
"teams_app_source": {"key": "teamsAppSource", "type": "MicrosoftTeamsAppIdentifierModel"},
20542055
"custom_calling_context": {"key": "customCallingContext", "type": "CustomCallingContext"},
20552056
"media_streaming_options": {"key": "mediaStreamingOptions", "type": "MediaStreamingOptions"},
20562057
"transcription_options": {"key": "transcriptionOptions", "type": "TranscriptionOptions"},
@@ -2066,7 +2067,7 @@ def __init__(
20662067
source: Optional["_models.CommunicationUserIdentifierModel"] = None,
20672068
operation_context: Optional[str] = None,
20682069
call_intelligence_options: Optional["_models.CallIntelligenceOptions"] = None,
2069-
ops_source: Optional["_models.MicrosoftTeamsAppIdentifierModel"] = None,
2070+
teams_app_source: Optional["_models.MicrosoftTeamsAppIdentifierModel"] = None,
20702071
custom_calling_context: Optional["_models.CustomCallingContext"] = None,
20712072
media_streaming_options: Optional["_models.MediaStreamingOptions"] = None,
20722073
transcription_options: Optional["_models.TranscriptionOptions"] = None,
@@ -2092,8 +2093,9 @@ def __init__(
20922093
:keyword call_intelligence_options: AI options for the call.
20932094
:paramtype call_intelligence_options:
20942095
~azure.communication.callautomation.models.CallIntelligenceOptions
2095-
:keyword ops_source: The identifier of the source in an OPS call.
2096-
:paramtype ops_source:
2096+
:keyword teams_app_source: The identifier of the source for creating call with Teams resource
2097+
account ID.
2098+
:paramtype teams_app_source:
20972099
~azure.communication.callautomation.models.MicrosoftTeamsAppIdentifierModel
20982100
:keyword custom_calling_context: Used by customer to send custom calling context to targets.
20992101
:paramtype custom_calling_context:
@@ -2113,7 +2115,7 @@ def __init__(
21132115
self.operation_context = operation_context
21142116
self.callback_uri = callback_uri
21152117
self.call_intelligence_options = call_intelligence_options
2116-
self.ops_source = ops_source
2118+
self.teams_app_source = teams_app_source
21172119
self.custom_calling_context = custom_calling_context
21182120
self.media_streaming_options = media_streaming_options
21192121
self.transcription_options = transcription_options
@@ -3435,6 +3437,67 @@ def __init__(
34353437
self.operation_callback_uri = operation_callback_uri
34363438

34373439

3440+
class IncomingCall(_serialization.Model):
3441+
"""The incoming call event.
3442+
3443+
Variables are only populated by the server, and will be ignored when sending a request.
3444+
3445+
:ivar to: The communication identifier of the target user.
3446+
:vartype to: ~azure.communication.callautomation.models.CommunicationIdentifierModel
3447+
:ivar from_property: The communication identifier of the user who initiated the call.
3448+
:vartype from_property: ~azure.communication.callautomation.models.CommunicationIdentifierModel
3449+
:ivar caller_display_name: Display name of caller.
3450+
:vartype caller_display_name: str
3451+
:ivar server_call_id: The server call id.
3452+
:vartype server_call_id: str
3453+
:ivar custom_context: Custom Context of Incoming Call.
3454+
:vartype custom_context: ~azure.communication.callautomation.models.CustomCallingContext
3455+
:ivar incoming_call_context: Incoming call context.
3456+
:vartype incoming_call_context: str
3457+
:ivar on_behalf_of_callee: The communication identifier of the user on behalf of whom the call
3458+
is made.
3459+
:vartype on_behalf_of_callee:
3460+
~azure.communication.callautomation.models.CommunicationIdentifierModel
3461+
:ivar correlation_id: Correlation ID for event to call correlation. Also called ChainId for
3462+
skype chain ID.
3463+
:vartype correlation_id: str
3464+
"""
3465+
3466+
_validation = {
3467+
"to": {"readonly": True},
3468+
"from_property": {"readonly": True},
3469+
"caller_display_name": {"readonly": True},
3470+
"server_call_id": {"readonly": True},
3471+
"custom_context": {"readonly": True},
3472+
"incoming_call_context": {"readonly": True},
3473+
"on_behalf_of_callee": {"readonly": True},
3474+
"correlation_id": {"readonly": True},
3475+
}
3476+
3477+
_attribute_map = {
3478+
"to": {"key": "to", "type": "CommunicationIdentifierModel"},
3479+
"from_property": {"key": "from", "type": "CommunicationIdentifierModel"},
3480+
"caller_display_name": {"key": "callerDisplayName", "type": "str"},
3481+
"server_call_id": {"key": "serverCallId", "type": "str"},
3482+
"custom_context": {"key": "customContext", "type": "CustomCallingContext"},
3483+
"incoming_call_context": {"key": "incomingCallContext", "type": "str"},
3484+
"on_behalf_of_callee": {"key": "onBehalfOfCallee", "type": "CommunicationIdentifierModel"},
3485+
"correlation_id": {"key": "correlationId", "type": "str"},
3486+
}
3487+
3488+
def __init__(self, **kwargs: Any) -> None:
3489+
""" """
3490+
super().__init__(**kwargs)
3491+
self.to = None
3492+
self.from_property = None
3493+
self.caller_display_name = None
3494+
self.server_call_id = None
3495+
self.custom_context = None
3496+
self.incoming_call_context = None
3497+
self.on_behalf_of_callee = None
3498+
self.correlation_id = None
3499+
3500+
34383501
class InterruptAudioAndAnnounceRequest(_serialization.Model):
34393502
"""InterruptAudioAndAnnounceRequest.
34403503

sdk/communication/azure-communication-callautomation/azure/communication/callautomation/aio/_call_automation_client_async.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def __init__(
9595
*,
9696
api_version: Optional[str] = None,
9797
source: Optional["CommunicationUserIdentifier"] = None,
98-
ops_source: Optional["MicrosoftTeamsAppIdentifier"] = None,
9998
**kwargs,
10099
) -> None:
101100
if not credential:
@@ -137,7 +136,6 @@ def __init__(
137136
self._call_recording_client = self._client.call_recording
138137
self._downloader = ContentDownloader(self._call_recording_client)
139138
self.source = source
140-
self.ops_source = ops_source
141139

142140
@classmethod
143141
def from_connection_string(cls, conn_str: str, **kwargs) -> "CallAutomationClient":
@@ -323,6 +321,7 @@ async def create_call(
323321
voip_headers: Optional[Dict[str, str]] = None,
324322
media_streaming: Optional['MediaStreamingOptions'] = None,
325323
transcription: Optional['TranscriptionOptions'] = None,
324+
teams_app_source: Optional['MicrosoftTeamsAppIdentifier'] = None,
326325
**kwargs
327326
) -> CallConnectionProperties:
328327
"""Create a call connection request to a target identity.
@@ -353,6 +352,10 @@ async def create_call(
353352
:keyword transcription: Configuration of live transcription.
354353
:paramtype transcription: ~azure.communication.callautomation.TranscriptionOptions
355354
or None
355+
:keyword teams_app_source: Overrides default client source by a MicrosoftTeamsAppIdentifier type source.
356+
Required for creating call with Teams resource account ID.
357+
This is per-operation setting and does not change the client's default source.
358+
:paramtype teams_app_source: ~azure.communication.callautomation.MicrosoftTeamsAppIdentifier or None
356359
:return: CallConnectionProperties
357360
:rtype: ~azure.communication.callautomation.CallConnectionProperties
358361
:raises ~azure.core.exceptions.HttpResponseError:
@@ -384,7 +387,7 @@ async def create_call(
384387
source_caller_id_number=serialize_phone_identifier(source_caller_id_number),
385388
source_display_name=source_display_name,
386389
source=serialize_communication_user_identifier(self.source),
387-
ops_source=serialize_msft_teams_app_identifier(self.ops_source),
390+
teams_app_source=serialize_msft_teams_app_identifier(teams_app_source),
388391
operation_context=operation_context,
389392
media_streaming_options=media_config,
390393
transcription_options=transcription_config,

sdk/communication/azure-communication-callautomation/swagger/SWAGGER.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ autorest SWAGGER.md
1717

1818
```yaml
1919
tag: package-2024-09-01-preview
20-
require: https://github.com/Azure/azure-rest-api-specs/blob/7347874bc2794b2770c3e7618bd1a5ccab53cb54/specification/communication/data-plane/CallAutomation/readme.md
20+
require: https://github.com/Azure/azure-rest-api-specs/blob/691fea3efb9ff22b20904e92d5116223f452a3b1/specification/communication/data-plane/CallAutomation/readme.md
2121
output-folder: ../azure/communication/callautomation/_generated
2222
models-mode: msrest
2323
namespace: azure.communication.callautomation

sdk/communication/azure-communication-callautomation/tests/test_callautomation_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,16 @@ def mock_send(request, **kwargs):
123123
call_automation_client = CallAutomationClient(
124124
"https://endpoint",
125125
AzureKeyCredential("fakeCredential=="),
126-
transport=Mock(send=mock_send),
127-
ops_source=caller,
126+
transport=Mock(send=mock_send)
128127
)
129-
call_connection_properties = call_automation_client.create_call(call_invite, self.callback_url)
128+
call_connection_properties = call_automation_client.create_call(call_invite,
129+
self.callback_url,
130+
teams_app_source=caller)
130131
self.assertEqual(self.call_connection_id, call_connection_properties.call_connection_id)
131132
self.assertEqual(self.server_callI_id, call_connection_properties.server_call_id)
132133
self.assertEqual(self.callback_url, call_connection_properties.callback_url)
133134
self.assertEqual(self.microsoft_teams_app_id, call_connection_properties.source.raw_id)
134135
self.assertEqual(self.another_microsoft_teams_app_id, call_connection_properties.targets[0].raw_id)
135-
print(call_connection_properties.targets[0])
136136

137137
def test_create_group_call(self):
138138
def mock_send(_, **kwargs):

0 commit comments

Comments
 (0)