Call Connections - Play Audio
Play audio in the call.
POST {endpoint}/calling/callConnections/{callConnectionId}/:playAudio?api-version=2021-08-30-preview
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
call
|
path | True |
|
The call connection id. |
|
endpoint
|
path | True |
|
The endpoint of the Azure Communication resource. |
|
api-version
|
query | True |
|
Version of API to invoke. |
Request Body
| Name | Type | Description |
|---|---|---|
| audioFileId |
|
An id for the media in the AudioFileUri, using which we cache the media resource. |
| audioFileUri |
|
The media resource uri of the play audio request. Currently only Wave file (.wav) format audio prompts are supported. More specifically, the audio content in the wave file must be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate. |
| callbackUri |
|
The callback Uri to receive PlayAudio status notifications. |
| loop |
|
The flag indicating whether audio file needs to be played in loop or not. |
| operationContext |
|
The value to identify context of the operation. |
Responses
| Name | Type | Description |
|---|---|---|
| 202 Accepted |
Returns the play audio response. |
|
| 400 Bad Request |
|
BadRequest |
| 401 Unauthorized |
|
Unauthorized |
| 403 Forbidden |
|
Forbidden |
| 404 Not Found |
|
NotFound |
| 500 Internal Server Error |
|
InternalServerError |
Examples
Play audio in the call.
Sample Request
POST https://contoso.communications.azure.com/calling/callConnections/18dea47f-b081-4107-9a5c-4300819d2c6c/:playAudio?api-version=2021-08-30-preview
{
"audioFileUri": "https://app.contoso.com/audio/message.wav",
"loop": false,
"operationContext": "31130c66-2f86-41b5-af61-23850243e093",
"audioFileId": "42922e2c-a204-4ac4-8d80-375ae2792389"
}
Sample Response
{
"status": "running",
"operationContext": "31130c66-2f86-41b5-af61-23850243e093"
}
{
"error": {
"code": "400",
"message": "The request contains invalid data."
}
}
{
"error": {
"code": "401",
"message": "Request is not authorized."
}
}
{
"error": {
"code": "403",
"message": "User is not allowed to perform specified action."
}
}
{
"error": {
"code": "404",
"message": "Resource not found on the server."
}
}
{
"error": {
"code": "500",
"message": "Internal server error."
}
}
Definitions
|
Operation |
The status of the operation |
|
Play |
The request payload for playing audio. |
|
Play |
The response payload for play audio operation. |
|
Result |
Result info class to be used to report result status for actions/operations. |
OperationStatus
The status of the operation
| Name | Type | Description |
|---|---|---|
| completed |
|
|
| failed |
|
|
| notStarted |
|
|
| running |
|
PlayAudioRequest
The request payload for playing audio.
| Name | Type | Description |
|---|---|---|
| audioFileId |
|
An id for the media in the AudioFileUri, using which we cache the media resource. |
| audioFileUri |
|
The media resource uri of the play audio request. Currently only Wave file (.wav) format audio prompts are supported. More specifically, the audio content in the wave file must be mono (single-channel), 16-bit samples with a 16,000 (16KHz) sampling rate. |
| callbackUri |
|
The callback Uri to receive PlayAudio status notifications. |
| loop |
|
The flag indicating whether audio file needs to be played in loop or not. |
| operationContext |
|
The value to identify context of the operation. |
PlayAudioResult
The response payload for play audio operation.
| Name | Type | Description |
|---|---|---|
| operationContext |
|
The operation context provided by client. |
| operationId |
|
The operation id. |
| resultInfo |
The result info for the operation. |
|
| status |
The status of the operation |
ResultInfo
Result info class to be used to report result status for actions/operations.
| Name | Type | Description |
|---|---|---|
| code |
|
The result code associated with the operation. |
| message |
|
The message is a detail explanation of subcode. |
| subcode |
|
The subcode that further classifies the result. |