【问题标题】:TAPI 3.0 events non raisingTAPI 3.0 事件非引发
【发布时间】: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


    【解决方案1】:

    问题解决了。我错过了初始化的一部分。在来电事件中,您必须已初始化要接收通知的线路,如此处所述ITTAPI::RegisterCallNotifications method 您可以使用

    tapi.RegisterCallNotifications(address, true, true, TapiConstants.TAPIMEDIATYPE_AUDIO, 2);
    

    您可以选择一个ITAddress,也可以选择tapi.Address as ITCollection 中的所有地址并为每个地址执行RegisterCallNotifications。在第一种情况下,只有当来电定向到您指定的地址行时,您才会收到通知,在第二种情况下,您将在任何地址有来电时收到通知。

    这个示例项目对我帮助很大: TAPI 3.0 Application development using C#.NET

    【讨论】:

      【解决方案2】:

      我不确定您是否正在注册您想要的活动。我建议使用此处找到的 Julmar Tapi 3.0 .Net 包装器:https://github.com/markjulmar/itapi3。当您使用此包装器初始化 Tapi 时,它会注册所有事件并查找所有可用设备。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-02-19
        • 1970-01-01
        • 2020-12-14
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多