本文整理汇总了C#中Call.PlayAudio方法的典型用法代码示例。如果您正苦于以下问题:C# Call.PlayAudio方法的具体用法?C# Call.PlayAudio怎么用?C# Call.PlayAudio使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Call
的用法示例。
在下文中一共展示了Call.PlayAudio方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PlayVoiceMessage
private Task PlayVoiceMessage(TinyIoCContainer container, Call call, int index = -1)
{
var dbContext = container.Resolve<DatabasebContext>();
Recording[] voiceMessages = dbContext.VoiceMessages.Where(r => r.PhoneNumber == AgentPhoneNumber).ToArray();
if (index == -1)
{
index = voiceMessages.Length - 1;
}
var lines = voiceMessages[index].Url.Split('/');
var url = "https://api.catapult.inetwork.com/v1/users/" + AgentPhoneNumber +
"/media/" + lines[lines.Length - 1];
return
call.PlayAudio(new Dictionary<string, object>
{
{"fileUrl", url},
{"tag", $"voice-message:{index}"}
});
}
示例2: ProcessCalledToOwnerEvent
private async Task ProcessCalledToOwnerEvent(SpeakEvent ev, TinyIoCContainer container)
{
if (ev.Status != "done")
{
return;
}
var call = new Call {Id = ev.CallId};
switch (ev.Tag)
{
case "start-recording-message":
await call.PlayAudio(new Dictionary<string, object>
{
{"fileUrl", $"{Context.Items["baseUrl"]}/Content/beep.mp3"},
{"tag", "start-recording"}
});
break;
}
}