Ejemplo n.º 1
0
        /// <summary>
        /// This method initializes the TAPI infrastructure.
        /// </summary>
        /// <returns>true/false success indicator</returns>
        public bool Initialize()
        {
            if (!_hTapiLine.IsInvalid)
            {
                throw new TapiException("TAPI has already been initialized.", NativeMethods.LINEERR_OPERATIONUNAVAIL);
            }

            _evtStop.Reset();

            int numLines  = InitializeLineDevices();
            int numPhones = InitializePhoneDevices();

            if (numLines > 0 || numPhones > 0)
            {
                _workerThread = new Thread(ProcessTapiMessages)
                {
                    Name         = "Tapi Message Processor",
                    IsBackground = true,
                };
                _workerThread.Start();
                ReadProviderList();
                _locInfo = new LocationInformation(this);

                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="lto">Translation output</param>
 /// <param name="buff">Raw buffer</param>
 /// <param name="locInfo"><see cref="LocationInformation"/></param>
 internal NumberInfo(LINETRANSLATEOUTPUT lto, byte[] buff, LocationInformation locInfo)
 {
     DisplayNumber      = NativeMethods.GetString(buff, lto.dwDisplayableStringOffset, lto.dwDisplayableStringSize, NativeMethods.STRINGFORMAT_UNICODE);
     DialableNumber     = NativeMethods.GetString(buff, lto.dwDialableStringOffset, lto.dwDialableStringSize, NativeMethods.STRINGFORMAT_UNICODE);
     DestinationCountry = (lto.dwDestCountry != 0) ? locInfo.GetCountryByCode(lto.dwDestCountry) : null;
 }