ACS(Azure Communication Services) 룸 호출 중에 통화 SDK 또는 통화 자동화 SDK 또는 둘 다를 사용하여 통화를 관리할 수 있습니다. 회의실 통화에서 참가자에게 할당된 역할과 회의실에 구성된 속성을 모두 사용하여 호출 내 작업을 제어할 수 있습니다. 참가자의 역할 제어 기능은 참가자별로 허용되는 반면, 회의실 속성은 전체 회의실 호출에 적용됩니다.
통화 SDK
SDK 호출은 회의실 호출의 참가자가 화면 공유, 비디오 켜기/끄기, 음소거/음소거 해제 등과 같은 여러 통화 내 작업을 수행할 수 있도록 하는 클라이언트 쪽 호출 라이브러리입니다. 기능의 전체 목록은 통화 SDK 개요를 참조하세요.
통화 참가자에게 할당된 역할에 따라 기능을 제어합니다. 예를 들어 발표자만 화면 공유를 할 수 있습니다. 참가자 역할 및 권한은 룸 개념을 참조 하세요.
Automation SDK 호출
통화 자동화 SDK는 관리자가 중앙 및 제어 환경에서 진행 중인 회의실 호출을 관리할 수 있도록 하는 서버 쪽 라이브러리입니다. 호출 SDK와 달리 호출 자동화 SDK 작업은 역할에 구애받지 않습니다. 따라서 통화 관리자는 회의실 통화 참가자를 대신하여 여러 통화 내 작업을 수행할 수 있습니다.
다음 목록에서는 회의실 통화에서 사용할 수 있는 일반적인 호출 내 작업에 대해 설명합니다.
회의실 통화에 연결
호출 자동화는 호출 내 작업을 수행하기 전에 기존 회의실 호출에 연결해야 합니다. CallConnected 또는 ConnectFailed 이벤트는 콜백 메커니즘을 사용하여 연결 작업이 각각 성공했는지 또는 실패했는지를 나타내기 위해 발생합니다.
Uri callbackUri = new Uri("https://<myendpoint>/Events"); //the callback endpoint where you want to receive subsequent events
CallLocator roomCallLocator = new RoomCallLocator("<RoomId>");
ConnectCallResult response = await client.ConnectAsync(roomCallLocator, callbackUri);
String callbackUri = "https://<myendpoint>/Events"; //the callback endpoint where you want to receive subsequent events
CallLocator roomCallLocator = new RoomCallLocator("<RoomId>");
ConnectCallResult response = client.connectCall(roomCallLocator, callbackUri).block();
const roomCallLocator = { kind: "roomCallLocator", id: "<RoomId>" };
const callbackUri = "https://<myendpoint>/Events"; // the callback endpoint where you want to receive subsequent events
const response = await client.connectCall(roomCallLocator, callbackUri);
callback_uri = "https://<myendpoint>/Events" # the callback endpoint where you want to receive subsequent events
room_call_locator = RoomCallLocator("<room_id>")
call_connection_properties = client.connect_call(call_locator=room_call_locator, callback_url=callback_uri)
회의실 호출에 성공적으로 연결되면 콜백 URI를 CallConnect 통해 이벤트 알림을 받습니다. 필요에 따라 회의실 통화에서 통화 연결을 검색하는 데 사용할 callConnectionId 수 있습니다. 다음 샘플 코드 조각은 이 함수를 callConnectionId 보여 주는 데 사용합니다.
PSTN 참가자 추가
통화 자동화를 사용하여 PSTN 번호로 전화를 걸고 참가자를 회의실 통화에 추가할 수 있습니다. 그러나 PSTN 전화 접속 옵션(EnabledPSTNDialouttrue설정)을 사용하도록 회의실을 설정해야 하며 Azure Communication Services 리소스에는 유효한 전화 번호가 프로비전되어 있어야 합니다.
var callerIdNumber = new PhoneNumberIdentifier("+16044561234"); // This is the ACS-provisioned phone number for the caller
var callThisPerson = new CallInvite(new PhoneNumberIdentifier("+16041234567"), callerIdNumber); // The target phone number to dial out to
CreateCallResult response = await client.GetCallConnection(callConnectionId).AddParticipantAsync(callThisPerson);
PhoneNumberIdentifier callerIdNumber = new PhoneNumberIdentifier("+16044561234"); // This is the ACS-provisioned phone number for the caller
CallInvite callInvite = new CallInvite(new PhoneNumberIdentifier("+16041234567"), callerIdNumber); // The phone number participant to dial out to
AddParticipantOptions addParticipantOptions = new AddParticipantOptions(callInvite);
Response<AddParticipantResult> addParticipantResultResponse = client.getCallConnectionAsync(callConnectionId)
.addParticipantWithResponse(addParticipantOptions).block();
const callInvite = {
targetParticipant: { phoneNumber: "+18008008800" }, // The phone number participant to dial out to
sourceCallIdNumber: { phoneNumber: "+18888888888" } // This is the ACS-provisioned phone number for the caller
};
const response = await client.getCallConnection(callConnectionId).addParticipant(callInvite);
caller_id_number = PhoneNumberIdentifier(
"+18888888888"
) # TThis is the ACS-provisioned phone number for the caller
target = PhoneNumberIdentifier("+18008008800"), # The phone number participant to dial out to
call_connection_client = call_automation_client.get_call_connection(
"call_connection_id"
)
result = call_connection_client.add_participant(
target,
operation_context="Your context",
operationCallbackUrl="<url_endpoint>"
)
var removeThisUser = new PhoneNumberIdentifier("+16044561234");
// Remove a participant from the call with optional parameters
var removeParticipantOptions = new RemoveParticipantOptions(removeThisUser)
{
OperationContext = "operationContext",
OperationCallbackUri = new Uri("uri_endpoint"); // Sending event to a non-default endpoint
}
RemoveParticipantsResult result = await client.GetCallConnection(callConnectionId).RemoveParticipantAsync(removeParticipantOptions);
CommunicationIdentifier removeThisUser = new PhoneNumberIdentifier("+16044561234");
RemoveParticipantOptions removeParticipantOptions = new RemoveParticipantOptions(removeThisUser)
.setOperationContext("<operation_context>")
.setOperationCallbackUrl("<url_endpoint>");
Response<RemoveParticipantResult> removeParticipantResultResponse = client.getCallConnectionAsync(callConnectionId)
.removeParticipantWithResponse(removeParticipantOptions);
var tones = new DtmfTone[] { DtmfTone.One, DtmfTone.Two, DtmfTone.Three, DtmfTone.Pound };
var sendDtmfTonesOptions = new SendDtmfTonesOptions(tones, new PhoneNumberIdentifier(calleePhonenumber))
{
OperationContext = "dtmfs-to-ivr"
};
var sendDtmfAsyncResult = await callAutomationClient.GetCallConnection(callConnectionId).GetCallMedia().SendDtmfTonesAsync(sendDtmfTonesOptions);
List<DtmfTone> tones = Arrays.asList(DtmfTone.ONE, DtmfTone.TWO, DtmfTone.THREE, DtmfTone.POUND);
SendDtmfTonesOptions options = new SendDtmfTonesOptions(tones, new PhoneNumberIdentifier(c2Target));
options.setOperationContext("dtmfs-to-ivr");
client.getCallConnectionAsync(callConnectionId)
.getCallMediaAsync()
.sendDtmfTonesWithResponse(options)
.block();
Azure Communication Services 룸은 통화 자동화에서 제공하는 , stoppause, resume등과 같은 start기록 기능을 지원합니다. 회의실 통화에서 녹음/중지/일시 중지/다시 시작하려면 다음 코드 조각을 참조하세요. 작업의 전체 목록은 통화 자동화 기록을 참조하세요.
// Start recording
StartRecordingOptions recordingOptions = new StartRecordingOptions(new ServerCallLocator("<ServerCallId>"))
{
RecordingContent = RecordingContent.Audio,
RecordingChannel = RecordingChannel.Unmixed,
RecordingFormat = RecordingFormat.Wav,
RecordingStateCallbackUri = new Uri("<CallbackUri>"),
RecordingStorage = RecordingStorage.CreateAzureBlobContainerRecordingStorage(new Uri("<YOUR_STORAGE_CONTAINER_URL>"))
};
Response<RecordingStateResult> response = await callAutomationClient.GetCallRecording()
.StartAsync(recordingOptions);
// Pause recording using recordingId received in response of start recording.
var pauseRecording = await callAutomationClient.GetCallRecording ().PauseAsync(recordingId);
// Resume recording using recordingId received in response of start recording.
var resumeRecording = await callAutomationClient.GetCallRecording().ResumeAsync(recordingId);
// Stop recording using recordingId received in response of start recording.
var stopRecording = await callAutomationClient.GetCallRecording().StopAsync(recordingId);
// Start recording
StartRecordingOptions recordingOptions = new StartRecordingOptions(new ServerCallLocator("<serverCallId>"))
.setRecordingChannel(RecordingChannel.UNMIXED)
.setRecordingFormat(RecordingFormat.WAV)
.setRecordingContent(RecordingContent.AUDIO)
.setRecordingStateCallbackUrl("<recordingStateCallbackUrl>");
Response<RecordingStateResult> response = callAutomationClient.getCallRecording()
.startWithResponse(recordingOptions, null);
// Pause recording using recordingId received in response of start recording
Response<Void> response = callAutomationClient.getCallRecording()
.pauseWithResponse(recordingId, null);
// Resume recording using recordingId received in response of start recording
Response<Void> response = callAutomationClient.getCallRecording()
.resumeWithResponse(recordingId, null);
// Stop recording using recordingId received in response of start recording
Response<Void> response = callAutomationClient.getCallRecording()
.stopWithResponse(recordingId, null);
// Start recording
var locator: CallLocator = { id: "<ServerCallId>", kind: "serverCallLocator" };
var options: StartRecordingOptions =
{
callLocator: locator,
recordingContent: "audio",
recordingChannel:"unmixed",
recordingFormat: "wav",
recordingStateCallbackEndpointUrl: "<CallbackUri>"
};
var response = await callAutomationClient.getCallRecording().start(options);
// Pause recording using recordingId received in response of start recording
var pauseRecording = await callAutomationClient.getCallRecording().pause(recordingId);
// Resume recording using recordingId received in response of start recording.
var resumeRecording = await callAutomationClient.getCallRecording().resume(recordingId);
// Stop recording using recordingId received in response of start recording
var stopRecording = await callAutomationClient.getCallRecording().stop(recordingId);
# Start recording
response = call_automation_client.start_recording(call_locator=ServerCallLocator(server_call_id),
recording_content_type = RecordingContent.Audio,
recording_channel_type = RecordingChannel.Unmixed,
recording_format_type = RecordingFormat.Wav,
recording_state_callback_url = "<CallbackUri>")
# Pause recording using recording_id received in response of start recording
pause_recording = call_automation_client.pause_recording(recording_id = recording_id)
# Resume recording using recording_id received in response of start recording
resume_recording = call_automation_client.resume_recording(recording_id = recording_id)
# Stop recording using recording_id received in response of start recording
stop_recording = call_automation_client.stop_recording(recording_id = recording_id)
통화 종료
통화 자동화 SDK 중단 작업을 사용하여 호출을 종료할 수 있습니다. 끊기 작업이 완료되면 SDK에서 CallDisconnected 이벤트를 게시합니다.