[comp.sys.3b1] How to detect phone ring?

car@trux.UUCP (Chris Rende) (05/14/91)

I'd like to write a daemon that simply logs when the telephone line rings.

I can handle the part that opens a file and writes out the date. :-)

But how do I detect or receive a signal that the phone line is ringing?

car.
-- 
Christopher A. Rende           Central Cartage (Nixdorf/Pyramid/SysVR2/BSD4.3)
uunet!edsews!rphroy!trux!car   Multics,DTSS,Unix,Shortwave,Scanners,UnixPC/3B1
car@trux.mi.org                Minix 1.2,PC/XT,Mac+,TRS-80 Model I,1802 ELF
trux!ramecs!car     "I don't ever remember forgetting anything." - Chris Rende

guy@cbnewsc.att.com (guy.r.berentsen) (05/15/91)

You can use signal(2) to trap SIGPHONE, and execute a function that 
calls ioctl(2) (see also ph(7)) to check the status of the phone line.

To do this you have to open the phone line device file, (/dev/ph1 or /dev/ph0)
which means that if you use the phone manager, 
the phone manager may not have that line defined (file open) while 
your daemon is running. 

If you are using the phone manager, you can check your history
list for the info you want on all answered calls, but I don't think the phone
manager records unanswered calls.

Guy Berentsen
att!ihlpf!guy