Teilnehmer: startHoldMusic
Artikel
07/18/2022
3 Minuten Lesedauer
3 Mitwirkende
In diesem Artikel
Namespace: microsoft.graph
Halten Sie einen Teilnehmer in die Warteschleife, und spielen Sie Musik im Hintergrund ab.
Hinweis: Es kann zu einem bestimmten Zeitpunkt nur ein Teilnehmer in die Warteschleife versetzt werden.
Berechtigungen
Eine der nachfolgenden Berechtigungen ist erforderlich, um diese API aufrufen zu können. Weitere Informationen, unter anderem zur Auswahl von Berechtigungen, finden Sie im Artikel zum Thema Berechtigungen .
Berechtigungstyp
Berechtigungen (von der Berechtigung mit den wenigsten Rechten zu der mit den meisten Rechten)
Delegiert (Geschäfts-, Schul- oder Unikonto)
Nicht unterstützt.
Delegiert (persönliches Microsoft-Konto)
Nicht unterstützt.
Anwendung
Calls.JoinGroupCallsasGuest.All oder Calls.JoinGroupCalls.All
HTTP-Anforderung
POST /communications/calls/{id}/participants/{id}/startHoldMusic
Name
Beschreibung
Authorization
Bearer {token}. Erforderlich.
Content-type
application/json. Erforderlich.
Anforderungstext
Geben Sie im Anforderungstext ein JSON-Objekt mit den folgenden Parametern an.
Parameter
Typ
Beschreibung
customPrompt
microsoft.graph.mediaPrompt
Optional. Audioaufforderung, die der Teilnehmer hört, wenn er in die Warteschleife versetzt wird.
Clientcontext
Zeichenfolge
Optional. Eindeutige Clientkontextzeichenfolge. Kann maximal 256 Zeichen enthalten.
Antwort
Bei erfolgreicher Ausführung gibt die Methode den 202 Accepted Antwortcode und ein startHoldMusicOperation-Objekt im Antworttext zurück.
Beispiel
Das folgende Beispiel illustriert, wie Sie diese API aufrufen können.
Anforderung
Nachfolgend ist ein Beispiel für eine Anforderung dargestellt.
POST https://graph.microsoft.com/v1.0/communications/calls/e141b67c-90fd-455d-858b-b48a40b9cc8d/participants/fa1e9582-7145-4ca3-bcd8-577f561fcb6e/startHoldMusic
Content-type: application/json
{
"customPrompt": {
"@odata.type": "#microsoft.graph.mediaPrompt",
"mediaInfo": {
"@odata.type": "#microsoft.graph.mediaInfo",
"uri": "https://bot.contoso.com/onHold.wav",
},
},
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c",
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var customPrompt = new MediaPrompt
{
MediaInfo = new MediaInfo
{
Uri = "https://bot.contoso.com/onHold.wav"
}
};
var clientContext = "d45324c1-fcb5-430a-902c-f20af696537c";
await graphClient.Communications.Calls["{call-id}"].Participants["{participant-id}"]
.StartHoldMusic(customPrompt,clientContext)
.Request()
.PostAsync();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
const options = {
authProvider,
};
const client = Client.init(options);
const startHoldMusicOperation = {
customPrompt: {
'@odata.type': '#microsoft.graph.mediaPrompt',
mediaInfo: {
'@odata.type': '#microsoft.graph.mediaInfo',
uri: 'https://bot.contoso.com/onHold.wav',
},
},
clientContext: 'd45324c1-fcb5-430a-902c-f20af696537c',
};
await client.api('/communications/calls/e141b67c-90fd-455d-858b-b48a40b9cc8d/participants/fa1e9582-7145-4ca3-bcd8-577f561fcb6e/startHoldMusic')
.post(startHoldMusicOperation);
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/communications/calls/e141b67c-90fd-455d-858b-b48a40b9cc8d/participants/fa1e9582-7145-4ca3-bcd8-577f561fcb6e/startHoldMusic"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
MSGraphPrompt *customPrompt = [[MSGraphPrompt alloc] init];
MSGraphMediaInfo *mediaInfo = [[MSGraphMediaInfo alloc] init];
[mediaInfo setUri:@"https://bot.contoso.com/onHold.wav"];
[customPrompt setMediaInfo:mediaInfo];
payloadDictionary[@"customPrompt"] = customPrompt;
NSString *clientContext = @"d45324c1-fcb5-430a-902c-f20af696537c";
payloadDictionary[@"clientContext"] = clientContext;
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
MediaPrompt customMediaPrompt = new MediaPrompt();
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.uri = "https://bot.contoso.com/onHold.wav";
customPrompt.mediaInfo = mediaInfo;
String clientContext = "d45324c1-fcb5-430a-902c-f20af696537c";
graphClient.communications().calls("e141b67c-90fd-455d-858b-b48a40b9cc8d").participants("fa1e9582-7145-4ca3-bcd8-577f561fcb6e")
.startHoldMusic(ParticipantStartHoldMusicParameterSet
.newBuilder()
.withCustomPrompt(customPrompt)
.withClientContext(clientContext)
.build())
.buildRequest()
.post();
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.New()
customPrompt := msgraphsdk.NewPrompt()
requestBody.SetCustomPrompt(customPrompt)
customPrompt.SetAdditionalData(map[string]interface{}{
"@odata.type": "#microsoft.graph.mediaPrompt",
}
clientContext := "d45324c1-fcb5-430a-902c-f20af696537c"
requestBody.SetClientContext(&clientContext)
callId := "call-id"
participantId := "participant-id"
result, err := graphClient.Communications().CallsById(&callId).ParticipantsById(&participantId).StartHoldMusic(call-id, participant-id).Post(requestBody)
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Import-Module Microsoft.Graph.CloudCommunications
$params = @{
CustomPrompt = @{
"@odata.type" = "#microsoft.graph.mediaPrompt"
MediaInfo = @{
"@odata.type" = "#microsoft.graph.mediaInfo"
Uri = "https://bot.contoso.com/onHold.wav"
}
}
ClientContext = "d45324c1-fcb5-430a-902c-f20af696537c"
}
Start-MgCommunicationCallParticipantHoldMusic -CallId $callId -ParticipantId $participantId -BodyParameter $params
Ausführliche Informationen zum Hinzufügen des SDK zu Ihrem Projekt und zum Erstellen einer authProvider-Instanz finden Sie in der SDK-Dokumentation .
Antwort
Hinweis: Das hier gezeigte Antwortobjekt kann zur besseren Lesbarkeit gekürzt werden.
HTTP/1.1 202 Accepted
Location: https://graph.microsoft.com/v1.0/communications/calls/e141b67c-90fd-455d-858b-b48a40b9cc8d/operations/0fe0623f-d628-42ed-b4bd-8ac290072cc5
{
"@odata.type": "#microsoft.graph.startHoldMusicOperation",
"id": "0fe0623f-d628-42ed-b4bd-8ac290072cc5",
"status": "running",
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c"
}
Benachrichtigung, die an die Anwendung gesendet wird, nachdem startHoldMusicOperation beendet wurde
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/e141b67c-90fd-455d-858b-b48a40b9cc8d/operations/0fe0623f-d628-42ed-b4bd-8ac290072cc5",
"resourceData": {
"@odata.type": "#microsoft.graph.startHoldMusicOperation",
"@odata.id": "communications/calls/e141b67c-90fd-455d-858b-b48a40b9cc8d/operations/0fe0623f-d628-42ed-b4bd-8ac290072cc5",
"@odata.etag": "W/\"54451\"",
"clientContext": "d45324c1-fcb5-430a-902c-f20af696537c",
"status": "completed"
}
}
]
}