【发布时间】:2016-11-16 09:23:21
【问题描述】:
目标是为模块开发系统监控解决方案的接口,该模块调用值班人员并从文件系统播放一些语音/音频文件。
我有一个启用了电话选项的 Skype for business 2015(以前的 lync)用户。我也可以拨打电话号码。但接下来的问题是,如何等到被叫方接听电话并播放音频文件(或者更好的是 System.Speech 变体而不是播放音频文件),然后该人必须批准他/她接到电话。
我目前拥有的:
public void SendLyncCall(string numberToCall, string textToSpeech)
{
var targetContactUris = new List<string> {numberToCall}; //"tel:+4900000000" }; //removed here
_automation.BeginStartConversation(AutomationModalities.Audio, targetContactUris, null, StartConversationCallback, null);
while (this.globalConv == null)
{
Thread.Sleep(1);
}
if (globalConv != null)
{
LyncClient client = LyncClient.GetClient();
client.DeviceManager.EndPlayAudioFile(
client.DeviceManager.BeginPlayAudioFile(@"d:\tmp\test1.wav",
AudioPlayBackModes.Communication,
false,
null,
null));
}
}
private void StartConversationCallback(IAsyncResult asyncop)
{
// this is called once the dialing completes..
if (asyncop.IsCompleted == true)
{
ConversationWindow newConversationWindow = _automation.EndStartConversation(asyncop);
globalConv = newConversationWindow;
AVModality avModality = globalConv.Conversation.Modalities[ModalityTypes.AudioVideo] as AVModality;
foreach (char c in "SOS")
{
avModality.AudioChannel.BeginSendDtmf(c.ToString(), null, null);
System.Threading.Thread.Sleep(300);
}
}
}
另一个问题是,是否可以将整个模块更改为可以作为 Windows 服务运行的注册端点?目前我的 sfb 必须打开并登录..
【问题讨论】:
-
上面的代码看起来您使用的是 Lync Client SDK 而不是 UCMA。
-
谢谢。我从标题中删除了 dthat。 lync 客户端对于应该作为服务运行是完全错误的方式。我现在将使用 ucma 5.0
标签: c# phone-call skype-for-business