コード例 #1
0
ファイル: Program.cs プロジェクト: gandalan/ibos-integrations
        /// <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();
            }
        }
コード例 #2
0
        //Constructors
        #region TapiController
        private TapiController()
        {
            this.Events      = new ObservableCollection <TapiEventLogEntry>();
            this.AllCalls    = new ObservableCollection <Call>();
            this.ActiveCalls = new ThreadSafeObservableCollection <Call>();

            this.innerManager = new TapiManager(Guid.NewGuid().ToString());
            this.innerManager.Initialize();
        }
コード例 #3
0
        private static void ShowCallingLocations(TapiManager mgr, TapiLine line)
        {
            foreach (CallingLocation li in mgr.LocationInformation.CallingLocations)
            {
                Console.WriteLine(li.ToString());
            }

            mgr.LocationInformation.CurrentLocation = mgr.LocationInformation.CallingLocations[1];
            Console.WriteLine("Current location: {0}", mgr.LocationInformation.CurrentLocation.Name);
            Console.WriteLine(line.TranslateNumber("+1 (310) 555-1212", TranslationOptions.CancelCallWaiting).DialableNumber);
        }
コード例 #4
0
        static void Main(string[] args)
        {
            TapiManager z = new TapiManager("SimpleCall");

            z.Initialize();
            TapiLine[] phone = z.Lines;
            TapiLine   line  = phone[16];

            Console.WriteLine(line);
            line.Open(MediaModes.Modem);
            Console.WriteLine(line.Capabilities.MediaModes);
        }
コード例 #5
0
ファイル: TAPICTIService.cs プロジェクト: gnomix/T.A.L.K.
 public TAPICTIService(TapiManager manager)
 {
     _manager = manager;
     _manager.LineAdded += new EventHandler<LineAddedEventArgs>(manager_LineAdded);
     _manager.LineRemoved += new EventHandler<LineRemovedEventArgs>(manager_LineRemoved);
     foreach (TapiLine line in manager.Lines)
     {
         foreach (TapiAddress address in line.Addresses)
         {
             _addresses.Add(address);
         }
     }
 }
コード例 #6
0
 public TAPICTIService(TapiManager manager)
 {
     _manager              = manager;
     _manager.LineAdded   += new EventHandler <LineAddedEventArgs>(manager_LineAdded);
     _manager.LineRemoved += new EventHandler <LineRemovedEventArgs>(manager_LineRemoved);
     foreach (TapiLine line in manager.Lines)
     {
         foreach (TapiAddress address in line.Addresses)
         {
             _addresses.Add(address);
         }
     }
 }
コード例 #7
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();
        }
コード例 #8
0
        static void Main(string[] args)
        {
            using (TapiManager mgr = new TapiManager("EnumTapiLines"))
            {
                try
                {
                    if (!mgr.Initialize())
                    {
                        Console.WriteLine("TAPI failed to find any lines or phones to manage.");
                    }

                    if (mgr.Lines.Length > 0)
                    {
                        int count = 1;
                        foreach (TapiLine line in mgr.Lines)
                        {
                            Console.WriteLine("{0}: \"{1}\" ppid={2}\n{3}\n--Status--\n{4}",
                                              count++, line.Name, line.PermanentId,
                                              line.Capabilities.ToString("f"),
                                              line.Status.ToString("f"));
                        }
                    }
                    else
                    {
                        Console.WriteLine("No Tapi lines found.");
                    }

                    if (mgr.Phones.Length > 0)
                    {
                        int count = 1;
                        foreach (TapiPhone phone in mgr.Phones)
                        {
                            Console.WriteLine("{0}: \"{1}\" ppid={2}\n{3}\n--Status--\n{4}",
                                              count++, phone.Name, phone.PermanentId,
                                              phone.Capabilities.ToString("f"),
                                              phone.Status.ToString("f"));
                        }
                    }
                    else
                    {
                        Console.WriteLine("No Tapi phones found.");
                    }
                }
                catch (TapiException ex)
                {
                    Console.WriteLine(ex);
                }
            }
        }
コード例 #9
0
 static void DumpForwardingInfo(TapiManager mgr)
 {
     foreach (TapiLine line in mgr.Lines)
     {
         if (line.Capabilities.SupportsForwarding)
         {
             foreach (TapiAddress addr in line.Addresses)
             {
                 Console.WriteLine("Forwarding supported: {0} {1} - {2}", line.Name, addr.Address, addr.Capabilities.SupportedForwardingModes);
                 foreach (ForwardInfo fwd in addr.Status.ForwardingInformation)
                 {
                     Console.WriteLine("\t{0}", fwd);
                 }
             }
         }
     }
 }
