You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Get started with using audio streams through Azure Communication Services Media Streaming API. This quickstart assumes you are already familiar with Call Automation APIs to build an automated call routing solution.
22
22
23
23
::: zone pivot="programming-language-csharp"
24
-
[!INCLUDE [](./includes/call-automation-media/)]
24
+
[!INCLUDE [Media Streaming with .NET](./includes/call-automation-media/media-streaming-quickstart-csharp.md)]
25
25
::: zone-end
26
26
27
27
::: zone pivot="programming-language-java"
28
-
[!INCLUDE [](./includes/call-automation-media/]
28
+
[!INCLUDE [Media Streaming with Java](./includes/call-automation-media/media-streaming-quickstart-java.md)]
29
29
::: zone-end
30
30
31
-
## Stop Audio Streaming
32
-
Audio streaming will stop automatically when the call is ended or cancelled.
31
+
32
+
## Message schema
33
+
When ACS has received the URL for your WebSocket server, it will create a connection to it. Once ACS has successfully connected to your WebSocket server it will send through the first data packet which contains metadata regarding the incoming media packets.
34
+
35
+
```code
36
+
/**
37
+
* The first message upon WebSocket connection will be the metadata packet
38
+
* which contains the subscriptionId and audio format
39
+
*/
40
+
public class AudioMetadataSample {
41
+
public string kind; // What kind of data this is, e.g. AudioMetadata, AudioData.
42
+
public AudioMetadata audioMetadata;
43
+
}
44
+
45
+
public class AudioMetadata {
46
+
public string subscriptionId // unique identifier for a subscription request
47
+
public string encoding; // PCM only supported
48
+
public int sampleRate; // 16000 default
49
+
public int channels; // 1 default
50
+
public int length; // 640 default
51
+
}
52
+
```
53
+
54
+
## Audio streaming schema
55
+
After sending through the metadata packet, ACS will start streaming audio media to your WebSocket server. Below is an example of what the media object your server will receive looks like.
56
+
57
+
```code
58
+
/**
59
+
* The audio buffer object which is then serialized to JSON format
60
+
*/
61
+
public class AudioDataSample {
62
+
public string kind; // What kind of data this is, e.g. AudioMetadata, AudioData.
63
+
public AudioData audioData;
64
+
}
65
+
66
+
public class AudioData {
67
+
public string data; // Base64 Encoded audio buffer data
68
+
public string timestamp; // In ISO 8601 format (yyyy-mm-ddThh:mm:ssZ)
69
+
public string participantRawID;
70
+
public boolean silent; // Indicates if the received audio buffer contains only silence.
0 commit comments