如何获取来电号码?
用 C# 获取来电号码的任何方法是什么?
例如,要调用 Dial,我使用以下代码:
using System;
using System.IO;
using System.Net;
using System.Text;
public class FileConverter
{
static void Main(string[] args)
{
WebRequest request = WebRequest.Create("http://xx.xx.xx.xx/CGI/Execute HTTP/1.1");
request.Method = "POST";
string postData = @"XML=<CiscoIPPhoneExecute><ExecuteItem Priority=""0"" URL=""Dial:1566""/> </CiscoIPPhoneExecute>";
byte[] byteArray = Encoding.UTF8.GetBytes(postData);
request.ContentType = "text/xml; charset=\"UTF-8\"";
request.ContentLength = byteArray.Length;
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
Console.WriteLine(((HttpWebResponse)response).StatusDescription);
dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
Console.WriteLine(responseFromServer);
reader.Close();
dataStream.Close();
response.Close();
}
}