コード例 #10
0
ファイル: PhoneTest.cs プロジェクト: stoic-coder/atapi.net
        static void MainPhone(string[] args)
        {
            using (TapiManager mgr = new TapiManager("Test"))
            {
                mgr.Initialize();

                foreach (TapiPhone phone in mgr.Phones)
                {
                    Console.WriteLine(phone.Name);
                    Console.WriteLine(phone.Capabilities.ToString("f"));

                    phone.Open();
                    if (phone.Display != null)
                    {
                        Console.WriteLine(phone.Display.Text);
                    }

                    Console.WriteLine(phone.Status);

                    foreach (PhoneButton pb in phone.Buttons)
                    {
                        Console.WriteLine(pb);
                    }

                    if (phone.Handset != null)
                    {
                        Console.WriteLine(phone.Handset);
                        phone.Handset.Volume = 100;
                        phone.Handset.Gain   = 20;
                    }
                    if (phone.Headset != null)
                    {
                        Console.WriteLine(phone.Headset);
                    }
                    if (phone.Speaker != null)
                    {
                        Console.WriteLine(phone.Speaker);
                    }

                    phone.Close();
                }
            }
        }
コード例 #11
0
ファイル: CommonPage.cs プロジェクト: yourina/TizenFX
        private void cpNameBtn_Clicked(object sender, EventArgs e)
        {
            try
            {
                cplist = TapiManager.GetCpNames().ToList();
                if (cplist != null)
                {
                    Log.Debug(Globals.LogTag, "inside common button clicked ");
                    for (int i = 0; i < cplist.Count; i++)
                    {
                        Log.Debug(Globals.LogTag, "Cp name = " + cplist[i]);
                    }
                }
            }

            catch (Exception ex)
            {
                Log.Debug(Globals.LogTag, "Getcpnames throw exception = " + ex.ToString());
            }
        }
コード例 #12
0
ファイル: CommonPage.cs プロジェクト: yourina/TizenFX
        private void initBtn0_Clicked(object sender, EventArgs e)
        {
            try
            {
                Globals.handleModem0 = TapiManager.InitTapi(cplist[0]);
                if (Globals.handleModem0 == null)
                {
                    Log.Debug(Globals.LogTag, "Init tapi is not successful and TapiHandle is null");
                }
                else
                {
                    Log.Debug(Globals.LogTag, "Init tapi is successful");
                }
            }

            catch (Exception ex)
            {
                Log.Debug(Globals.LogTag, "inside init tapi exception = " + ex.ToString());
            }
        }
コード例 #13
0
ファイル: CommonPage.cs プロジェクト: yourina/TizenFX
        private void deinitBtn0_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (Globals.handleModem0 != null)
                {
                    TapiManager.DeinitTapi(Globals.handleModem0);
                    Log.Debug(Globals.LogTag, "Deinit tapi is successful");
                }
                else
                {
                    Log.Debug(Globals.LogTag, "TapiHandle is null");
                }
            }

            catch (Exception ex)
            {
                Log.Debug(Globals.LogTag, "inside deinit tapi exception = " + ex.ToString());
            }
        }
コード例 #14
0
        static void MainDS(string[] args)
        {
            TapiManager mgr = new TapiManager("devspec", TapiVersion.V30);

            mgr.Initialize();

            foreach (TapiLine line in mgr.Lines)
            {
                line.Monitor();

                byte[] arr = new byte[]
                {
                    08,
                    00,
                    80,
                    00
                };

                line.Addresses[0].DeviceSpecific(arr);
            }
        }
コード例 #15
0
ファイル: DeviceInfo.cs プロジェクト: stoic-coder/atapi.net
        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();
        }
コード例 #16
0
ファイル: TAPISnapshotServer.cs プロジェクト: gnomix/T.A.L.K.
 public TAPISnapshotServer(TapiManager mgr)
 {
     _manager = mgr;
 }
コード例 #17
0
ファイル: FonService.cs プロジェクト: AxlOnGit/Catalist
 /// <summary>
 /// Creates a new instance of the FonService class.
 /// </summary>
 public FonService()
 {
     this.myTapiManager = new TapiManager("Catalist");
 }
