【发布时间】:2018-11-16 19:05:07
【问题描述】:
我是 C# 的菜鸟,所以对于糟糕的编码请见谅。 我正在尝试使此应用程序在呼叫发生时获取呼叫者的电话号码,并将使用它从 CRM 获取信息,然后从 NotifyIcon 创建一个显示有关信息的气球呼叫者,召集者。 CRM 连接和按电话号码搜索工作正常,NotifyIcon 也是如此,但所有 TAPI 部分都不起作用。当我尝试用我的电话拨打我办公室的 Zoiper5 号码时,没有引发任何事件。
这是 TAPI 所在的类:
using System;
using System.Windows.Forms;
using TAPI3Lib;
namespace CallHelper
{
class TapiApplication : ApplicationContext
{
private static NLog.Logger logger =
NLog.LogManager.GetCurrentClassLogger();
private TAPIClass tapi;
private string number;
private Notification notification;
private ITAddress address;
public TapiApplication()
{
try
{
tapi = new TAPIClass();
tapi.Initialize();
//Notification.cs : handle the NotifyIcon
notification = new Notification();
tapi.ITTAPIEventNotification_Event_Event += new
ITTAPIEventNotification_EventEventHandler(callNotificationHandler);
tapi.EventFilter = (int) (TAPI_EVENT.TE_CALLNOTIFICATION);
}
catch (Exception ex)
{
logger.Error(ex.Message);
}
}
private void callNotificationHandler(TAPI_EVENT TapiEvent, object
pEvent)
{
try
{
ITCallNotificationEvent cne = pEvent as ITCallNotificationEvent;
number = cne.Call.get_CallInfoString(CALLINFO_STRING.CIS_CALLEDIDNUMBER);
//creates the balloon containing the information of the caller
notification.showBalloon(number);
}
catch (Exception ex)
{
logger.Error(ex.Message);
tapi.Shutdown();
}
}
}
}
我真的不知道去哪里找了;我在这里阅读了很多关于 SOF 的文章,以及其他网站谈论几乎相同的事情,但我仍然没有解决。
感谢您的帮助。
【问题讨论】:
标签: c# events event-handling notifyicon tapi