【问题标题】:Loop TextToSpeech message in Ozeki VOIP在 Ozeki VOIP 中循环 TextToSpeech 消息
【发布时间】:2015-04-14 07:48:05
【问题描述】:

当我拨打 SIP 电话时,我使用 Microsoft Speech Platform 和 Ozeki VOIP Sip Client 来播放 TextToSpeech 消息。如何设置 TTS 以在 Ozeki 中永久循环消息?

我正在为 Ozeki 使用这个 nuget 包:http://www.nuget.org/packages/ozeki.voip.sip.client/

这是我的代码:

var textToSpeech = new TextToSpeech();

var msp = new MSSpeechPlatformTTS();

textToSpeech.AddTTSEngine(msp);

var clientLanguage = ConfigurationManager.AppSettings["TextSpeechLanguage"];

var voices = textToSpeech.GetAvailableVoices();

foreach (var voice in voices)
{
    if (voice.Language == clientLanguage)
        textToSpeech.ChangeLanguage(voice.Language, voice.Name);
}

if (string.IsNullOrEmpty(speechString))
{
    textToSpeech.ChangeLanguage("en-GB");
    speechString = "You have a visitor. Press 1 to accept the visit. Press 2 to talk the the visitor.";
}  

mediaSender.AttachToCall(call);
connector.Connect(textToSpeech, mediaSender);

textToSpeech.AddAndStartText(speechString);

【问题讨论】:

    标签: c# .net text-to-speech ozeki


    【解决方案1】:

    我认为它可以帮助你。尝试相应地更改代码的最后一行:

    while(true)
    {
    textToSpeech.AddAndStartText(speechString);
    }
    

    您可以了解更多关于使用MS Speach Platform 11 in C# here的信息。

    【讨论】:

      【解决方案2】:

      答案是附加“停止”事件处理程序并再次播放文本以创建消息循环。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-02-25
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多