2015-12-04 24 views
0

我一直在嘗試使用C#編寫一個呼叫應用程序,使我能夠通過調制解調器從PC進行固定電話呼叫。我發現了ATAPI和TAPI,但到目前爲止,我還沒有能夠與這些庫進行通話。任何人都可以給我示例代碼,只是打個電話和談話? 到目前爲止,我已經設法找到我的調制解調器,但我不能接收主叫號碼或接聽和撥打的完整電話(通話和接收數據)使用Tapi在C#中建立固定電話呼叫

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.IO.Ports; 
using JulMar.Atapi; 

namespace CompanyX_Libaray 
{ 
    class Program 
    { 
     public static void Main() 
     { 
      TapiManager a = new TapiManager("test"); 
      a.Initialize(); 
      String modem = "Conexant USB CX93010 ACF Modem"; 
      TapiLine li=null; 
      TapiLine[] l = a.Lines; 
      foreach (TapiLine line in l) 
      { 
       Console.WriteLine(line.ToString()); 
       if (line.ToString().Equals(modem)) 
       { 
        li = line; 
        break; 
       } 
      } 
      li.Open(MediaModes.DataModem); 
      //li.Ringing += new EventHandler<RingEventArgs>(li_Ringing); 
      //li.CallInfoChanged += new EventHandler<CallInfoChangeEventArgs>(li_CallInfoChanged); 
      //li.Changed += new EventHandler<LineInfoChangeEventArgs>(li_Changed); 
      li.NewCall += li_NewCall; 
     } 
     static void li_NewCall(object sender, NewCallEventArgs e) 
     { 
      Console.WriteLine(e.Call.CalledName); 
      Console.WriteLine(e.Call.CalledId); 
      Console.WriteLine(e.Call.CallerId); 
      Console.WriteLine(e.Call.CallerName); 
      Console.WriteLine(e.Call.CallData); 
      Console.WriteLine(e.Call.Address); 
      Console.WriteLine(e.Call.ConnectedId); 
      Console.WriteLine(e.Call.ConnectedName); 
      Console.WriteLine(e.Call.RelatedId); 
      Console.WriteLine(e.Call.Id); 
      Console.WriteLine(e.Call.CallOrigin); 
     } 
    } 
} 
+1

你試過的代碼是什麼?你遇到了什麼錯誤? –

回答

0

如果你有興趣在撥號命令,你應該做的步驟如下: -

  • 找到行
  • 打開支持的模式
  • 待辦事項MakeCall函數命令

    行10

    li.MakeCall(dialNumber);