Skip to content

Commit 17b0d06

Browse files
Richardcho/correlationid answeredby (Azure#30314)
* update swagger * update swagger * update client * updated * fix linting * add pylint ignore * fix linting --------- Co-authored-by: juntuchen <[email protected]>
1 parent 97bddf8 commit 17b0d06

File tree

8 files changed

+169
-24
lines changed

8 files changed

+169
-24
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
get_repeatability_guid,
3232
get_repeatability_timestamp,
3333
serialize_phone_identifier,
34-
serialize_identifier
34+
serialize_identifier,
35+
serialize_communication_user_identifier
3536
)
3637
if TYPE_CHECKING:
3738
from ._models import (
@@ -125,6 +126,7 @@ def from_connection_string(
125126

126127
return cls(endpoint, access_key, **kwargs)
127128

129+
@distributed_trace
128130
def get_call_connection(
129131
self,
130132
call_connection_id: str,
@@ -184,7 +186,7 @@ def create_call(
184186
source_caller_id_number=serialize_phone_identifier(
185187
target_participant.source_caller_id_number) if target_participant.source_caller_id_number else None,
186188
source_display_name=target_participant.source_display_name,
187-
source_identity=serialize_identifier(
189+
source_identity=serialize_communication_user_identifier(
188190
self.source_identity) if self.source_identity else None,
189191
operation_context=operation_context,
190192
media_streaming_configuration=media_streaming_configuration.to_generated(
@@ -281,6 +283,7 @@ def answer_call(
281283
*,
282284
media_streaming_configuration: Optional['MediaStreamingConfiguration'] = None,
283285
azure_cognitive_services_endpoint_url: Optional[str] = None,
286+
operation_context: Optional[str] = None,
284287
**kwargs
285288
) -> CallConnectionProperties:
286289
"""Answer incoming call with Azure Communication Service's IncomingCall event
@@ -295,7 +298,9 @@ def answer_call(
295298
:paramtype media_streaming_configuration: ~azure.communication.callautomation.MediaStreamingConfiguration
296299
:keyword azure_cognitive_services_endpoint_url:
297300
The endpoint url of the Azure Cognitive Services resource attached.
298-
:paramtype azure_cognitive_services_endpoint_url: str
301+
:paramtype azure_cognitive_services_endpoint_url: str
302+
:keyword operation_context: The operation context.
303+
:paramtype operation_context: str
299304
:return: CallConnectionProperties
300305
:rtype: ~azure.communication.callautomation.CallConnectionProperties
301306
:raises ~azure.core.exceptions.HttpResponseError:
@@ -306,8 +311,9 @@ def answer_call(
306311
media_streaming_configuration=media_streaming_configuration.to_generated(
307312
) if media_streaming_configuration else None,
308313
azure_cognitive_services_endpoint_url=azure_cognitive_services_endpoint_url,
309-
answered_by_identifier=serialize_identifier(
310-
self.source_identity) if self.source_identity else None
314+
answered_by_identifier=serialize_communication_user_identifier(
315+
self.source_identity) if self.source_identity else None,
316+
operation_context=operation_context
311317
)
312318

313319
result = self._client.answer_call(

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ def _from_callautomation_client(
132132
"""Internal constructor for sharing the pipeline with CallAutomationClient."""
133133
return cls(None, None, call_connection_id, _callautomation_client=callautomation_client)
134134

135+
@distributed_trace
135136
def get_call_properties(self, **kwargs) -> CallConnectionProperties:
136137
"""Get the latest properties of this call.
137138

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
@@ -19,6 +19,7 @@
1919
from ._models import CallParticipant
2020
from ._models import CallTransferAccepted
2121
from ._models import CallTransferFailed
22+
from ._models import ChannelAffinity
2223
from ._models import Choice
2324
from ._models import ChoiceResult
2425
from ._models import CollectTonesResult
@@ -113,6 +114,7 @@
113114
"CallParticipant",
114115
"CallTransferAccepted",
115116
"CallTransferFailed",
117+
"ChannelAffinity",
116118
"Choice",
117119
"ChoiceResult",
118120
"CollectTonesResult",

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

Lines changed: 93 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,18 @@ class AnswerCallRequest(_serialization.Model):
276276
:vartype incoming_call_context: str
277277
:ivar callback_uri: The callback uri. Required.
278278
:vartype callback_uri: str
279+
:ivar operation_context: A customer set value used to track the answering of a call.
280+
:vartype operation_context: str
279281
:ivar media_streaming_configuration: Media Streaming Configuration.
280282
:vartype media_streaming_configuration:
281283
~azure.communication.callautomation.models.MediaStreamingConfiguration
282284
:ivar azure_cognitive_services_endpoint_url: The endpoint URL of the Azure Cognitive Services
283285
resource attached.
284286
:vartype azure_cognitive_services_endpoint_url: str
285-
:ivar answered_by_identifier: The identifier of the contoso app which answers the call.
287+
:ivar answered_by_identifier: The identifier of the call automation entity which answers the
288+
call.
286289
:vartype answered_by_identifier:
287-
~azure.communication.callautomation.models.CommunicationIdentifierModel
290+
~azure.communication.callautomation.models.CommunicationUserIdentifierModel
288291
"""
289292

290293
_validation = {
@@ -295,39 +298,45 @@ class AnswerCallRequest(_serialization.Model):
295298
_attribute_map = {
296299
"incoming_call_context": {"key": "incomingCallContext", "type": "str"},
297300
"callback_uri": {"key": "callbackUri", "type": "str"},
301+
"operation_context": {"key": "operationContext", "type": "str"},
298302
"media_streaming_configuration": {"key": "mediaStreamingConfiguration", "type": "MediaStreamingConfiguration"},
299303
"azure_cognitive_services_endpoint_url": {"key": "azureCognitiveServicesEndpointUrl", "type": "str"},
300-
"answered_by_identifier": {"key": "answeredByIdentifier", "type": "CommunicationIdentifierModel"},
304+
"answered_by_identifier": {"key": "answeredByIdentifier", "type": "CommunicationUserIdentifierModel"},
301305
}
302306

303307
def __init__(
304308
self,
305309
*,
306310
incoming_call_context: str,
307311
callback_uri: str,
312+
operation_context: Optional[str] = None,
308313
media_streaming_configuration: Optional["_models.MediaStreamingConfiguration"] = None,
309314
azure_cognitive_services_endpoint_url: Optional[str] = None,
310-
answered_by_identifier: Optional["_models.CommunicationIdentifierModel"] = None,
315+
answered_by_identifier: Optional["_models.CommunicationUserIdentifierModel"] = None,
311316
**kwargs: Any
312317
) -> None:
313318
"""
314319
:keyword incoming_call_context: The context associated with the call. Required.
315320
:paramtype incoming_call_context: str
316321
:keyword callback_uri: The callback uri. Required.
317322
:paramtype callback_uri: str
323+
:keyword operation_context: A customer set value used to track the answering of a call.
324+
:paramtype operation_context: str
318325
:keyword media_streaming_configuration: Media Streaming Configuration.
319326
:paramtype media_streaming_configuration:
320327
~azure.communication.callautomation.models.MediaStreamingConfiguration
321328
:keyword azure_cognitive_services_endpoint_url: The endpoint URL of the Azure Cognitive
322329
Services resource attached.
323330
:paramtype azure_cognitive_services_endpoint_url: str
324-
:keyword answered_by_identifier: The identifier of the contoso app which answers the call.
331+
:keyword answered_by_identifier: The identifier of the call automation entity which answers the
332+
call.
325333
:paramtype answered_by_identifier:
326-
~azure.communication.callautomation.models.CommunicationIdentifierModel
334+
~azure.communication.callautomation.models.CommunicationUserIdentifierModel
327335
"""
328336
super().__init__(**kwargs)
329337
self.incoming_call_context = incoming_call_context
330338
self.callback_uri = callback_uri
339+
self.operation_context = operation_context
331340
self.media_streaming_configuration = media_streaming_configuration
332341
self.azure_cognitive_services_endpoint_url = azure_cognitive_services_endpoint_url
333342
self.answered_by_identifier = answered_by_identifier
@@ -409,7 +418,7 @@ def __init__(
409418
self.operation_context = operation_context
410419

411420

412-
class CallConnectionProperties(_serialization.Model):
421+
class CallConnectionProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes
413422
"""Properties of a call connection.
414423
415424
:ivar call_connection_id: The call connection id.
@@ -437,6 +446,12 @@ class CallConnectionProperties(_serialization.Model):
437446
:ivar source_identity: Source identity.
438447
:vartype source_identity:
439448
~azure.communication.callautomation.models.CommunicationIdentifierModel
449+
:ivar correlation_id: The correlation ID.
450+
:vartype correlation_id: str
451+
:ivar answered_by_identifier: Identity of the answering entity. Only populated when identity is
452+
provided in the request.
453+
:vartype answered_by_identifier:
454+
~azure.communication.callautomation.models.CommunicationUserIdentifierModel
440455
"""
441456

442457
_attribute_map = {
@@ -449,6 +464,8 @@ class CallConnectionProperties(_serialization.Model):
449464
"source_caller_id_number": {"key": "sourceCallerIdNumber", "type": "PhoneNumberIdentifierModel"},
450465
"source_display_name": {"key": "sourceDisplayName", "type": "str"},
451466
"source_identity": {"key": "sourceIdentity", "type": "CommunicationIdentifierModel"},
467+
"correlation_id": {"key": "correlationId", "type": "str"},
468+
"answered_by_identifier": {"key": "answeredByIdentifier", "type": "CommunicationUserIdentifierModel"},
452469
}
453470

454471
def __init__(
@@ -463,6 +480,8 @@ def __init__(
463480
source_caller_id_number: Optional["_models.PhoneNumberIdentifierModel"] = None,
464481
source_display_name: Optional[str] = None,
465482
source_identity: Optional["_models.CommunicationIdentifierModel"] = None,
483+
correlation_id: Optional[str] = None,
484+
answered_by_identifier: Optional["_models.CommunicationUserIdentifierModel"] = None,
466485
**kwargs: Any
467486
) -> None:
468487
"""
@@ -492,6 +511,12 @@ def __init__(
492511
:keyword source_identity: Source identity.
493512
:paramtype source_identity:
494513
~azure.communication.callautomation.models.CommunicationIdentifierModel
514+
:keyword correlation_id: The correlation ID.
515+
:paramtype correlation_id: str
516+
:keyword answered_by_identifier: Identity of the answering entity. Only populated when identity
517+
is provided in the request.
518+
:paramtype answered_by_identifier:
519+
~azure.communication.callautomation.models.CommunicationUserIdentifierModel
495520
"""
496521
super().__init__(**kwargs)
497522
self.call_connection_id = call_connection_id
@@ -503,6 +528,8 @@ def __init__(
503528
self.source_caller_id_number = source_caller_id_number
504529
self.source_display_name = source_display_name
505530
self.source_identity = source_identity
531+
self.correlation_id = correlation_id
532+
self.answered_by_identifier = answered_by_identifier
506533

507534

508535
class CallDisconnected(_serialization.Model):
@@ -746,6 +773,46 @@ def __init__(
746773
self.result_information = result_information
747774

748775

776+
class ChannelAffinity(_serialization.Model):
777+
"""Channel affinity for a participant.
778+
779+
All required parameters must be populated in order to send to Azure.
780+
781+
:ivar channel: Channel number to which bitstream from a particular participant will be written.
782+
:vartype channel: int
783+
:ivar participant: The identifier for the participant whose bitstream will be written to the
784+
channel
785+
represented by the channel number. Required.
786+
:vartype participant: ~azure.communication.callautomation.models.CommunicationIdentifierModel
787+
"""
788+
789+
_validation = {
790+
"channel": {"maximum": 4, "minimum": 0},
791+
"participant": {"required": True},
792+
}
793+
794+
_attribute_map = {
795+
"channel": {"key": "channel", "type": "int"},
796+
"participant": {"key": "participant", "type": "CommunicationIdentifierModel"},
797+
}
798+
799+
def __init__(
800+
self, *, participant: "_models.CommunicationIdentifierModel", channel: Optional[int] = None, **kwargs: Any
801+
) -> None:
802+
"""
803+
:keyword channel: Channel number to which bitstream from a particular participant will be
804+
written.
805+
:paramtype channel: int
806+
:keyword participant: The identifier for the participant whose bitstream will be written to the
807+
channel
808+
represented by the channel number. Required.
809+
:paramtype participant: ~azure.communication.callautomation.models.CommunicationIdentifierModel
810+
"""
811+
super().__init__(**kwargs)
812+
self.channel = channel
813+
self.participant = participant
814+
815+
749816
class Choice(_serialization.Model):
750817
"""Choice.
751818
@@ -1232,7 +1299,7 @@ class CreateCallRequest(_serialization.Model):
12321299
:vartype source_display_name: str
12331300
:ivar source_identity: The identifier of the source of the call.
12341301
:vartype source_identity:
1235-
~azure.communication.callautomation.models.CommunicationIdentifierModel
1302+
~azure.communication.callautomation.models.CommunicationUserIdentifierModel
12361303
:ivar operation_context: A customer set value used to track the answering of a call.
12371304
:vartype operation_context: str
12381305
:ivar callback_uri: The callback URI. Required.
@@ -1256,7 +1323,7 @@ class CreateCallRequest(_serialization.Model):
12561323
"targets": {"key": "targets", "type": "[CommunicationIdentifierModel]"},
12571324
"source_caller_id_number": {"key": "sourceCallerIdNumber", "type": "PhoneNumberIdentifierModel"},
12581325
"source_display_name": {"key": "sourceDisplayName", "type": "str"},
1259-
"source_identity": {"key": "sourceIdentity", "type": "CommunicationIdentifierModel"},
1326+
"source_identity": {"key": "sourceIdentity", "type": "CommunicationUserIdentifierModel"},
12601327
"operation_context": {"key": "operationContext", "type": "str"},
12611328
"callback_uri": {"key": "callbackUri", "type": "str"},
12621329
"media_streaming_configuration": {"key": "mediaStreamingConfiguration", "type": "MediaStreamingConfiguration"},
@@ -1271,7 +1338,7 @@ def __init__(
12711338
callback_uri: str,
12721339
source_caller_id_number: Optional["_models.PhoneNumberIdentifierModel"] = None,
12731340
source_display_name: Optional[str] = None,
1274-
source_identity: Optional["_models.CommunicationIdentifierModel"] = None,
1341+
source_identity: Optional["_models.CommunicationUserIdentifierModel"] = None,
12751342
operation_context: Optional[str] = None,
12761343
media_streaming_configuration: Optional["_models.MediaStreamingConfiguration"] = None,
12771344
azure_cognitive_services_endpoint_url: Optional[str] = None,
@@ -1291,7 +1358,7 @@ def __init__(
12911358
:paramtype source_display_name: str
12921359
:keyword source_identity: The identifier of the source of the call.
12931360
:paramtype source_identity:
1294-
~azure.communication.callautomation.models.CommunicationIdentifierModel
1361+
~azure.communication.callautomation.models.CommunicationUserIdentifierModel
12951362
:keyword operation_context: A customer set value used to track the answering of a call.
12961363
:paramtype operation_context: str
12971364
:keyword callback_uri: The callback URI. Required.
@@ -3117,6 +3184,12 @@ class StartCallRecordingRequest(_serialization.Model):
31173184
of the recording.
31183185
:vartype audio_channel_participant_ordering:
31193186
list[~azure.communication.callautomation.models.CommunicationIdentifierModel]
3187+
:ivar channel_affinity: The channel affinity of call recording
3188+
When 'recordingChannelType' is set to 'unmixed', if channelAffinity is not specified,
3189+
'channel' will be automatically assigned.
3190+
Channel-Participant mapping details can be found in the metadata of the recording.
3191+
///.
3192+
:vartype channel_affinity: list[~azure.communication.callautomation.models.ChannelAffinity]
31203193
:ivar external_storage: Optional property to specify location where recording will be stored.
31213194
:vartype external_storage: ~azure.communication.callautomation.models.ExternalStorage
31223195
"""
@@ -3135,6 +3208,7 @@ class StartCallRecordingRequest(_serialization.Model):
31353208
"key": "audioChannelParticipantOrdering",
31363209
"type": "[CommunicationIdentifierModel]",
31373210
},
3211+
"channel_affinity": {"key": "channelAffinity", "type": "[ChannelAffinity]"},
31383212
"external_storage": {"key": "externalStorage", "type": "ExternalStorage"},
31393213
}
31403214

@@ -3147,6 +3221,7 @@ def __init__(
31473221
recording_channel_type: Optional[Union[str, "_models.RecordingChannel"]] = None,
31483222
recording_format_type: Optional[Union[str, "_models.RecordingFormat"]] = None,
31493223
audio_channel_participant_ordering: Optional[List["_models.CommunicationIdentifierModel"]] = None,
3224+
channel_affinity: Optional[List["_models.ChannelAffinity"]] = None,
31503225
external_storage: Optional["_models.ExternalStorage"] = None,
31513226
**kwargs: Any
31523227
) -> None:
@@ -3177,6 +3252,12 @@ def __init__(
31773252
of the recording.
31783253
:paramtype audio_channel_participant_ordering:
31793254
list[~azure.communication.callautomation.models.CommunicationIdentifierModel]
3255+
:keyword channel_affinity: The channel affinity of call recording
3256+
When 'recordingChannelType' is set to 'unmixed', if channelAffinity is not specified,
3257+
'channel' will be automatically assigned.
3258+
Channel-Participant mapping details can be found in the metadata of the recording.
3259+
///.
3260+
:paramtype channel_affinity: list[~azure.communication.callautomation.models.ChannelAffinity]
31803261
:keyword external_storage: Optional property to specify location where recording will be
31813262
stored.
31823263
:paramtype external_storage: ~azure.communication.callautomation.models.ExternalStorage
@@ -3188,6 +3269,7 @@ def __init__(
31883269
self.recording_channel_type = recording_channel_type
31893270
self.recording_format_type = recording_format_type
31903271
self.audio_channel_participant_ordering = audio_channel_participant_ordering
3272+
self.channel_affinity = channel_affinity
31913273
self.external_storage = external_storage
31923274

31933275

0 commit comments

Comments
 (0)