Python용 Azure Communication Call Automation 클라이언트 라이브러리 - 버전 1.1.0

이 패키지에는 Azure Communication Call Automation용 Python SDK가 포함되어 있습니다. 호출 자동화는 개발자에게 서버 기반 지능형 통화 워크플로를 빌드하고 음성 및 PSTN 채널에 대한 통화 녹음/녹화 기능을 제공합니다.

통화 자동화 | 개요제품 설명서

고지 사항

Python 2.7에 대한 Azure SDK Python 패키지 지원은 2022년 1월 1일에 종료되었습니다. 자세한 내용과 질문은 을 참조하세요. https://github.com/Azure/azure-sdk-for-python/issues/20691

시작

필수 구성 요소

  • 이 패키지를 사용하려면 Python 3.7 이상이 필요합니다.
  • 이 패키지를 사용하려면 Azure 구독 이 필요합니다.
  • 배포된 Communication Services 리소스. Azure Portal 또는 Azure PowerShell 사용하여 설정할 수 있습니다.

설치

Azure Communication Service 호출 자동화 SDK를 설치합니다.

pip install azure-communication-callautomation

주요 개념

Name Description
CallAutomationClient CallAutomationClient 는 이 클라이언트 라이브러리를 사용하는 개발자를 위한 기본 인터페이스입니다. 또는 answerCall에서 호출 createCall 을 시작하는 데 사용할 수 있습니다. 같은 기록 작업을 수행하는 데도 사용할 수 있습니다. startRecording
CallConnectionClient CallConnectionClient 는 진행 중인 호출을 나타냅니다. 또는 를 사용하여 호출을 createCall 설정하면 또는 answerCallplay_media와 같은 transfer 호출에 대해 추가 작업을 수행할 수 있습니다.
콜백 이벤트 콜백 이벤트는 호출 기간 동안 다시 전송되는 이벤트입니다. 와 같은 CallConnected호출의 정보 및 상태를 제공합니다. CallbackUrl는 및 answerCall중에 createCall 제공되어야 하며 콜백 이벤트는 이 URL로 전송됩니다.
수신 호출 이벤트 들어오는 호출이 발생하면(으로 answerCall응답할 수 있음) 들어오는 호출 eventgrid 이벤트가 전송됩니다. 이는 위의 콜백 이벤트와 다르며 Azure Portal 설정해야 합니다. 자세한 내용은 수신 호출 을 참조하세요.

예제

CallAutomationClient 초기화

from azure.communication.callautomation import (CallAutomationClient)

# Your unique Azure Communication service endpoint
endpoint_url = '<ENDPOINT>'
client = CallAutomationClient.from_connection_string(endpoint_url)

호출 만들기

from azure.communication.callautomation import (
    CallAutomationClient,
    CommunicationUserIdentifier
)

# target endpoint for ACS User
user = CommunicationUserIdentifier("8:acs:...")

# callback url to receive callback events
callback_url = "https://<MY-EVENT-HANDLER-URL>/events"

# send out the invitation, creating call
result = client.create_call(user, callback_url)

# this id can be used to do further actions in the call
call_connection_id = result.call_connection_id

미디어 재생

# using call connection id, get call connection
call_connection = client.get_call_connection(call_connection_id)

# from callconnection of result above, play media to all participants
my_file = FileSource(url="https://<FILE-SOURCE>/<SOME-FILE>.wav")
call_connection.play_media(my_file)

문제 해결

다음 단계

피드백 제공

버그가 발생하거나 제안이 있는 경우 프로젝트의 문제 섹션에 문제를 제출하세요.

참여

이 프로젝트에 대한 기여와 제안을 환영합니다. 대부분의 경우 기여하려면 권한을 부여하며 실제로 기여를 사용할 권한을 당사에 부여한다고 선언하는 CLA(기여자 라이선스 계약)에 동의해야 합니다. 자세한 내용은 https://cla.microsoft.com 을 참조하세요.

끌어오기 요청을 제출하면 CLA-bot은 CLA를 제공하고 PR을 적절하게 데코레이팅해야 하는지 여부를 자동으로 결정합니다(예: 레이블, 설명). 봇에서 제공하는 지침을 따르기만 하면 됩니다. 이 작업은 CLA를 사용하여 모든 리포지토리에서 한 번만 수행하면 됩니다.

이 프로젝트는 [Microsoft 오픈 소스 행동 강령][code_of_conduct]을 채택했습니다. 자세한 내용은 행동 강령 FAQ를 참조하거나 추가 질문 또는 의견을 문의 opencode@microsoft.com 하세요.