Windows 7 中没有声音 TAPI
本文关键字:声音 TAPI Windows | 更新日期: 2023-09-27 18:30:25
我尝试在C#.NET中使用TAPI编写自动应答机。
tapi3_dev此示例在 Windows XP 中工作,但在 Windows 7 中,一切正常(没有错误或异常),但没有声音播放,只是我可以录制音频;
请帮助我。
我的代码::
case TAPI3Lib.ADDRESS_EVENT.AE_RINGING: this.PlayVoice(CallInfo);
...
private void PlayVoice(TAPI3Lib.ITCallInfo iTCallInfo)
{
try
{
//the supported file extensions are .avi and .wav. http://msdn.microsoft.com/en-us/library/ms730457.aspx
TAPI3Lib.ITBasicCallControl2 iTBasicCallControl2 = (TAPI3Lib.ITBasicCallControl2)iTCallInfo;
this.selectedTerminal = iTBasicCallControl2.RequestTerminal(TAPI3Lib.TapiConstants.CLSID_String_FilePlaybackTerminal, TAPI3Lib.TapiConstants.TAPIMEDIATYPE_AUDIO, TAPI3Lib.TERMINAL_DIRECTION.TD_CAPTURE);
TAPI3Lib.ITMediaPlayback iTMediaPlayback = (TAPI3Lib.ITMediaPlayback)this.selectedTerminal;
object[] playList = new object[1];
playList[0] = @"C:'ModemLog'7533f717-6cc5-41d5-9845-6983cff85e4b.avi";
//playList[0] = @"C:'Users'Abedi'Desktop'Anghezi.wav";
//playList[0] = @"C:'ProgramData'Venta'VentaFax & Voice 6'Service'greet1.wav";
iTMediaPlayback.PlayList = playList;
iTBasicCallControl2.SelectTerminalOnCall(this.selectedTerminal);
this.iTMediaControl = (TAPI3Lib.ITMediaControl)this.selectedTerminal;
if (iTCallInfo.CallState == TAPI3Lib.CALL_STATE.CS_OFFERING)
iTBasicCallControl2.Answer();
this.iTMediaControl.Start();
(selectedTerminal as TAPI3Lib.ITBasicAudioTerminal).Volume = 0;
}
catch (Exception exception)
{
this.Log(exception.Message, "Exception in PlayVoice");
this.WriteLine(exception.Message);
this.buttonDisconnect_Click(null, EventArgs.Empty);
}
}
您的代码是否在 Windows 服务中运行?Windows 7 下的 Windows 服务中的音频控制存在一个已知问题。目前,除了启动Windows应用程序以与tapi交互之外,我找不到其他解决方法。