I'm a noob to C#, so please sorry me for bad coding. I'm trying to make this application that while a call is happening, it gets the phone number of the caller and it will use it to take information from a CRM, and after that, it creates a Balloon from NotifyIcon that shows the information about the caller. The CRM connection and the search-by telephone number is working fine, same for the NotifyIcon, but all the TAPI part is not working. No events are raised when I try with my telephone to call my office Zoiper5 number.
Here is the class where 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();
}
}
}
}
I really don't know where to search anymore; I've read many articles here on SOF, and other site talking about almost the same thing, but still, I haven't resolved.
Thanks for any help.