コード例 #18
0
        protected override void OnStart(string[] args)
        {
            try
            {
                //Trace.Listeners.Add(new TextWriterTraceListener("asteriskconnector.log"));
                log.Debug("Initializing tapi connector...");
                Calls   = new Hashtable();
                manager = new TapiManager("TALK TAPI CTI Service");
                if (manager.Initialize())
                {
                    log.Debug("Creating LineControlServer Proxy: ");
                    ss = new StateServer(Properties.Settings.Default.LineControlServerUrl);

                    log.Debug("Creating TAPICTIService...");
                    host = new ServiceHost(new TAPICTIService(manager));
                    log.Debug("Hosting TAPICTIService...");
                    host.Open();
                    log.Debug("Creating TAPISnapshotService...");
                    snapshotHost = new ServiceHost(new TAPISnapshotServer(manager));
                    log.Debug("Hosting TAPISnapshotService...");
                    snapshotHost.Open();
                    isInitialized = true;
                }
                else
                {
                    log.Debug("Unable to initialize TAPI Manager");
                }
            }
            catch (Exception e)
            {
                log.Debug("Error while initializing TAPIConnector: " + e.Message);
            }
            log.Debug("TAPI Connector starting");
            if (isInitialized)
            {
                manager.AddressChanged   += new EventHandler <AddressInfoChangeEventArgs>(manager_AddressChanged);
                manager.CallInfoChanged  += new EventHandler <CallInfoChangeEventArgs>(manager_CallInfoChanged);
                manager.CallStateChanged += new EventHandler <CallStateEventArgs>(manager_CallStateChanged);
                manager.LineAdded        += new EventHandler <LineAddedEventArgs>(manager_LineAdded);
                manager.LineChanged      += new EventHandler <LineInfoChangeEventArgs>(manager_LineChanged);
                manager.LineRemoved      += new EventHandler <LineRemovedEventArgs>(manager_LineRemoved);
                manager.LineRinging      += new EventHandler <RingEventArgs>(manager_LineRinging);
                manager.NewCall          += new EventHandler <NewCallEventArgs>(manager_NewCall);
                manager.PhoneAdded       += new EventHandler <PhoneAddedEventArgs>(manager_PhoneAdded);
                manager.PhoneRemoved     += new EventHandler <PhoneRemovedEventArgs>(manager_PhoneRemoved);
                manager.ReinitRequired   += new EventHandler(manager_ReinitRequired);

                foreach (TapiLine line in manager.Lines)
                {
                    line.Changed          += new EventHandler <LineInfoChangeEventArgs>(line_Changed);
                    line.AddressChanged   += new EventHandler <AddressInfoChangeEventArgs>(line_AddressChanged);
                    line.CallInfoChanged  += new EventHandler <CallInfoChangeEventArgs>(line_CallInfoChanged);
                    line.CallStateChanged += new EventHandler <CallStateEventArgs>(line_CallStateChanged);
                    line.NewCall          += new EventHandler <NewCallEventArgs>(line_NewCall);
                    line.Ringing          += new EventHandler <RingEventArgs>(line_Ringing);



                    if (!line.IsOpen)
                    {
                        try
                        {
                            log.Debug("Opening line: " + line.ToString() + " name: " + line.Name);
                            line.Open(line.Capabilities.MediaModes);

                            try
                            {
                                log.Debug("Parsing " + line.ToString() + " adresses");
                                foreach (TapiAddress address in line.Addresses)
                                {
                                    address.CallInfoChanged  += new EventHandler <CallInfoChangeEventArgs>(address_CallInfoChanged);
                                    address.CallStateChanged += new EventHandler <CallStateEventArgs>(address_CallStateChanged);
                                    address.Changed          += new EventHandler <AddressInfoChangeEventArgs>(address_Changed);
                                    address.NewCall          += new EventHandler <NewCallEventArgs>(address_NewCall);

                                    ss.SetLineControl(GetLineControl(address));
                                }
                            }
                            catch (Exception e)
                            {
                                log.Error("Error while parsing " + line.ToString() + " addresses: " + e.Message);
                            }

                            //linedevspecific etrali
                            try
                            {
                                log.Debug(line.ToString() + " device specific data : " + System.Text.Encoding.ASCII.GetString(line.Status.DeviceSpecificData));
                                line.NegotiateExtensions(Properties.Settings.Default.DevSpecificMinVersion, Properties.Settings.Default.DevSpecificMaxVersion, new EventHandler <DeviceSpecificEventArgs>(line_DevSpecific));
                            }
                            catch (Exception lne)
                            {
                                log.Error("Unable to negotiate dev specific extensions for " + line.ToString() + " " + lne.ToString());
                            }
                        }
                        catch
                        {
                            log.Error("Error while opening line: " + line.ToString());
                        }
                    }
                }
            }
        }
コード例 #19
0
 public Tapi()
 {
     App.log(String.Format("Using adapter '{0}'", adapter));
     mgr = new TapiManager("BBjTAPIClient.Net");
 }
