ÓÐÒ»¶Îʱ¼äûÓиüÐÂÍøÕ¾ÁË£¬×î½üͦæµÄ£¬ËùÒÔдÊéµÄ½ø¶ÈÂýÁËһЩ£¬Á½ÖÜֻдÁË10¶àÒ³Éè¼ÆģʽÏà¹ØµÄÄÚÈÝ¡£Ï£ÍûÔÚ½ÓÏÂÀ´µÄ¼¸ÖÜÄܼӿì½ø¶È£¬¸Ï½ôŪÍê¡£ÁíÍâÇ°Á½Ì죬ÎÒ±»ÆÀΪÁËBorland Delphi²úƷר¼Ò£¬¼ÓÉÏÕâÁ½Ìì±±¾©µÄ·ÇµäÐÎÊÆÒ²»ººÍ¶àÁË£¬ºÜ¸ßÐË¡£Îª´Ë¹«¿ªºÜ¾ÃÒÔǰдµÄһƪÎÄÕ£¬Óë´ó¼Ò·ÖÏíÒ»ÏÂÎҵĿìÀÖ¡£ żȻµÄÆðÒò ¼ÇµÃ»¹ÊÇÔÚÈ¥ÄêÇéÈ˽ڵÄʱºò£¬µ±Ê±Ò»Ö±ÔÚΪ¸øÅ®ÅóÓÑËÍʲôÀñÎï¶ø·¢³î£¬¾õµÃËÍ»¨ÊµÔÚûÓÐʲô´´Ò⣬¿ÉÓÖ²»ÖªµÀʲôÑùµÄÀñÎï¼´ÄܸøËýÒ»¸ö¾ªÏ²Í¬ÊÂÓÖ²»°º¹ó¡£Õâʱ£¬ÎÒµÄÒ»¸öºÃÅóÓѳöÁËÒ»¸öÖ÷Ò⣬˵²»Èçµç»°µã¸è°É£¬»¹±È½ÏÌر𡣿ÉÊÇÈç¹ûÊÇͨ¹ýµç̨µã¸èºó£¬ÔÙ¸æËßËýÊÕÌýµÄ»°¾ÍÆð²»µ½ÒâÍâµÄЧ¹ûÁË¡£ ¾ÍÔÚûÓÐʲôºÃ°ì·¨µÄʱºò£¬ÎÒÔÚDelphiÂÛ̳ÉÏϹ¹äµÄʱºò£¬Ò»¸öÈËÌá³öµÄÎÊÌâͻȻÆô·¢ÁËÎÒ£¬ÎÊÌâÊǹØÓÚÈç¹û±à³ÌʵÏÖÓïÒôÁôÑԺ͵绰°´¼üµÄ¼Ç¼¹¦Äܵġ£ÎÒͻȻÏëΪʲôÎÒ²»ÄÜдһ¸ö³ÌÐòÀ´¿ØÖƵ绰£¬È»ºóÔÙ¸øÅ®ÓÑ´òÒ»¸ö´«ºô£¬ÈÃËý»Øµç»°£¬µ±µç»°½Óͨºó£¬ÎҵijÌÐòÏȲ¥·ÅÒ»¶ÎÊÂÏȼÖƺõĻ°£¬ÌáʾËýͨ¹ýµç»°°´¼üÀ´Ñ¡¸è£¬²¢ÄÜÌṩÁôÑԵŦÄÜÄØ¡£Ö÷ÒâÒ»¶¨£¬ÎҾ͸Ïæ²éÔÄÕâ·½ÃæµÄ×ÊÁÏÁË£¬Ò»¿ªÊ¼ÅóÓÑÃǸæËß¿ÉÒÔͨ¹ýÓïÒô¿¨À´ÊµÏÖÕâЩ¹¦ÄÜ£¬¿ÉÊÇÓïÒô¿¨±È½Ï¹ó£¬¶øÇÒÎÒÂòÁ˺󣬳ýÁËÓÃÒ»´ÎÒÔÍâÒÔºóÒ²²»»á¾³£Óõ½£¬ÊµÔÚÊÇÓеãÀË·Ñ£¬ºóÀ´ÍøÓÑccedÌáµ½ËûÌýÈË˵TurboPower¹«Ë¾³öµÄAsync Professional¿Ø¼þÌṩÁËÒ»×é»ùÓÚTelephone ApiµÄ¿Ø¼þ¿ÉÒÔͨ¹ýÓïÒôModemÀ´ÊµÏÖÀàËƵŦÄÜ¡£Õâ¸ö¿´À´³É±¾¾ÍµÍ¶àÁË£¬ÎÒµÄModemÕýºÃÊÇÓïÒôModem£¬ÓÚÊÇÎÒ¾ÍÏÂÔØÁËAsync Professional£¨¹Ù·½ÍøÖ·www.turbopower.com£©ÊÔÑéÁËһϣ¬¹ûÈ»²»Í¬·´Ï죬±ãÒËÇÒ¼òµ¥¡£ ¿ªÊ¼Éè¼Æ ÏÂÃæÎÒÃǾÍÀ´¿´¿´ÈçºÎÀûÓÃÕâ×é¿Ø¼þʵÏÖÓïÒô¹¦ÄÜ£¬¶ÔÓÚÎÒÃdzÌÐòµÄÓ¦ÓÃÀ´Ëµ£¬Ö»ÐèҪʹÓÃÁ½¸öTAPI¿Ø¼þTApdComPortºÍTApdTapiDevice¼´¿É£¬ÆäÖÐTApdComPort¿Ø¼þÊÇÒ»¸ö´®¿ÚͨѶ¿Ø¼þ£¬ÒòΪModemÊÇͬ´®¿ÚÏàÁ¬½ÓµÄ£¬Òò´ËÐèÒª´®¿ÚͨѶ¿Ø¼þÀ´½øÐпØÖÆ¡£¶øTapdTapiDeviceÔòÊÇÌṩÓïÒô¹¦ÄܵĺËÐĿؼþ¡£ Ê×ÏÈ£¬Ð½¨Ò»¸ö³ÌÐòÏîÄ¿£¬ÔÚ´°ÌåÉÏ·ÅÖÃÒ»¸öTApdComport¿Ø¼þ£¬ÉèÖÃÆäÊôÐÔΪAutoOpen:=False;TapiMode=tmOn;ÕâÀïTapiMode É趨ΪtmOn ±íÃ÷TApdComPort ½«ÓÉͬÆä¹ØÁªµÄTApdTapiDevice.¿Ø¼þÀ´¿ØÖÆ£¬¶ø½«AutoOpenÉ趨ΪFalse ÊÇÒòΪ´®¿ÚµÄ´ò¿ªºÍ¹Ø±ÕÏÖÔÚ¿ÉÒÔÍêÈ«ÓÉTAPIÀ´¿ØÖÆÁË¡£ È»ºó£¬ÔÚ´°ÌåÉÏ·ÅÖÃÒ»¸öTApdTapiDevice¿Ø¼þ£¬É趨ÆäComportÊôÐÔΪǰÃæµÄTApdComPort¿Ø¼þ¡£É趨AnswerOnRingÊôÐÔΪ1£¬±íÃ÷µÚÒ»´ÎÕñÁåºó¾Í¿ªÊ¼ÓɳÌÐò¿ØÖƵ绰µÄÓ¦´ð¡£É趨ShowTapiDevicesΪTrue±íÃ÷µ±µ÷ÓÿؼþµÄSelectDevice·½·¨Ê±£¬»áÏÔʾһ¸öÑ¡ÔñTAPIÉ豸µÄ¶Ô»°¿ò¡£ShowPortsÊôÐÔΪfalse£¬±íÃ÷µ÷ÓÃSelectDevice·½·¨²»»áÏÔʾ´®ÐпÚÁÐ±í¡£ ½ÓÏÂÀ´£¬±¾³ÌÐòÖ÷ÒªÊDzÉÓÃÓÐÏÞ״̬»úÀ´¿ØÖÆÁ÷³ÌµÄ£¬ÏÂÃæÎÒÃÇÀ´¶¨Òåö¾Ù״̬ Type TCurrentState = (csIdle, csWaiting, csConnected, csPlaying, csRecording, sDisconnected); ÆäÖÐcsIdle״̬±íʾµç»°´¦ÓÚ¿ÕÏÐ״̬£¬ÕýµÈ´ý½ÓÈë¡£csWaitingÔò±íʾµç»°´¦ÓÚ³ÌÐò¿ØÖÆÏ£¬µÈ´ý½ÓÈ룬Èç¹ûÓе绰´òÈ룬³ÌÐò»á×Ô¶¯Ó¦´ð¡£csConnectedÔò±íʾÓе绰´òÈ룬´¦ÓÚÁ¬½Ó״̬£¬csRecordingÔòÓÃÀ´±íʾµ±Ç°´¦ÓڼǼµç»°ÁôÑÔ״̬¡£csDisconnectedÔò±íʾµ±Ç°Á¬½Ó¹Ò¶ÏÁË¡£ ³ÌÐò³õʼ»¯ ÏÂÃæ¾ÍÊdzÌÐòµÄOnCreateµÄʼþ´¦Àíº¯Êý£¬·Ç³£¼òµ¥£¬¾ÍÊÇÏÈÉèÖõ±Ç°×´Ì¬ÎªcsIdle£¬²¢ÉèÖÃApdTapiDevice¿Ø¼þµÄTrimSecondsÊôÐÔΪ5£¬±íʾµ±Â¼ÒôʱÈç¹ûÓУµÃëµÄ³ÁĬʱ¼ä¾Í¹Ò¶Ï¡£ procedure TFrmMain.FormCreate(Sender: TObject); var TeleIni: TIniFile; begin CurrentState := csIdle; ApdTapiDevice.TrimSeconds := 5; //¼ÒôʱÓÐ5Ãë¾²Òô¾Í¹Ò¶Ï CommandList := TStringList.Create; TeleIni := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Tele.ini'); TeleIni.ReadSectionvalues('Commands', CommandList); TeleIni.Free; WindowState := wsMaximized; end; È»ºóÊǽ«¶¨ÒåÔÚTele.IniÎļþÖеĽ«Òª²¥·ÅµÄÉùÒôÁбíÎļþĿ¼¼ÓÔص½CommandListÖС£Tele.IniµÄʾÀýÈçÏ£º [Commands] 1#=1.wav 2#=2.wav 3#=3.wav 123#=E:\Program Files\APRO\Examples\Beep.wav ÆäÖÐ1#£¬±íʾµ±Óû§°´ÏÂ1ºÍ#ºÅ°´¼üºó£¬³ÌÐò»á²¥·ÅÆä¶ÔÓ¦µÄ1.wavÎļþ¡£½ÓÏÂÀ´¾ÍÊÇÎÒÃÇÒªÌṩÁ½¸öÃüÁһ¸öÊǼà¿Øµç»°£¬Ò»¸öÊǹҶϵ绰£¬ÏÈÔÚ´°ÌåÉÏÌí¼ÓÒ»¸öTlistBox,ÆðÃûΪLBSysInfo£¬È»ºóÌí¼ÓÁ½¸ö²Ëµ¥Ï²¢Í¬Á½¸öActionÁ¬½Ó£¬±àдActionµÄOnExecuteʼþ´¦Àíº¯Êý£º //¼à¿Øµç»° procedure TFrmMain.ActionAnswerExecute(Sender: TObject); begin try ApdTapiDevice.EnableVoice := True; except Application.MessageBox('µ±Ç°É豸²»Ö§³ÖÓïÒôÀ©Õ¹', '´íÎó', MB_OK); end; if ApdTapiDevice.EnableVoice then begin ApdTapiDevice.AutoAnswer; LBSysInfo.Items.Add('answer:½ÓÌý¶Ô·½µç»°'); CurrentState := csWaiting; end end; ÒòΪ²»ÊÇËùÓеÄModem¶¼Ö§³ÖÓïÒô¹¦ÄÜ£¬Òò´ËÔÚ¼à¿Øµç»°½ÓÈëÇ°Ó¦¸ÃÏÈÅжÏÉèÖÃApdTapiDevice.EnableVoice := True;£¬Èç¹û³öÏÖÒì³££¬±íÃ÷Modem²»Ö§³ÖÓïÒô¹¦ÄÜ¡£Èç¹ûÖ§³ÖµÄ»°£¬¾Íµ÷ÓÃAutoAnswer·½·¨µÈ´ý½ÓÈëͬʱÉèÖÃ״̬ΪcsWaiting£¬²¢ÔÚÁбí¿òÖÐдÈëÈÕÖ¾¡£ //¹Ò¶Ïµç»° procedure TFrmMain.ActionCancelExecute(Sender: TObject); begin ApdTapiDevice.CancelCall; LBSysInfo.Items.Add('cancel:¹Ò¶Ï¶Ô·½µç»°'); CurrentState := csIdle; end; ¹Ò¶Ïµç»°¾Í¼òµ¥¶àÁË£¬Ö»Òª¼òµ¥µÄµ÷ÓÃTApdTapiDevice¿Ø¼þµÄCancelCall·½·¨¾Í¿ÉÒÔÁË£¬»¹ÐèÒªÉèÖõ±Ç°×´Ì¬ÎªcsIdle¡£ Èç¹ûϵͳÖдæÔÚ¶à¸öTAPIÉ豸µÄʱºò£¬ÎÒÃÇ»¹¿ÉÒÔÑ¡ÔñʹÓÃÄÄÒ»¸öÀ´½ÓÌýµç»°£¬ÏÂÃæÊÇÑ¡ÔñÉ豸µÄ·½·¨£º //Ñ¡ÔñÉ豸 procedure TFrmMain.ActionSelDevExecute(Sender: TObject); begin ApdTapiDevice.SelectDevice; ApdTapiDevice.EnableVoice := True; end; ʼþÇý¶¯ Telephone APIÊÇ»ùÓÚʼþÇý¶¯µÄ£¬Òò´ËºËÐŦÄÜÐèÒªÔÚʼþ´¦Àíº¯ÊýÖÐʵÏÖ£¬ÏÈÀ´¿´³ÌÐòµÄTApdTapiDeviceµÄOnConnectʼþ´¦Àíº¯Êý´úÂ룺 procedure TFrmMain.ApdTapiDeviceTapiConnect(Sender: TObject); begin CurrentState := csConnected; LBSysInfo.Items.Add('Connect:Á¬½Ó³É¹¦'); ApdTapiDevice.PlayWaveFile('Greeting.wav');//²¥·Å¹¦ÄÜÌáʾÓïÒô LBSysInfo.Items.Add('connect:²¥·Ågreeting.wav'); end; µ±Óû§´òÈë±»¼à¿ØµÄµç»°ºó£¬»á¼¤·¢Õâ¸öʼþ£¬³ÌÐòÓ¦¸ÃÔÚÓû§½ÓÈëºó²¥·ÅÌáʾÓïÒô£¬ÌáʾÓû§°´²»Í¬¹¦ÄܼüÀ´µã¸è»òÁôÑÔ¡£³ÌÐòÉèÖõ±Ç°×´Ì¬ÎªcsConnected£¬È»ºóµ÷ÓÃApdTapiDeviceµÄPlayWaveFile·½·¨²¥·ÅÌáʾÓïÒô²¨Îļþ¡£ ҪעÒâµÄÊÇ£º²»Í¬ModemÖ§³Ö²¥·ÅµÄ²¨ÎļþµÄ¸ñʽÊDz»Í¬µÄ£¬µ«ËüÃǶ¼Ö§³ÖPCM 8λµ¥ÉùµÀµÄ²¨Îļþ£¬µ«ÕâÖÖÀàÐͲ¨ÎļþµÄÒôÖʷdz£²î£¬ÓÃÀ´²¥·Å¸èÇúЧ¹ûʵÔÚÔã¸â£¬²»¹ý´ó¶àÊýÓïÒôModem¶¼Ö§³ÖÒôÖʸüºÃµÄ²¨Îļþ¸ñʽ£¬µ«Í¨³£¶¼ÊÇ PCM¸ñʽµÄ£¬±ÈÈçÎÒµÄLucent Voice Modem¾ÍÖ§³ÖPCM 16λ¡¡µ¥ÉùµÀµÄ²¨ÎļþµÄ²¥·Å¡£¸èÇúת»¯Îª²¨Îļþ·Ç³£¼òµ¥£¬ÎÒÓÃWinamp½«mp3Îļþͨ¹ýWinamp±¾ÉíµÄDisk Writer Plug-in²å¼þÖ±½Ó½«mp3ת»¯³É44λµÄ²¨Îļþ£¨Í¨³£Îª40-70M´óС£©£¬È»ºóÔÚÓÃÒ»¸ö½ÐgoldwaveµÄÈí¼þ£¨ÎÒÍüÁË´ÓʲôµØ·½ÏÂÔصÄÁË£©½«Æäת»¯Îª16λµÄµ¥ÉùµÀ²¨Îļþ£¨Í¨³£4-7M´óС£©¡£ÖÁÓÚÌáʾÓïÒô£¬ÎÒÔòÊÇʹÓÃwindows×Ô´øµÄ¼Òô»ú³ÌÐòͨ¹ýÂó¿Ë·ç¼ÖƵġ£ µ±Óû§ÌýÍêÌáʾÓïÒôºó£¬ËûÃǻᰴ¼üÀ´µã¸è»òÁôÑÔ£¬¶øÓû§µÄ°´¼ü»á¼¤·¢TApdTapiDeviceµÄOnDTMFʼþ£¬ÎÒÃǾͿÉÒÔÔÚÕâ¸öʼþÖж԰´¼ü½øÐд¦Àí£¬ÏÂÃæ¾ÍÊÇ´¦Àí¹ý³Ì´úÂ룺 procedure TFrmMain.ApdTapiDeviceTapiDTMF(CP: TObject; Digit: Char; ErrorCode: Integer); begin if (Digit = '') or (Digit = ' ') then Exit; LBSysInfo.Items.Add('dtmf:°´¼ü=' + Digit); CurrentCommand := CurrentCommand + Digit; {¼òµ¥×´Ì¬»ú} if Digit = '#' then begin if CurrentCommand = '*#' then begin CurrentCommand := ''; ApdTapiDevice.MaxMessageLength := 30; //×¼Ç¼ʱ¼ä30Ãë ApdTapiDevice.InterruptWave := False; //°´¼ü²»ÄÜÖжÏÌáʾÓïÒôµÄ²¥·Å ApdTapiDevice.PlayWaveFile('recordhint.wav');//²¥·Å¼ÒôÌáʾÓïÒô CurrentState := csRecording; Exit; end; if CommandList.values[CurrentCommand] <> '' then begin ApdTapiDevice.PlayWaveFile(CommandList.values[CurrentCommand]); LBSysInfo.Items.Add(Format('%s %s ÕýÔÚ²¥·Å %s', [ApdTapiDevice.calleridname, apdtapidevice.callerid, CommandList.values[CurrentCommand]])); end else begin //²¥·Å´íÎóÌáʾÓïÒô£¬²¢ÒªÇóÓû§ÖØÐÂÊäÈëÃüÁî ApdTapiDevice.PlayWaveFile('errorno.wav'); LBSysInfo.Items.Add(Format('%s %s ÊäÈëÁË´íÎóµÄºÅÂë', [ApdTapiDevice.calleridname, apdtapidevice.callerid])); end; //ÖØÖÃÃüÁîΪ¿Õ CurrentCommand := ''; end; end; ³ÌÐò¶Ô°´¼ü½øÐÐÅжϣ¨°´¼ü¶ÔÓ¦ÓÚdigit²ÎÊý£©£¬Èç¹ûÊäÈëµÄΪ¡¯*#¡¯¼ü£¬¾Í½øÈë¼Òô¹¦ÄÜ£¬ÔÚ¼ÒôÇ°ÏȲ¥·ÅÌáʾÓïÒô£¬¿ÉÒÔ¸æËßÓû§ÁôÑÔ³¤¶ÈΪ30Ã룬ȻºóÉèÖõ±Ç°×´Ì¬ÎªcsRecording£¬ÓÐÈË¿ÉÄÜÒªÎÊ£¬Ã»¿´µ½ÓÃÀ´Â¼ÒôµÄ´úÂëѽ£¬Õⲿ·ÖÆäʵÊÇʵÏÖÔÚÁíÍâµÄʼþÖеģ¬ÎÒÃÇÉÔºó¾Í»á½²µ½¡£ÔÙÀ´¿´µã¸è²¿·Ö£¬Í¬ÑùµÄ¸ù¾Ý°´¼üµÄ×éºÏÔÚÏÈÇ°¼ÓÔؽøCommandListµÄ×Ö·û´®ÁбíÖвéÕÒÏàÆ¥ÅäµÄ¸èÇú£¬Èç¹ûÓÐÏàÓ¦µÄ¸èÇú¾Í²¥·Å£¬·ñÔò²¥·Å´íÎóÌáʾÓïÒô£¬ÌáʾÓû§ÖØÐÂÊäÈëÃüÁȻºó½«°´¼üÇå¿ÕµÈ´ýÖØÐÂÊäÈë¡£ÁíÍâ×¢ÒâÔÚʼþµÄÈÕÖ¾¼Ç¼ÖÐÎҼǼÁËApdTapiDevice.calleridnameºÍCallerIDµÄÊôÐÔ£¬ËüÃǶÔÓ¦µÄÊÇ´òÈëµç»°µÄºÅÂ룬²»¹ýÕâÏÄÜÖ»¶Ô¿ªÍ¨ÁËÀ´µçÏÔʾ¹¦Äܵĵ绰ºÅÂë²ÅÓÐЧ£¬Í¨¹ý¶Ô´òÈëµç»°ºÅÂëÐÅÏ¢µÄ´¦Àí£¬ÎÒÃÇ¿ÉÒÔÌṩһЩ¶îÍâµÄ¹¦ÄÜ£¬²»¹ýÕâÊÇÌâÍâ»°ÁË¡£ Ç°ÃæÌáµ½ÁËÔÚ°´¼ü´¦ÀíʼþÖÐÎÒÃDz¢Ã»ÓнøÐÐÁôÑԵļÖƹ¦ÄÜ£¬ÕâÖ÷ÒªÊÇÒòΪÎÒÃÇÒª±£Ö¤ÁôÑÔÌáʾÓïÒô²»±»°´¼üÖжϣ¨É趨Interruptwave:=false£©£¬Òò´Ë°ÑÁôÑÔ¼Öƹ¦Äܷŵ½ÁËTApdTapiDeviceµÄOnWaveNotifyʼþÖÐÁË£¬Õâ¸öʼþ¿ÉÒÔÌáʾ²¨Îļþ²¥·ÅµÄ״̬£¬±ÈÈç²¥·Å½áÊøºÍ¼ÒôËùÐèÉùÒôÊý¾Ý×¼±¸×´Ì¬µÈ£¬ÔÚ±¾³ÌÐòÖÐÎÒÃÇÐèÒªÔÚÌáʾÓïÒô²¥·Å½áÊøºó£¬¿ªÊ¼¼Ç¼ÁôÑÔ£¬²¢ÔÚÁôÑÔÉùÒôÊý¾Ý×¼±¸ºÃºó£¬½«Æä±£´æµ½´ÅÅÌÎļþÖС£ÏÂÃæÊÇ´¦Àí¹ý³ÌµÄÁ÷³Ì£º procedure TFrmMain.ApdTapiDeviceTapiWaveNotify(CP: TObject; Msg: TWaveMessage); var TimeStr: string; FileName: string; begin //¾ö²»ÄÜÔÚcaseÍâ×öºÄʱµÄ²Ù×÷ case Msg of waPlayOpen: LBSysInfo.Items.Add('wavnotify:²¥·Å¿ªÊ¼'); waPlayDone: begin LBSysInfo.Items.Add('wavnotify:²¥·Å½áÊø'); if CurrentState = csRecording then begin try ¡¡¡¡¡¡¡¡¡¡¡¡//µÈ´ý²¨É豸״̬ΪwsIdleÔÙ¿ªÊ¼Â¼Òô while ApdTapiDevice.WaveState <> wsIdle do Application.ProcessMessages; ApdTapiDevice.InterruptWave := True; ApdTapiDevice.StartWaveRecord; LBSysInfo.Items.Add('dtmf:¼Òô³É¹¦'); except LBSysInfo.Items.Add('dtmf:¼Òôʧ°Ü'); end; end; end; waPlayClose: LBSysInfo.Items.Add('wavnotify:²¥·Å¹Ø±Õ'); waRecordOpen: LBSysInfo.Items.Add('wavnotify:¼Òô¿ªÊ¼'); waDataReady: begin LBSysInfo.Items.Add('wavnotify:Êý¾Ý×¼±¸'); TimeSeparator := '-'; FileName := DateTimeToStr(Now) + '.wav'; try ApdTapiDevice.SaveWaveFile(ExtractFilePath(ParamStr(0)) + 'record\' + FileName, True); LBSysInfo.Items.Add('wavNotify:±£´æÉùÒôÎļþ ' + FileName); except LBSysInfo.Items.Add('wavnotify:±£´æÉùÒôÎļþʧ°Ü'); end; end; waRecordClose: begin LBSysInfo.Items.Add('wavnotify:¼Ç¼ÉùÒô½áÊø'); CurrentState := csWaiting; ActionCancelExecute(nil); Timer1.Enabled := True; end; end; end; Õû¸öÁ÷³Ì¾ÍÊÇͨ¹ýÒ»¸öCaseÓï¾äÀ´Åжϵ±Ç°ÉùÒô״̬£¬Èç¹ûΪwaPlayDone(²¥·ÅÍê±Ï)£¬Í¬ÊÂCurrentStatusΪcsRecordingµÄ»°£¬¾Íµ÷ÓÃStartWaveRecord·½·¨À´¼Ç¼ÉùÒô¡£¶øµ±MsgΪwaDataReady״̬ʱ£¬±íÃ÷¼ÒôÊý¾ÝÒѾ¿ÉÒÔ´æÅÌÁË£¬Õâʱ¸ù¾Ýµ±Ç°Ê±¼äÉú³ÉÒ»¸öÎļþÃû£¬²¢½«Êý¾Ý±£´æΪ²¨Îļþ¡£¶øµ±Â¼Òô½áÊøºó£¬ÎÒÃǾÍÐèÒªµ÷ÓÃActionCancelExecute(nil)À´¹Ò¶Ïµç»°£¬²¢½«×´Ì¬ÉèÖÃΪcsWaitingÀ´µÈ´ýÏ´νÓÈ룬עÒâµÄÔÚ´úÂë×îºó£¬ÎÒÃǽ«Ò»¸öTTimer¿Ø¼þ¼¤»îÁË¡£Õâ¸öTTimer¿Ø¼þµÄʱ¼ä¼ä¸ôIntervalÉèÖÃΪ8Ã룬ͬʱÆäOnTimerʼþ´úÂëÈçÏ£º procedure TFrmMain.Timer1Timer(Sender: TObject); begin try ¡¡¡¡//Ó¦´ðµç»° ActionAnswerExecute(nil); CurrentState := csWaiting; Timer1.Enabled := False; except end; end; ÕâÑùÉèÖõÄÔÒòÔÚÓÚ£¬µ±µ÷ÓÃCancelCall·½·¨À´¹Ò¶Ïµç»°ºó£¬TAPIÉ豸ÐèÒª8ÃëÀ´»Ö¸´Õý³£×´Ì¬£¬Èç¹ûÁ¢¿ÌÖ´ÐÐAutoAnswerµÄ»°£¬Õâ¸ö·½·¨¾Í»áʧЧ£¬ÎÞ·¨ÕýÈ·¼à¿Øµç»°½ÓÈ룬Òò´ËÒªÓÃTTimerÀ´¿ØÖƻָ´µç»°Ó¦´ðµÄʱ¼ä¡£ Òì³£´¦Àí ÒªÏë³ÌÐò·Ç³£½¡×³µÄ·´¸´Ó¦´ðµç»°½ÓÈ룬ÎÒÃDZØÐë¶ÔÓû§Í»È»¹Ò¶Ïµç»°½øÐд¦Àí£¬Óû§¶Ï¿ªµÄʼþ»á¼¤·¢¿Ø¼þµÄOnTapiStatusʼþ£¬µ±Óû§¹Ò¶Ïµç»°Ê±£¬ÎÒÃÇÒª×öµÄÊÇÈç¹ûµ±Ç°»¹ÔÚ¼Òô£¬¾Íֹͣ¼Òô£¬Èç¹ûÊÇÔÚ²¥·Å¸èÇú£¬¾Í¹Ò¶Ïµç»°£¬È»ºóÉèÖÃTTimerÉúЧ£¬ÖØнøÈëµç»°Ó¦´ð״̬¡£ÏÂÃæ¾ÍÊÇÕû¸ö´¦Àí¹ý³ÌµÄ´úÂ룺 procedure TFrmMain.ApdTapiDeviceTapiStatus(CP: TObject; First, Last: Boolean; Device, Message, Param1, Param2, Param3: Cardinal); begin if (Message = Line_CallState) then begin case Param1 of LineCallState_Disconnected: begin LBSysInfo.Items.Add('status:disconnected from remote modem'); if CurrentState = csRecording then begin ApdTapiDevice.StopWaveRecord; Exit; end; CurrentState := csDisconnected; ActionCancelExecute(nil); Timer1.Enabled := True; end; end; end; end; ½øÒ»²½ÍêÉÆ µ±Â¼ÒôÍê±Ïºó£¬ÎÒÃÇÏëÌýһϵ绰ÁôÑԵĻ°£¬¿ÉÒÔÔÚ´°ÌåÉÏ·ÅÖÃÒ»¸ö´ò¿ªÎļþ¶Ô»°¿ò£¬ÓÃÏÂÃæ´úÂëʵÏÖ£º procedure TFrmMain.ActionPlayRecExecute(Sender: TObject); var FrmPlay: TFrmPlayRec; begin DlgOpenRec.InitialDir := ExtractFilePath(ParamStr(0)) + 'Record\'; if DlgOpenRec.Execute then //²¥·ÅÉùÒô¼Ç¼Îļþ ShellExecute(Application.Handle, PChar('open'), PChar(DlgOpenRec.FileName), nil, nil, SW_SHOW); end; ÁíÍ⣬Èç¹û´ó¼Ò×ÔÐÅ×Ô¼ºµÄ¸èºí²»±ÈÄÇЩ¸èÐDzîµÄ»°£¬ÍêÈ«¿ÉÒÔ¼ÖÆ×Ô¼ºµÄ¸èÉù£¬È»ºó²¥·Å¸øÄãµÄÅ®ÅóÓÑ»òÅóÓÑÌý£¬Ò²ÐíЧ¹û¸ü°ô£º£©¡£ ×îºó£¬ÎÒҪ˵µÄ¾ÍÊÇTelephone APIËùÄÜÌṩµÄ¹¦ÄÜÔ¶Ô¶²»Ö¹±¾ÎÄÖÐËùÌáµ½µÄ£¬¸ÐÐËȤµÄÅóÓÑ¿ÉÒÔ½øÒ»²½²éÔÄÏà¹Ø×ÊÁÏÀ´Ñо¿¡£ ×îºó£¬ÒªËµµÄÊÇTurbo PowerÒѾ²»ÔÙ¿ª·¢Async ProÁË£¬Ëü°ÑËùÓеÄÔ´Â붼·Åµ½ÁËSourceforgeÉϹ²Ïí£¬´ó¼Ò¿ÉÒÔµ½SourceForgeÉÏÏÂÔØ¡£ |