How to make caller id in c#.net

前端 未结 2 2009
渐次进展
渐次进展 2020-12-15 01:52


I know this is answered question however I want to know hardware required and how to setup.

I am trying to build a take-out\'s delivery system wherein users cal

2条回答
  •  鱼传尺愫
    2020-12-15 02:37

    If you are using a phone and fax modem, just plug-in your telephone line into the modem.

    Next on your windows form drag-n-drop a SerialPort control and initialize it.

        this.serialPort1.PortName = "COM3"; 
        this.serialPort1.BaudRate = 9600;
        this.serialPort1.DataBits = 8;
        this.serialPort1.RtsEnable = true;
        this.serialPort1.DataReceived += serialPort1_DataReceived;
        this.serialPort1.Open();      
    

    Pass the following command to modem in order to activate Caller-ID

        this.serialPort1.WriteLine("AT#cid=1" + System.Environment.NewLine);
    

    Handle its DataReceived event and display the received data

         void serialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
         {
              richTextBox1.Text += this.serialPort1.ReadLine();          
         }
    

    Output:

    RING               //On 1st Ring
    DATE = xxxxx       //On 2nd Ring
    TIME = xxxx
    NMBR = xxxxxxxxx
    
    RING               //On 3rd Ring    
    RING               //On 4th Ring
    

    P.S. If the telephone line sends DTMF tones as Caller-ID then you need DTMF to FSK converter to detect the number, or else you will receive the rings but not the number.

提交回复
热议问题