Skip to content

Commit 95ed0a7

Browse files
authored
Added backup cognitive service (Azure#39406)
* Added backup cognitive service * updated async connect request * Fixed Lint errors.
1 parent a1d4292 commit 95ed0a7

File tree

32 files changed

+659
-237
lines changed

32 files changed

+659
-237
lines changed

sdk/communication/azure-communication-callautomation/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/communication/azure-communication-callautomation",
5-
"Tag": "python/communication/azure-communication-callautomation_40e440aaba"
5+
"Tag": "python/communication/azure-communication-callautomation_9df9dd8efa"
66
}

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

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def connect_call(
174174
*,
175175
server_call_id: str,
176176
cognitive_services_endpoint: Optional[str] = None,
177+
backup_cognitive_services_endpoint:Optional[str] = None,
177178
operation_context: Optional[str] = None,
178179
media_streaming: Optional['MediaStreamingOptions'] = None,
179180
transcription: Optional['TranscriptionOptions'] = None,
@@ -188,6 +189,9 @@ def connect_call(
188189
:keyword cognitive_services_endpoint:
189190
The identifier of the Cognitive Service resource assigned to this call.
190191
:paramtype cognitive_services_endpoint: str or None
192+
:keyword backup_cognitive_services_endpoint:
193+
The identifier of the Backup Cognitive Service resource assigned to this call.
194+
:paramtype backup_cognitive_services_endpoint: str or None
191195
:keyword operation_context: Value that can be used to track the call and its associated events.
192196
:paramtype operation_context: str or None
193197
:keyword media_streaming: Media Streaming Options.
@@ -208,6 +212,7 @@ def connect_call(
208212
*,
209213
group_call_id: str,
210214
cognitive_services_endpoint: Optional[str] = None,
215+
backup_cognitive_services_endpoint:Optional[str] = None,
211216
operation_context: Optional[str] = None,
212217
media_streaming: Optional['MediaStreamingOptions'] = None,
213218
transcription: Optional['TranscriptionOptions'] = None,
@@ -222,6 +227,9 @@ def connect_call(
222227
:keyword cognitive_services_endpoint:
223228
The identifier of the Cognitive Service resource assigned to this call.
224229
:paramtype cognitive_services_endpoint: str or None
230+
:keyword backup_cognitive_services_endpoint:
231+
The identifier of the Backup Cognitive Service resource assigned to this call.
232+
:paramtype backup_cognitive_services_endpoint: str or None
225233
:keyword operation_context: Value that can be used to track the call and its associated events.
226234
:paramtype operation_context: str or None
227235
:keyword media_streaming: Media Streaming Options.
@@ -242,6 +250,7 @@ def connect_call(
242250
*,
243251
room_id: str,
244252
cognitive_services_endpoint: Optional[str] = None,
253+
backup_cognitive_services_endpoint:Optional[str] = None,
245254
operation_context: Optional[str] = None,
246255
media_streaming: Optional['MediaStreamingOptions'] = None,
247256
transcription: Optional['TranscriptionOptions'] = None,
@@ -256,6 +265,9 @@ def connect_call(
256265
:keyword cognitive_services_endpoint:
257266
The identifier of the Cognitive Service resource assigned to this call.
258267
:paramtype cognitive_services_endpoint: str or None
268+
:keyword backup_cognitive_services_endpoint:
269+
The identifier of the Backup Cognitive Service resource assigned to this call.
270+
:paramtype backup_cognitive_services_endpoint: str or None
259271
:keyword operation_context: Value that can be used to track the call and its associated events.
260272
:paramtype operation_context: str or None
261273
:keyword media_streaming: Media Streaming Options.
@@ -277,8 +289,10 @@ def connect_call(
277289
) -> CallConnectionProperties:
278290

279291
cognitive_services_endpoint=kwargs.pop("cognitive_services_endpoint", None)
292+
backup_cognitive_services_endpoint=kwargs.pop("backup_cognitive_services_endpoint", None)
280293
call_intelligence_options = CallIntelligenceOptions(
281-
cognitive_services_endpoint=cognitive_services_endpoint
294+
cognitive_services_endpoint=cognitive_services_endpoint,
295+
backup_cognitive_services_endpoint=backup_cognitive_services_endpoint
282296
) if cognitive_services_endpoint else None
283297

284298
media_streaming_options : Optional[MediaStreamingOptions] = None
@@ -318,6 +332,7 @@ def create_call(
318332
source_display_name: Optional[str] = None,
319333
operation_context: Optional[str] = None,
320334
cognitive_services_endpoint: Optional[str] = None,
335+
backup_cognitive_services_endpoint:Optional[str] = None,
321336
sip_headers: Optional[Dict[str, str]] = None,
322337
voip_headers: Optional[Dict[str, str]] = None,
323338
media_streaming: Optional['MediaStreamingOptions'] = None,
@@ -343,6 +358,9 @@ def create_call(
343358
:keyword cognitive_services_endpoint:
344359
The identifier of the Cognitive Service resource assigned to this call.
345360
:paramtype cognitive_services_endpoint: str or None
361+
:keyword backup_cognitive_services_endpoint:
362+
The identifier of the Backup Cognitive Service resource assigned to this call.
363+
:paramtype backup_cognitive_services_endpoint: str or None
346364
:keyword sip_headers: Sip Headers for PSTN Call
347365
:paramtype sip_headers: Dict[str, str] or None
348366
:keyword voip_headers: Voip Headers for Voip Call
@@ -372,7 +390,11 @@ def create_call(
372390
user_custom_context = CustomCallingContext(voip_headers=voip_headers, sip_headers=sip_headers)
373391

374392
call_intelligence_options = (
375-
CallIntelligenceOptions(cognitive_services_endpoint=cognitive_services_endpoint)
393+
CallIntelligenceOptions(
394+
cognitive_services_endpoint=cognitive_services_endpoint,
395+
backup_cognitive_services_endpoint=backup_cognitive_services_endpoint
396+
if backup_cognitive_services_endpoint else None
397+
)
376398
if cognitive_services_endpoint
377399
else None
378400
)
@@ -456,6 +478,7 @@ def answer_call(
456478
callback_url: str,
457479
*,
458480
cognitive_services_endpoint: Optional[str] = None,
481+
backup_cognitive_services_endpoint:Optional[str] = None,
459482
operation_context: Optional[str] = None,
460483
media_streaming: Optional['MediaStreamingOptions'] = None,
461484
transcription: Optional['TranscriptionOptions'] = None,
@@ -474,6 +497,9 @@ def answer_call(
474497
:keyword cognitive_services_endpoint:
475498
The endpoint url of the Azure Cognitive Services resource attached.
476499
:paramtype cognitive_services_endpoint: str
500+
:keyword backup_cognitive_services_endpoint:
501+
The endpoint url of the Azure Backup Cognitive Services resource attached.
502+
:paramtype backup_cognitive_services_endpoint: str
477503
:keyword operation_context: The operation context.
478504
:paramtype operation_context: str
479505
:keyword media_streaming: Media Streaming Options.
@@ -498,7 +524,9 @@ def answer_call(
498524
)
499525

500526
call_intelligence_options = CallIntelligenceOptions(
501-
cognitive_services_endpoint=cognitive_services_endpoint
527+
cognitive_services_endpoint=cognitive_services_endpoint,
528+
backup_cognitive_services_endpoint=backup_cognitive_services_endpoint
529+
if backup_cognitive_services_endpoint else None
502530
) if cognitive_services_endpoint else None
503531

504532
answer_call_request = AnswerCallRequest(

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ def start_recognizing_media(
640640
:type target_participant: ~azure.communication.callautomation.CommunicationIdentifier
641641
:keyword initial_silence_timeout: Time to wait for first input after prompt in seconds (if any).
642642
:paramtype initial_silence_timeout: int
643-
:type play_prompt: ~azure.communication.callautomation.FileSource or
643+
:keyword play_prompt: The source of the audio to be played for recognition.
644+
:paramtype play_prompt: ~azure.communication.callautomation.FileSource or
644645
~azure.communication.callautomation.TextSource or
645646
~azure.communication.callautomation.SsmlSource or
646647
list[~azure.communication.callautomation.FileSource] or

0 commit comments

Comments
 (0)