0

I am using the TAPI 2.0 wrapper from JulMar (https://atapi.codeplex.com/) and I'm having trouble with it.

The Initialization

void initTAPI()
    {

        myTAPI = new TapiManager("GetCaller");

        if (!myTAPI.Initialize())
        {
            MessageBox.Show("FAILED!");
        }else
        {
            name = myTAPI.Lines[0].Name;
            lineName = (myTAPI != null && myTAPI.Lines.Length > 0 ? name : string.Empty);

            foreach(TapiLine line in myTAPI.Lines)
            {
                line.NewCall += this.OnNewCall;
                line.Ringing += this.OnRinging;
                line.CallStateChanged += this.OnCallState;
                line.CallInfoChanged += this.OnCallInfo;
            }

            MessageBox.Show(lineName);

        }
    }

So I get the lineName. When I now dial a number through the program, it fires

OnCallState

private void OnCallState(object sender, CallStateEventArgs e)
    {
        if (InvokeRequired == true)
        {
            this.BeginInvoke(new EventHandler<CallStateEventArgs>(this.OnCallState), new object[] { sender, e });
            return;
        }

        label1.Text = "Outgoing Call...";
    }

But what I actually want to do is to get the number of an incoming call, but OnCallInfo does not get fired.

OnCallInfo

private void OnCallInfo(object sender, CallInfoChangeEventArgs e)
    {
        if (InvokeRequired == true)
        {
            this.BeginInvoke(new EventHandler<CallInfoChangeEventArgs>(this.OnCallInfo), new object[] { sender, e });
            return;
        }

        label1.Text = "Incoming Call...";
    }

It says somehwere, that it only works with x86, so I changed the target but still no success.

PS: I have a call manager (ProCall) installed on the same machine, that tells me when someone calls, so I should be able to get the info in c# as well?

Here is the whole code if someone is interested: http://pastebin.com/Q5W5iGun

PrimuS
  • 2,505
  • 6
  • 33
  • 66

2 Answers2

1

Depending on TSP, you may get call info messages, but TAPI does not force the driver to do this. So some TSP make you get the info yourself. In the Win32 API this is done via lineGetCallInfo.

After a quick look in this atapi wrapper, this happens in the GatherCallInfo method of the TapiCall class. However I can see no way to trigger this manually in this wrapper. You would need to modify the atapi source to make this a public method.

Kris Vanherck
  • 245
  • 1
  • 10
  • Would you mind sharing how a `lineGetCallInfo` would look like? I am fairly new to Listeners in c# as well. Thanks! – PrimuS Oct 28 '16 at 07:42
0

You can use example from TAPI which do the same. The only difference is new line.Monitor() method

foreach (TapiLine line in tapiManager.Lines)
        {
            try 
            {
                line.NewCall += OnNewCall;
                line.CallStateChanged += OnCallStateChanged;
                line.CallInfoChanged += OnCallInfoChanged;
                line.Monitor();
            }
            catch (TapiException ex)
            {
                LogError(ex.Message);
            }
        }

For further reading read this https://atapi.codeplex.com/SourceControl/latest#Atapi/trunk/source/test/TcMon/TapiMonitorForm.cs

Alex Pashkin
  • 301
  • 4
  • 15