Namespace: microsoft.graph
Wichtig
Die APIs unter der /beta Version in Microsoft Graph können sich ändern. Die Verwendung dieser APIs in Produktionsanwendungen wird nicht unterstützt. Um festzustellen, ob eine API in v1.0 verfügbar ist, verwenden Sie die Version Selektor.
Wiedergeben einer Eingabeaufforderung im Anruf.
Weitere Informationen zum Behandeln von Vorgängen finden Sie unter commsOperation.
Diese API ist in den folgenden nationalen Cloudbereitstellungen verfügbar.
| Weltweiter Service |
US Government L4 |
US Government L5 (DOD) |
China, betrieben von 21Vianet |
| ✅ |
❌ |
❌ |
❌ |
Berechtigungen
Wählen Sie die Berechtigungen aus, die für diese API als am wenigsten privilegiert markiert sind. Verwenden Sie eine höhere Berechtigung oder Berechtigungen nur, wenn Ihre App dies erfordert. Ausführliche Informationen zu delegierten Berechtigungen und Anwendungsberechtigungen finden Sie unter Berechtigungstypen. Weitere Informationen zu diesen Berechtigungen finden Sie in der Berechtigungsreferenz.
| Berechtigungstyp |
Berechtigungen mit den geringsten Berechtigungen |
Berechtigungen mit höheren Berechtigungen |
| Delegiert (Geschäfts-, Schul- oder Unikonto) |
Nicht unterstützt |
Nicht unterstützt |
| Delegiert (persönliches Microsoft-Konto) |
Nicht unterstützt |
Nicht unterstützt |
| Application |
Calls.Initiate.All |
Calls.AccessMedia.All |
Anmerkung: Berechtigungen werden beim Erstellen des Anrufs überprüft. Beim Aufrufen dieser API wird keine zusätzliche Berechtigungsprüfung durchgeführt. Calls.AccessMedia.All ist nur für Aufrufe erforderlich, die von der App gehostete Medien verwenden.
HTTP-Anforderung
POST /app/calls/{id}/playPrompt
POST /communications/calls/{id}/playPrompt
Hinweis: Der /app-Pfad ist veraltet. Verwenden Sie in Zukunft den /communications-Pfad.
Anforderungstext
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an.
| Parameter |
Typ |
Beschreibung |
| Fordert |
MediaPrompt-Sammlung |
Die Eingabeaufforderungen, die wiedergegeben werden sollen. Die maximal unterstützte mediaPrompt-Sammlungsgröße beträgt 20. |
| Schleife |
Boolean |
Der Schleifenwert. True gibt an, dass eine endlose Schleife ausgeführt werden soll. Der Standardwert ist false. |
| clientContext |
Zeichenfolge |
Eindeutige Clientkontextzeichenfolge. Darf maximal 256 Zeichen umfassen. |
Antwort
Wenn die Methode erfolgreich verläuft, werden der 200 OK Antwortcode und ein playPromptOperation-Objekt im Antworttext zurückgegeben.
Beispiel
Das folgende Beispiel illustriert, wie Sie diese API aufrufen können.
Anforderung
Das folgende Beispiel zeigt die Antwort.
POST https://graph.microsoft.com/beta/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/playPrompt
Content-Type: application/json
Content-Length: 166
{
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c",
"prompts": [
{
"@odata.type": "#microsoft.graph.mediaPrompt",
"mediaInfo": {
"@odata.type": "#microsoft.graph.mediaInfo",
"uri": "https://cdn.contoso.com/beep.wav",
"resourceId": "1D6DE2D4-CD51-4309-8DAA-70768651088E"
},
},
],
"loop": false
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Communications.Calls.Item.PlayPrompt;
using Microsoft.Graph.Beta.Models;
var requestBody = new PlayPromptPostRequestBody
{
ClientContext = "d45324c1-fcb5-430a-902c-f20af696537c",
Prompts = new List<Prompt>
{
new MediaPrompt
{
OdataType = "#microsoft.graph.mediaPrompt",
MediaInfo = new MediaInfo
{
OdataType = "#microsoft.graph.mediaInfo",
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "1D6DE2D4-CD51-4309-8DAA-70768651088E",
},
},
},
Loop = false,
};
// To initialize your graphClient, see https://v4.hkg1.meaqua.org/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls["{call-id}"].PlayPrompt.PostAsync(requestBody);
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphcommunications "github.com/microsoftgraph/msgraph-beta-sdk-go/communications"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphcommunications.NewPlayPromptPostRequestBody()
clientContext := "d45324c1-fcb5-430a-902c-f20af696537c"
requestBody.SetClientContext(&clientContext)
prompt := graphmodels.NewMediaPrompt()
mediaInfo := graphmodels.NewMediaInfo()
uri := "https://cdn.contoso.com/beep.wav"
mediaInfo.SetUri(&uri)
resourceId := "1D6DE2D4-CD51-4309-8DAA-70768651088E"
mediaInfo.SetResourceId(&resourceId)
prompt.SetMediaInfo(mediaInfo)
prompts := []graphmodels.Promptable {
prompt,
}
requestBody.SetPrompts(prompts)
loop := false
requestBody.SetLoop(&loop)
// To initialize your graphClient, see https://v4.hkg1.meaqua.org/en-us/graph/sdks/create-client?from=snippets&tabs=go
playPrompt, err := graphClient.Communications().Calls().ByCallId("call-id").PlayPrompt().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.communications.calls.item.playprompt.PlayPromptPostRequestBody playPromptPostRequestBody = new com.microsoft.graph.beta.communications.calls.item.playprompt.PlayPromptPostRequestBody();
playPromptPostRequestBody.setClientContext("d45324c1-fcb5-430a-902c-f20af696537c");
LinkedList<Prompt> prompts = new LinkedList<Prompt>();
MediaPrompt prompt = new MediaPrompt();
prompt.setOdataType("#microsoft.graph.mediaPrompt");
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setOdataType("#microsoft.graph.mediaInfo");
mediaInfo.setUri("https://cdn.contoso.com/beep.wav");
mediaInfo.setResourceId("1D6DE2D4-CD51-4309-8DAA-70768651088E");
prompt.setMediaInfo(mediaInfo);
prompts.add(prompt);
playPromptPostRequestBody.setPrompts(prompts);
playPromptPostRequestBody.setLoop(false);
var result = graphClient.communications().calls().byCallId("{call-id}").playPrompt().post(playPromptPostRequestBody);
const options = {
authProvider,
};
const client = Client.init(options);
const playPromptOperation = {
clientContext: 'd45324c1-fcb5-430a-902c-f20af696537c',
prompts: [
{
'@odata.type': '#microsoft.graph.mediaPrompt',
mediaInfo: {
'@odata.type': '#microsoft.graph.mediaInfo',
uri: 'https://cdn.contoso.com/beep.wav',
resourceId: '1D6DE2D4-CD51-4309-8DAA-70768651088E'
},
},
],
loop: false
};
await client.api('/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/playPrompt')
.version('beta')
.post(playPromptOperation);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Communications\Calls\Item\PlayPrompt\PlayPromptPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Prompt;
use Microsoft\Graph\Beta\Generated\Models\MediaPrompt;
use Microsoft\Graph\Beta\Generated\Models\MediaInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PlayPromptPostRequestBody();
$requestBody->setClientContext('d45324c1-fcb5-430a-902c-f20af696537c');
$promptsPrompt1 = new MediaPrompt();
$promptsPrompt1->setOdataType('#microsoft.graph.mediaPrompt');
$promptsPrompt1MediaInfo = new MediaInfo();
$promptsPrompt1MediaInfo->setOdataType('#microsoft.graph.mediaInfo');
$promptsPrompt1MediaInfo->setUri('https://cdn.contoso.com/beep.wav');
$promptsPrompt1MediaInfo->setResourceId('1D6DE2D4-CD51-4309-8DAA-70768651088E');
$promptsPrompt1->setMediaInfo($promptsPrompt1MediaInfo);
$promptsArray []= $promptsPrompt1;
$requestBody->setPrompts($promptsArray);
$requestBody->setLoop(false);
$result = $graphServiceClient->communications()->calls()->byCallId('call-id')->playPrompt()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.communications.calls.item.play_prompt.play_prompt_post_request_body import PlayPromptPostRequestBody
from msgraph_beta.generated.models.prompt import Prompt
from msgraph_beta.generated.models.media_prompt import MediaPrompt
from msgraph_beta.generated.models.media_info import MediaInfo
# To initialize your graph_client, see https://v4.hkg1.meaqua.org/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PlayPromptPostRequestBody(
client_context = "d45324c1-fcb5-430a-902c-f20af696537c",
prompts = [
MediaPrompt(
odata_type = "#microsoft.graph.mediaPrompt",
media_info = MediaInfo(
odata_type = "#microsoft.graph.mediaInfo",
uri = "https://cdn.contoso.com/beep.wav",
resource_id = "1D6DE2D4-CD51-4309-8DAA-70768651088E",
),
),
],
loop = False,
)
result = await graph_client.communications.calls.by_call_id('call-id').play_prompt.post(request_body)
Antwort
Das folgende Beispiel zeigt die Antwort.
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 200 OK
Location: https://graph.microsoft.com/beta/communications/calls/57dab8b1-894c-409a-b240-bd8beae78896/operations/0fe0623f-d628-42ed-b4bd-8ac290072cc5
{
"@odata.type": "#microsoft.graph.playPromptOperation",
"id": "0fe0623f-d628-42ed-b4bd-8ac290072cc5",
"status": "running",
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c"
}
Benachrichtigung – Vorgang abgeschlossen
Anmerkung: Wenn endlose Schleife auftritt, wird diese Benachrichtigung nicht gesendet.
POST https://bot.contoso.com/api/calls
Content-Type: application/json
{
"@odata.type": "#microsoft.graph.commsNotifications",
"value": [
{
"@odata.type": "#microsoft.graph.commsNotification",
"changeType": "deleted",
"resourceUrl": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/operations/0FE0623FD62842EDB4BD8AC290072CC5",
"resourceData": {
"@odata.type": "#microsoft.graph.playPromptOperation",
"@odata.id": "/communications/calls/57DAB8B1894C409AB240BD8BEAE78896/operations/0FE0623FD62842EDB4BD8AC290072CC5",
"@odata.etag": "W/\"54451\"",
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c",
"status": "completed"
}
}
]
}