I have purchased a license of AddTapi.NET to simplify my development using TAPI in a product that runs as a Windows service. I was able to use the TAPI in a Windows GUI and console application and ported the code into my Windows service. At that point, I noted that the code which uses the speech API such as TapiCall.Speak or TapiCall.Play (wavefile) was not generating sound on the phone line and was remaining silent.

There are a couple of previous questions that may relate to my issue.

Question: Playing Voice over a modem from a Windows service indicated a problem using speech that was resolved by spawning a GUI thread in the Windows service. I attempted to do this but was unsuccessful in getting the speech to be heard on the phone.

Question: Access violation with Tapi in Windows service seems to indicate an initial problem with TAPI in a service yet was resolved by using the AddTapi product. The ticket does not explicitly mention the use of the speech API though (SAPI)

I am programming in C# using Visual Studio 2010 and .NET 4.0. I am trying to get this to work on Windows 7. I received an e-mail from AddTapi that indicated that Microsoft changed the security to disallow use of the voice subsystem from services in Win 2008 Server, Windows Vista, and Windows 7. The above articles seem to indicate some success with AddTapi although it may not be on Windows 7.

Given that the main system that I am working with is a Windows service (and child processes), what would seem to be the best approach to getting the speech to work. If I put the SAPI code in a console application, I would like this to be managed without requiring a user to be actively logged onto the computer. There is nothing graphical about my TAPI code. Should I take an approach similar to Article: Launching an interactive process and spawn an interactive process? Have there been any success stories using TAPI speech in a Windows service?

有帮助吗?

解决方案

We resolved this problem in AddTapi.NET 5.0. Version 5.0 can use Speech API (TapiCall.Speak and TapiCall.Play) in Windows service applications. There is no need to use a separate process and the service can run under default Local Service account.

For everyone who doesn't use AddTapi.NET, the key is to use SAPI5 SpVoice object speaking to a custom stream. You cannot instantiate SpAudio or SpMMAudioOut objects in Windows service, so you will need to implement your own stream class and set SpVoice's output to that stream.

其他提示

I had the same requirements as your project (TAPI in a Windows Service using AddTapi.NET). I also received the same response. I tried some of the other posts out there recommending that I run the application in a separate thread so I tool my entire solution and converted it to a WPF Application with a simple page that would never appear but had all the AddTapi configuration happening in the constructor.

NO SUCCESS.

The application would run fine when run from the WPF application but when the WPF page was instantiated in the STAThread enabled thread Play and Speak still would not work. I have been looking all over for an answer on this but there isn't anything but others stating that there really is no solution (no real solution).

Running my application through a seperate process simply won't cut it and since running in a seperate thread won't work either I'm going to have to consider running this application as a regular windows app (will require logon).

Wish I had a solution, sorry.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top