如:我想写一个小程序直接拨打10086
谢谢!
6 个解决方案
#1
http://tapiex.com/
+modem
+modem
#2
csdn上都有的
下载地址:
http://download.csdn.net/detail/jiangyongtao/1071579
下载地址:
http://download.csdn.net/detail/jiangyongtao/1071579
#3
这个还真没做过,帮楼主顶一下。
#4
软件电话,弄过,不过是呼叫中心的那类,有现成的接口。只能帮顶
#5
帮顶~
#6
利用TAPI 拨打电话,下面的代码汲及到我的一些业务处理,仔细研究后提取你需要的代码:
using System;
using TAPI3Lib;
using GZITMS.SysCommon;
using GZITMS.TEL.UI;
namespace GZITMS.TEL.Business {
/// <summary>
/// TAPITelphone 的摘要说明。
/// </summary>
public class TAPITelphone {
private const int mtAudio = 8;
private const int mtModem = 16;
private delegate void CloseResource();
private CallForm callForm;
private TAPIClass tapiObj;
private ITBasicCallControl newCall;
private int regResult;
private ITAddress modemAddr;
public ITAddress ModemAddress {
get { return modemAddr; }
}
public TAPITelphone(CallForm form) {
callForm = form;
}
public void InitializeTapi3() {
try {
tapiObj = new TAPIClass();
int mediaTypes = 0;
tapiObj.Initialize();
ITCollection addrCollection = (ITCollection)tapiObj.Addresses;
ITMediaSupport mediaSupport;
foreach(ITAddress addr in addrCollection) {
if(addr.State == ADDRESS_STATE.AS_INSERVICE) {
mediaSupport = (ITMediaSupport)addr;
mediaTypes = mediaSupport.MediaTypes;
if((mediaTypes & mtModem) == mtModem) {
if((mediaTypes & mtAudio) == mtAudio) {
modemAddr = addr;
break;
}
}
}
}
tapiObj.ITTAPIEventNotification_Event_Event += new ITTAPIEventNotification_EventEventHandler(tapiObj_ITTAPIEventNotification_Event_Event);
if(null != modemAddr) {
regResult = tapiObj.RegisterCallNotifications(modemAddr,true,true,TapiConstants.TAPIMEDIATYPE_AUDIO,2);
}
tapiObj.EventFilter = (int)(TAPI_EVENT.TE_CALLSTATE);
} catch(Exception ex) {
Global.mainLog.Error("初始化Modem出错",ex);
}
}
private void tapiObj_ITTAPIEventNotification_Event_Event(TAPI_EVENT TapiEvent, object pEvent) {
try {
switch(TapiEvent) {
case TAPI_EVENT.TE_CALLSTATE :
ITCallStateEvent icse = (ITCallStateEvent)pEvent;
ITCallInfo ici = icse.Call;
switch(ici.CallState) {
case CALL_STATE.CS_DISCONNECTED :
if(null != callForm) {
callForm.BeginInvoke(new CloseResource(HandUpTelphone));
}
break;
}
break;
}
} catch(Exception ex) {
Global.mainLog.Error("ITTAPIEventNotification_Event出错",ex);
}
}
public int DialTelphone(string number) {
int type = 0;
try {
if(null == tapiObj) {
InitializeTapi3();
}
if(null == modemAddr) {
if(null != callForm) {
callForm.Close();
callForm.Dispose();
}
return type;
}
newCall = modemAddr.CreateCall(number,TapiConstants.LINEADDRESSTYPE_PHONENUMBER,
TapiConstants.TAPIMEDIATYPE_DATAMODEM);
newCall.Connect(false);
type = 1;
} catch(Exception ex) {
Global.mainLog.Error("通过Modem拨打电话出错",ex);
}
return type;
}
public void HandUpTelphone() {
try {
if(null != newCall) {
newCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
newCall = null;
}
modemAddr = null;
if(null != tapiObj) {
tapiObj.UnregisterNotifications(regResult);
tapiObj.Shutdown();
tapiObj = null;
}
if(null != callForm) {
callForm.State = PhoneState.HangUp;
callForm.Close();
callForm.Dispose();
}
} catch(Exception ex) {
Global.mainLog.Error("挂断电话出错",ex);
}
}
}
}
主要是这个方法:public int DialTelphone(string number) 实现拨号。
InitializeTapi3();//初始化TAPI的一些设置
using System;
using TAPI3Lib;
using GZITMS.SysCommon;
using GZITMS.TEL.UI;
namespace GZITMS.TEL.Business {
/// <summary>
/// TAPITelphone 的摘要说明。
/// </summary>
public class TAPITelphone {
private const int mtAudio = 8;
private const int mtModem = 16;
private delegate void CloseResource();
private CallForm callForm;
private TAPIClass tapiObj;
private ITBasicCallControl newCall;
private int regResult;
private ITAddress modemAddr;
public ITAddress ModemAddress {
get { return modemAddr; }
}
public TAPITelphone(CallForm form) {
callForm = form;
}
public void InitializeTapi3() {
try {
tapiObj = new TAPIClass();
int mediaTypes = 0;
tapiObj.Initialize();
ITCollection addrCollection = (ITCollection)tapiObj.Addresses;
ITMediaSupport mediaSupport;
foreach(ITAddress addr in addrCollection) {
if(addr.State == ADDRESS_STATE.AS_INSERVICE) {
mediaSupport = (ITMediaSupport)addr;
mediaTypes = mediaSupport.MediaTypes;
if((mediaTypes & mtModem) == mtModem) {
if((mediaTypes & mtAudio) == mtAudio) {
modemAddr = addr;
break;
}
}
}
}
tapiObj.ITTAPIEventNotification_Event_Event += new ITTAPIEventNotification_EventEventHandler(tapiObj_ITTAPIEventNotification_Event_Event);
if(null != modemAddr) {
regResult = tapiObj.RegisterCallNotifications(modemAddr,true,true,TapiConstants.TAPIMEDIATYPE_AUDIO,2);
}
tapiObj.EventFilter = (int)(TAPI_EVENT.TE_CALLSTATE);
} catch(Exception ex) {
Global.mainLog.Error("初始化Modem出错",ex);
}
}
private void tapiObj_ITTAPIEventNotification_Event_Event(TAPI_EVENT TapiEvent, object pEvent) {
try {
switch(TapiEvent) {
case TAPI_EVENT.TE_CALLSTATE :
ITCallStateEvent icse = (ITCallStateEvent)pEvent;
ITCallInfo ici = icse.Call;
switch(ici.CallState) {
case CALL_STATE.CS_DISCONNECTED :
if(null != callForm) {
callForm.BeginInvoke(new CloseResource(HandUpTelphone));
}
break;
}
break;
}
} catch(Exception ex) {
Global.mainLog.Error("ITTAPIEventNotification_Event出错",ex);
}
}
public int DialTelphone(string number) {
int type = 0;
try {
if(null == tapiObj) {
InitializeTapi3();
}
if(null == modemAddr) {
if(null != callForm) {
callForm.Close();
callForm.Dispose();
}
return type;
}
newCall = modemAddr.CreateCall(number,TapiConstants.LINEADDRESSTYPE_PHONENUMBER,
TapiConstants.TAPIMEDIATYPE_DATAMODEM);
newCall.Connect(false);
type = 1;
} catch(Exception ex) {
Global.mainLog.Error("通过Modem拨打电话出错",ex);
}
return type;
}
public void HandUpTelphone() {
try {
if(null != newCall) {
newCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
newCall = null;
}
modemAddr = null;
if(null != tapiObj) {
tapiObj.UnregisterNotifications(regResult);
tapiObj.Shutdown();
tapiObj = null;
}
if(null != callForm) {
callForm.State = PhoneState.HangUp;
callForm.Close();
callForm.Dispose();
}
} catch(Exception ex) {
Global.mainLog.Error("挂断电话出错",ex);
}
}
}
}
主要是这个方法:public int DialTelphone(string number) 实现拨号。
InitializeTapi3();//初始化TAPI的一些设置
#1
http://tapiex.com/
+modem
+modem
#2
csdn上都有的
下载地址:
http://download.csdn.net/detail/jiangyongtao/1071579
下载地址:
http://download.csdn.net/detail/jiangyongtao/1071579
#3
这个还真没做过,帮楼主顶一下。
#4
软件电话,弄过,不过是呼叫中心的那类,有现成的接口。只能帮顶
#5
帮顶~
#6
利用TAPI 拨打电话,下面的代码汲及到我的一些业务处理,仔细研究后提取你需要的代码:
using System;
using TAPI3Lib;
using GZITMS.SysCommon;
using GZITMS.TEL.UI;
namespace GZITMS.TEL.Business {
/// <summary>
/// TAPITelphone 的摘要说明。
/// </summary>
public class TAPITelphone {
private const int mtAudio = 8;
private const int mtModem = 16;
private delegate void CloseResource();
private CallForm callForm;
private TAPIClass tapiObj;
private ITBasicCallControl newCall;
private int regResult;
private ITAddress modemAddr;
public ITAddress ModemAddress {
get { return modemAddr; }
}
public TAPITelphone(CallForm form) {
callForm = form;
}
public void InitializeTapi3() {
try {
tapiObj = new TAPIClass();
int mediaTypes = 0;
tapiObj.Initialize();
ITCollection addrCollection = (ITCollection)tapiObj.Addresses;
ITMediaSupport mediaSupport;
foreach(ITAddress addr in addrCollection) {
if(addr.State == ADDRESS_STATE.AS_INSERVICE) {
mediaSupport = (ITMediaSupport)addr;
mediaTypes = mediaSupport.MediaTypes;
if((mediaTypes & mtModem) == mtModem) {
if((mediaTypes & mtAudio) == mtAudio) {
modemAddr = addr;
break;
}
}
}
}
tapiObj.ITTAPIEventNotification_Event_Event += new ITTAPIEventNotification_EventEventHandler(tapiObj_ITTAPIEventNotification_Event_Event);
if(null != modemAddr) {
regResult = tapiObj.RegisterCallNotifications(modemAddr,true,true,TapiConstants.TAPIMEDIATYPE_AUDIO,2);
}
tapiObj.EventFilter = (int)(TAPI_EVENT.TE_CALLSTATE);
} catch(Exception ex) {
Global.mainLog.Error("初始化Modem出错",ex);
}
}
private void tapiObj_ITTAPIEventNotification_Event_Event(TAPI_EVENT TapiEvent, object pEvent) {
try {
switch(TapiEvent) {
case TAPI_EVENT.TE_CALLSTATE :
ITCallStateEvent icse = (ITCallStateEvent)pEvent;
ITCallInfo ici = icse.Call;
switch(ici.CallState) {
case CALL_STATE.CS_DISCONNECTED :
if(null != callForm) {
callForm.BeginInvoke(new CloseResource(HandUpTelphone));
}
break;
}
break;
}
} catch(Exception ex) {
Global.mainLog.Error("ITTAPIEventNotification_Event出错",ex);
}
}
public int DialTelphone(string number) {
int type = 0;
try {
if(null == tapiObj) {
InitializeTapi3();
}
if(null == modemAddr) {
if(null != callForm) {
callForm.Close();
callForm.Dispose();
}
return type;
}
newCall = modemAddr.CreateCall(number,TapiConstants.LINEADDRESSTYPE_PHONENUMBER,
TapiConstants.TAPIMEDIATYPE_DATAMODEM);
newCall.Connect(false);
type = 1;
} catch(Exception ex) {
Global.mainLog.Error("通过Modem拨打电话出错",ex);
}
return type;
}
public void HandUpTelphone() {
try {
if(null != newCall) {
newCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
newCall = null;
}
modemAddr = null;
if(null != tapiObj) {
tapiObj.UnregisterNotifications(regResult);
tapiObj.Shutdown();
tapiObj = null;
}
if(null != callForm) {
callForm.State = PhoneState.HangUp;
callForm.Close();
callForm.Dispose();
}
} catch(Exception ex) {
Global.mainLog.Error("挂断电话出错",ex);
}
}
}
}
主要是这个方法:public int DialTelphone(string number) 实现拨号。
InitializeTapi3();//初始化TAPI的一些设置
using System;
using TAPI3Lib;
using GZITMS.SysCommon;
using GZITMS.TEL.UI;
namespace GZITMS.TEL.Business {
/// <summary>
/// TAPITelphone 的摘要说明。
/// </summary>
public class TAPITelphone {
private const int mtAudio = 8;
private const int mtModem = 16;
private delegate void CloseResource();
private CallForm callForm;
private TAPIClass tapiObj;
private ITBasicCallControl newCall;
private int regResult;
private ITAddress modemAddr;
public ITAddress ModemAddress {
get { return modemAddr; }
}
public TAPITelphone(CallForm form) {
callForm = form;
}
public void InitializeTapi3() {
try {
tapiObj = new TAPIClass();
int mediaTypes = 0;
tapiObj.Initialize();
ITCollection addrCollection = (ITCollection)tapiObj.Addresses;
ITMediaSupport mediaSupport;
foreach(ITAddress addr in addrCollection) {
if(addr.State == ADDRESS_STATE.AS_INSERVICE) {
mediaSupport = (ITMediaSupport)addr;
mediaTypes = mediaSupport.MediaTypes;
if((mediaTypes & mtModem) == mtModem) {
if((mediaTypes & mtAudio) == mtAudio) {
modemAddr = addr;
break;
}
}
}
}
tapiObj.ITTAPIEventNotification_Event_Event += new ITTAPIEventNotification_EventEventHandler(tapiObj_ITTAPIEventNotification_Event_Event);
if(null != modemAddr) {
regResult = tapiObj.RegisterCallNotifications(modemAddr,true,true,TapiConstants.TAPIMEDIATYPE_AUDIO,2);
}
tapiObj.EventFilter = (int)(TAPI_EVENT.TE_CALLSTATE);
} catch(Exception ex) {
Global.mainLog.Error("初始化Modem出错",ex);
}
}
private void tapiObj_ITTAPIEventNotification_Event_Event(TAPI_EVENT TapiEvent, object pEvent) {
try {
switch(TapiEvent) {
case TAPI_EVENT.TE_CALLSTATE :
ITCallStateEvent icse = (ITCallStateEvent)pEvent;
ITCallInfo ici = icse.Call;
switch(ici.CallState) {
case CALL_STATE.CS_DISCONNECTED :
if(null != callForm) {
callForm.BeginInvoke(new CloseResource(HandUpTelphone));
}
break;
}
break;
}
} catch(Exception ex) {
Global.mainLog.Error("ITTAPIEventNotification_Event出错",ex);
}
}
public int DialTelphone(string number) {
int type = 0;
try {
if(null == tapiObj) {
InitializeTapi3();
}
if(null == modemAddr) {
if(null != callForm) {
callForm.Close();
callForm.Dispose();
}
return type;
}
newCall = modemAddr.CreateCall(number,TapiConstants.LINEADDRESSTYPE_PHONENUMBER,
TapiConstants.TAPIMEDIATYPE_DATAMODEM);
newCall.Connect(false);
type = 1;
} catch(Exception ex) {
Global.mainLog.Error("通过Modem拨打电话出错",ex);
}
return type;
}
public void HandUpTelphone() {
try {
if(null != newCall) {
newCall.Disconnect(DISCONNECT_CODE.DC_NORMAL);
newCall = null;
}
modemAddr = null;
if(null != tapiObj) {
tapiObj.UnregisterNotifications(regResult);
tapiObj.Shutdown();
tapiObj = null;
}
if(null != callForm) {
callForm.State = PhoneState.HangUp;
callForm.Close();
callForm.Dispose();
}
} catch(Exception ex) {
Global.mainLog.Error("挂断电话出错",ex);
}
}
}
}
主要是这个方法:public int DialTelphone(string number) 实现拨号。
InitializeTapi3();//初始化TAPI的一些设置