Xref: utzoo unix-pc.general:2409 comp.sys.att:5768 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ucsd!ucsbcsl!nessus!ivucsb!todd From: todd@ivucsb.UUCP (Todd Day) Newsgroups: unix-pc.general,comp.sys.att Subject: Call monitoring by UNIXPC Summary: kernel hacks for a better world Message-ID: <570@ivucsb.UUCP> Date: 6 Mar 89 18:09:18 GMT References: <92@ihtlt.UUCP> Reply-To: todd@ivucsb.UUCP (Todd Day) Organization: The Audio Club at UCSB, Isla Vista, California Lines: 56 In article <92@ihtlt.UUCP> tlt@ihtlt.UUCP (T. L. Todd) writes: ~I would like to connect the line 1 jack to the phone ~line in my house. I would like to connect the jack labeled phone to ~all the telephones in my house. In other words the UNIX PC would be ~connected serially in line with all the telephones we use. I would ~like to monitor all calls made from those phones, not calls made ~through the telephone manager. I've done just that. Originally, I had only the internal modem, so hooking all the phone lines thru the computer prevented people from picking up the phone while I was modeming. The UNIXPC disconnects the other phone lines from the line while the modem is operating. When I got an external modem, people could interrupt my modeming, because the UNIXPC only disconnected the phones if the internal modem was in use. I did some kernel hacking, and wrote a couple of programs for external phone management. Let me show you a diagram of my setup: phone line <-> external modem <-> UNIXPC line 1 <-> phones in house I tried writing programs that did ioctls and tried trapping SIGPHONE, but to no avail. Every time the phone was placed off hook, the UNIXPC internal hookswitch relay would connect the phone. After doing some kernel hacking, I found that there was really no way to shut it off, especially since I wanted to keep the phone manager running. First, I wrote a program that opens /dev/kmem and writes NOPs into a few places in the phone monitoring section of the kernel. You have the option of disconnecting the outside lines completely (i.e., UNIXPC never connects the phone), or turning off the ring to the outside lines, but still let calls be made at any time. Next, I wrote a ringback monitor. It monitors the phone line, looking for single rings. It will eat the first ring. If it gets a second ring, it will connect the outside lines, and the ring goes thru. If it doesn't get the second ring, it will set up the modem for autoanswer and put a getty on /dev/tty001. The getty will die in 30 seconds if no one logins in, and the program gets respawned by init and resets the modem. To trap SIGPHONE, I had to do some kernel hacking, because I wanted to keep the phone manager alive. It seems the SIGPHONE only gets sent to the first process that open /dev/ph0. Since I wanted to keep the phone manager alive, I temporarily patch the kernel allowing me to take SIGPHONE. Then, every time SIGPHONE gets trapped, I do a kill(-1, SIGPHONE). This sends the SIGPHONE to the phone manager, allowing it to do its work properly. BTW, the way I have it set up, phone mangager logs all incoming and out- going voice calls, but only records the number dialed if it was dialed from the phone manager. If anyone is interested in the above hacks, I could mail them to them. The patches are for 3.50, but it would be very easy to find the addresses for other versions by using "sdb /unix" and using the unix.sym table in /etc/lddrv. -- -Todd Day- Internet: todd%ivucsb.UUCP@anise.acc.com UUCP: {pyramid, ucbvax}!ucsbcsl!nessus!ivucsb!todd Other: todd@ivucsb.UUCP may not work yet.