Example #1
0
        /// <summary>
        /// Opens an IBOS3 address by phone number. The number will be taken from a TAPI
        /// event and will be passed to the IBOS3 remote control endpoint to open the address.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            TapiManager tapiManager = new TapiManager("TapiCallMonitor.net");

            if (tapiManager.Initialize() == false)
            {
                Console.WriteLine("No Tapi devices found.");
                Console.ReadLine();
            }
            else
            {
                foreach (TapiLine line in tapiManager.Lines)
                {
                    try
                    {
                        line.NewCall += OnNewCall;
                        line.Monitor();
                    }
                    catch (TapiException ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                Console.WriteLine("Waiting for calls");
                Console.ReadLine();
                tapiManager.Shutdown();
            }
        }
Example #2
0
 protected override void OnStop()
 {
     foreach (TapiLine line in manager.Lines)
     {
         if (line.IsOpen)
         {
             log.Debug("Closing line: " + line.ToString());
             line.Close();
         }
     }
     manager.Shutdown();
 }
Example #3
0
        static void RunCommTest()
        {
            TapiManager mgr = new TapiManager("EnumDevices");

            mgr.Initialize();

            foreach (TapiLine lineEx in mgr.Lines)
            {
                Console.WriteLine(lineEx.Name);
            }

            TapiLine line = mgr.GetLineByName("Conexant D110 MDC V.92 Modem", true);

            if (line != null)
            {
                line.Open(MediaModes.DataModem);
                TapiCall call = line.Addresses[0].MakeCall("2145551212");

                Console.WriteLine(call.GetCommDevice());

                try
                {
                    using (FileStream fs = call.GetCommStream())
                    {
                        byte[] data = ASCIIEncoding.ASCII.GetBytes("Hello");
                        fs.Write(data, 0, data.Length);
                        using (StreamReader sr = new StreamReader(fs))
                        {
                            Console.WriteLine(sr.ReadToEnd());
                        }
                    }
                    call.Drop();
                }
                catch (Exception ex)
                {
                    call.Drop();
                    while (ex != null)
                    {
                        Console.WriteLine("{0}", ex.ToString());
                        ex = ex.InnerException;
                    }
                }
            }
            else
            {
                Console.WriteLine("Not found.");
            }

            Console.ReadLine();
            mgr.Shutdown();
        }
Example #4
0
 /* final cleanup */
 public void Dispose()
 {
     disposeOutgoingCall();
     if (mgr != null)
     {
         if (currentLine != null)
         {
             currentLine.Close();
             currentLine.Dispose();
             App.log("TAPI line - Closed and disposed line");
         }
         mgr.Shutdown();
         App.log("TAPI manager - Shut down");
     }
 }
Example #5
0
        public static void start()
        {
            //            Console.ReadLine();
            while (true)
            {
                //                        {
                if (_mgr.Initialize())
                {
//                _mgr.NewCall += NewCall;
//                _mgr.LineChanged += LineChanged;
//                _mgr.CallInfoChanged += CallInfoChanged;
//                _mgr.CallStateChanged += CallStateChanged;
                    TapiLine line = _mgr.GetLineByName("EXTENSION 200 Keyset", false);

                    if (line != null)
                    {
                        try
                        {
//
                            //line.Monitor();
                            Console.WriteLine("Line: {0} opened!", line.Name);

                            line.NewCall += new EventHandler <NewCallEventArgs>(NewCall);
                            ;
                            line.Changed          += new EventHandler <LineInfoChangeEventArgs>(Changed);
                            line.CallInfoChanged  += new EventHandler <CallInfoChangeEventArgs>(CallInfoChanged);
                            line.CallStateChanged += new EventHandler <CallStateEventArgs>(CallStateChanged);
                            line.AddressChanged   += new EventHandler <AddressInfoChangeEventArgs>(AddressChanged);

                            line.Monitor();
//                            line.Open(line.Capabilities.MediaModes);
                            Console.WriteLine("Monitoring Started!");
                        }
                        catch (TapiException e)
                        {
                            Console.WriteLine(e);
                            throw;
                        }
                        _mgr.Shutdown();
                    }
                }
            }
        }
Example #6
0
        public static void MainDI(string[] args)
        {
            TapiManager mgr = new TapiManager("devspec", TapiVersion.V30);

            mgr.Initialize();

            foreach (TapiLine line in mgr.Lines)
            {
                try
                {
                    line.Open(MediaModes.InteractiveVoice);
                    foreach (TapiCall call in line.GetCalls())
                    {
                        Console.WriteLine(call.CalledId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            mgr.Shutdown();
        }
Example #7
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     _mgr.Shutdown();
 }
Example #8
0
 private void TapiMonitorForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     tapiManager.Shutdown();
 }