コード例 #20
0
ファイル: TAPIConnector.cs プロジェクト: gnomix/T.A.L.K.
        protected override void OnStart(string[] args)
        {
            try
            {
                //Trace.Listeners.Add(new TextWriterTraceListener("asteriskconnector.log"));
                log.Debug("Initializing tapi connector...");
                Calls = new Hashtable();
                manager = new TapiManager("TALK TAPI CTI Service");
                if (manager.Initialize())
                {
                    log.Debug("Creating LineControlServer Proxy: ");
                    ss = new StateServer(Properties.Settings.Default.LineControlServerUrl);

                    log.Debug("Creating TAPICTIService...");
                    host = new ServiceHost(new TAPICTIService(manager));
                    log.Debug("Hosting TAPICTIService...");
                    host.Open();
                    log.Debug("Creating TAPISnapshotService...");
                    snapshotHost = new ServiceHost(new TAPISnapshotServer(manager));
                    log.Debug("Hosting TAPISnapshotService...");
                    snapshotHost.Open();
                    isInitialized = true;
                }
                else
                {
                    log.Debug("Unable to initialize TAPI Manager");
                }
            }
            catch (Exception e)
            {
                log.Debug("Error while initializing TAPIConnector: " + e.Message);
            }
            log.Debug("TAPI Connector starting");
            if (isInitialized)
            {
                manager.AddressChanged += new EventHandler<AddressInfoChangeEventArgs>(manager_AddressChanged);
                manager.CallInfoChanged += new EventHandler<CallInfoChangeEventArgs>(manager_CallInfoChanged);
                manager.CallStateChanged += new EventHandler<CallStateEventArgs>(manager_CallStateChanged);
                manager.LineAdded += new EventHandler<LineAddedEventArgs>(manager_LineAdded);
                manager.LineChanged += new EventHandler<LineInfoChangeEventArgs>(manager_LineChanged);
                manager.LineRemoved += new EventHandler<LineRemovedEventArgs>(manager_LineRemoved);
                manager.LineRinging += new EventHandler<RingEventArgs>(manager_LineRinging);
                manager.NewCall += new EventHandler<NewCallEventArgs>(manager_NewCall);
                manager.PhoneAdded += new EventHandler<PhoneAddedEventArgs>(manager_PhoneAdded);
                manager.PhoneRemoved += new EventHandler<PhoneRemovedEventArgs>(manager_PhoneRemoved);
                manager.ReinitRequired += new EventHandler(manager_ReinitRequired);
                
                foreach (TapiLine line in manager.Lines)
                {
                    line.Changed += new EventHandler<LineInfoChangeEventArgs>(line_Changed);
                    line.AddressChanged += new EventHandler<AddressInfoChangeEventArgs>(line_AddressChanged);
                    line.CallInfoChanged += new EventHandler<CallInfoChangeEventArgs>(line_CallInfoChanged);
                    line.CallStateChanged += new EventHandler<CallStateEventArgs>(line_CallStateChanged);
                    line.NewCall += new EventHandler<NewCallEventArgs>(line_NewCall);
                    line.Ringing += new EventHandler<RingEventArgs>(line_Ringing);
                    
                    

                    if (!line.IsOpen)
                    {
                        try
                        {
                            log.Debug("Opening line: " + line.ToString() + " name: " + line.Name);
                            line.Open(line.Capabilities.MediaModes);
                            
                            try
                            {
                                log.Debug("Parsing " + line.ToString() +" adresses");
                                foreach (TapiAddress address in line.Addresses)
                                {
                                    address.CallInfoChanged += new EventHandler<CallInfoChangeEventArgs>(address_CallInfoChanged);
                                    address.CallStateChanged += new EventHandler<CallStateEventArgs>(address_CallStateChanged);
                                    address.Changed += new EventHandler<AddressInfoChangeEventArgs>(address_Changed);
                                    address.NewCall += new EventHandler<NewCallEventArgs>(address_NewCall);
                                    
                                    ss.SetLineControl(GetLineControl(address));
                                }
                            }
                            catch (Exception e)
                            {
                                log.Error("Error while parsing " + line.ToString() + " addresses: " + e.Message);
                            }

                            //linedevspecific etrali
                            try
                            {
                                log.Debug(line.ToString() + " device specific data : " + System.Text.Encoding.ASCII.GetString(line.Status.DeviceSpecificData));
                                line.NegotiateExtensions(Properties.Settings.Default.DevSpecificMinVersion, Properties.Settings.Default.DevSpecificMaxVersion, new EventHandler<DeviceSpecificEventArgs>(line_DevSpecific));
                            }
                            catch (Exception lne)
                            {
                                log.Error("Unable to negotiate dev specific extensions for " + line.ToString() + " " + lne.ToString());
                            }
                        }
                        catch
                        {
                            log.Error("Error while opening line: " + line.ToString());
                        }
                    }
                }
            }
        }
コード例 #21
0
ファイル: TAPISnapshotServer.cs プロジェクト: gnomix/T.A.L.K.
 public TAPISnapshotServer(TapiManager mgr)
 {
     _manager = mgr;
 }