Capture telephone numbers from connected modems using .NET (C#)


Some applications may require you to capture the telephone numbers of incoming calls. This can be achieved by some external (maybe native) libraries, i prefer to do it in a fully managed way (as far as possible).
I have implemented incoming call detection in C# for analog modem devices, connected through a (virtual) serial port and for CAPI devices (currently only for windows).

Features

  • Supported devices: Analog modem devices with serial connection (modem needs dedicated CallerID support), CAPI devices (more may come)
  • Simple interface
  • Operating systems: Analog modem device are supported on Linux and Windows (maybe more), CAPI devices are supported on Windows only
  • External libraries: CAPI support requires the CAPI.NET library from Mommosoft

[adsense:]

Usage

This example shows how to setup an analog modem, a capi device setup is shown in the samples project.

  • First setup the serial communication interface. For more information on using the reflective factory mechanism take a look at the Reflective Factory blog entry
     ICommunication serialComm = GenericClassIdentifierFactory.CreateFromClassIdentifierOrType<ICommunication>("simplecomm/general/rs232");
    IDictionary config = new Hashtable();
    config.Add("port_name", "COM8");
    config.Add("baud_rate", 57600);
    serialComm.SetupCommunication(config);
    
  • The next step is to setup the telecom interface.
    ITelecom t = GenericClassIdentifierFactory.CreateFromClassIdentifierOrType<ITelecom>("telecom/general/atz");
    t.IncomingCall += new TelecomIncomingCallDelegate(_IncomingCall);
    
    //Initialize the incoming-call provider with its default parameters
    IDictionary modemConfig = new Hashtable();
    modemConfig.Add("TransmitCommandTimeout", 5000);
    t.Initialize(serialComm, modemConfig);
    

    Source code

    Check out the code at git clone git://github.com/deveck/Deveck.Utils.git Run the samples to see how it works, the telecom devices are located at Deveck.Utils/Devices/Telecom