AVAYA IP Phone Getting caller id using C#

Nov 8, 2014 at 6:22 AM
Hi,

I don't have enough knowledge about this. I have AVAYA IP Phone, its model and driver details are as below:

1) AVAYA Model 9641G
2) AVAYA IP Office TAPI 2 Service Provider
3) AVAYA IP Office TAPI 3 Service Provider
4) NDIS Proxy TAPI Service Provider
5) TAPI Kernal-Mode Service Provider

I am using Visual Studio 2013 C#.NET, got sample code from different sites, set is connected via network cable, when i run the code it shows 6 lines, one which can be Open (Aztech SoftK56 Data Fax PCI Modem).

added reference to ITapi3, Interop.TAPI3Lib, Atapi
See the below code:
using JulMar.Atapi;

private void Form2_Load(object sender, EventArgs e)
        {
            _mgr.Initialize();  // Find all Tapi devices

            availableLines.Items.Add("None"); // Add no line selected to top of list

            foreach (TapiLine line in _mgr.Lines) //Put all the line devices in list and track status
            {
                availableLines.Items.Add(line.Name);
                
                line.Ringing += this.OnRinging;
                line.CallStateChanged += this.OnCallStateChanged;
            }


        }

        private void telConn_Closed(System.Object eventSender, System.EventArgs eventArgs)
        {
            _mgr.Shutdown();
        }

        private void OnCallStateChanged(object sender, CallStateEventArgs e)
        {

            if (InvokeRequired)
            {
                this.BeginInvoke(new EventHandler<CallStateEventArgs>(this.OnCallStateChanged), new object[] { sender, e });
                return;
            }

        }

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

        }

        private void availableLines_SelectedIndexChanged(object sender, EventArgs e)
        {            
            if (availableLines.SelectedIndex == -1)
            {
                return;
            }


            if (!(gcurrline == null))
            {
                gcurrline.Close(); //Close the previous line
            }

            if (availableLines.SelectedItem != "None")
            {

                gcurrline = _mgr.Lines[(availableLines.SelectedIndex - 1)];
                gcurrline.Open(MediaModes.All); //Open the line
                if (gcurrline.IsOpen.Equals(true))
                {
                    label1.Text = "Opened";
                }
                else
                {
                    label1.Text = "Closed";
                }
            }
        }
Please tell me am i moving to the right direction or not. I want to get Caller ID from incoming call.
also tell me what are the system requirement for this.
Regards