开发者

Counting no. of rings occured in a remote phone

开发者 https://www.devze.com 2023-02-20 07:22 出处:网络
I have created a C# program that can dial a phone. Now what I have to do is count the number of rings occuring in the remote phone device.

I have created a C# program that can dial a phone. Now what I have to do is count the number of rings occuring in the remote phone device.

My C# program uses the command ATDT [p开发者_开发技巧honeno] to dial the number. If remote phone rings more than 5 times, I have to perform some other activites.

Is there any way I can achieve this?


You cannot achieve that over a standar modem and serial port. The best you can do is have a timeout. Whilst ringing, the modem just looks out for the carrier signal before initiating any communications. It doesn't count rings.

If you absolutely must do that, it would involve taking the audio from the modem and processing it to get the ring count (not trivial as depending on the telephone network etc, ringing varies considerably and can be confused with hold tones).


As far as i know you can't count the real number of rings. Just think about a handy that doesn't ring but plays a song. So all you can do is running a timer and hang up after the timeout is reached (e.g. 20 seconds).


Depending on the modem you should be able to get a ring notification. Open the serial port for input and watch for a word such as RING while the line is called. You should be able to start a counter of some sort and watch the line status. You may need to look at the advanced AT commands for your device to ensure that it is configured to report these notifications.

  • Some MODEM AT commands

It looks like you might want to look at registers S0 and S1.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号