![]() |
Using modem to detect phone rings?
Hi,
I'd like to use the internal modem in my G4 to detect when the phone rings and start a script that does a few things. I've been fooling around with /etc/ttys e.g. tty.modem "/usr/libexec/getty serial.9600" vt100 on secure or tty.modem "/usr/libexec/getty serial.9600" dialup on but no dice, the modem doesn't pick up the phone, it doesn't even seem to register an incoming phone call, I also checked the logs :( I've checked that everythings is working OK with ZTerm which gives me a "RING" message for every ring on the phone. I'm grateful for any help, hints or pointers to FAQs :) Tom |
the string for auto pick up is
ats0=1 at is attention modem s is for s register ( settings on the modem ) 0 is the auto answer sreg. 1 is for answer on one ring if you type this in some thing like zterm and hit enter, you should get ok if you set it as an init string then you may need to and ^M to the end ^M is the same as the return key being pressed |
UPDATE.
s registers do not get changed back normally when an app quits,unless set to. I would put it in the de -int string in zterm or add to it. You can test the result in zterm. quit zterm and then run it back up and seeing if it answers. reboot and bring up zterm and see if it answers. these test will tell you. If when you quit zterm or reboot the mac, if or if not auto answer stays on in the modem. Remember you are only using zterm to configure the modem. |
Hi Mark,
Thank you for your quick answer but I think we have a small misunderstanding here. Actually, I don't want the modem to pick up the phone I just want it to notify me in some way that the phone is ringing. My guess was that I could accomplish this with OS X's built-in getty. The hope was also that if I could get getty to pick up the phone I could also teach it other things. One step at a time so to speak :) Unfortunately, I haven't been able to configure getty to do anything other than just sit there. Then I remembered the good old Amiga days and how I connected to my favourite BBS through a terminal programme that let me talk to the modem directly. So, I tried ZTerm which works nicely with the G4's modem, I can dial manually and many other things and ZTerm also signifies me with a "RING" when the phone is ringing. Now I know that a) the modem is working OK b) the cabling is in order and c) I need to figure out if getty can do what I want. Again, what I want is the computer to detect an incoming phone call, not pick up the phone but instead run a script to do several other things e.g. write the time and the caller's id in a log, notify me with a window, turn on the lights, make coffee, you name it. I think with getty I should be able to do something like this but I'm not really sure. So, now that I've made things a bit clearer, do you still think you can help me? Or anybody else, for that matter? Thanks a ton in advance! Tom |
I did understand most of what you wanted though, and was just giving you a way of configuring the modem. using zterm as a tool.
the confusion I think started with this. ;) Quote:
|
why stop at detecting phone rings? get the caller-id info
Check out the NCID project at sourceforge. I've been using NCID on a linux machine to send caller-id wirelessly to my powerbook. It works pretty well. However, it doesn't work so well now that I want to run the ncidd server on my new mini. So my post is a suggestion for a possible solution to your question wrapped around a request to help troubleshoot ncidd on mac. Any takers?
|
Hi kahuna,
NCID looks interesting, but I also couldn't get the ncidd server to run :confused: Anyways, thanks for the tip and maybe somebody more savvy than us will get this to work :) |
There is some software out there called Jon's Phone tool:
http://homepage.mac.com/jonn8/jpt/ug/ It does a lot of phone related stuff. If it doesn't do what you want, perhaps a note to the author would get him to add it in. |
NCID works, just not 100%
I've got ncidd running on my mac mini which sends the caller id to my powerbook over wireless. The problem I'm having is that ncidd will stop functioning even though the process is still running. I need to do more troubleshooting, but if anyone's interested in trying it out, I can help with more detailed instructions.
|
Hi kahuna,
It's great that you got ncidd running! And, yes I would indeed be interested in more details! As for ncidd stopping to work I'd take the pragmatic route for the time being i.e. run a cron job to kill and restart ncidd every few minutes or so :D |
ncidd on Mac mini
The developer for ncidd is a linux guy so all this stuff is unix based. I was having problems with the modem getting buggered up after running ncidd in debug mode. I would have to reboot the system 'cause the mknod command wasn't working as I expected. Anyway, that's all water under the bridge.
First I extracted the gzip file into /usr/local. For my mini, I needed to edit the ncidd.conf file in /usr/local/etc to 'set sttyclocal=1' (it is commented out with a # symbol--just remove the # and save the file) which solved my /dev/cu.modem not found problems. Next, what you can do is run /path/to/ncidd -v -D -C /path/to/ncidd.conf. For me, that means /usr/local/sbin/ncidd -v -D -C /usr/local/etc/ncidd.conf which starts ncidd in verbose debug mode use the config file in /usr/local/etc. If it starts, you'll see messages stating that the modem was configured then caller id was set on the modem. At that point, trying to ctrl-c to kill the ncidd process doesn't quite work. If it does, great, if not, reboot to reset the modem (anyone feel free to enlighten me on how to reset a modem under OS X). Now, you should be able to run `ncidd -C /usr/local/etc/ncidd.conf`and let it run. Next, startup NCIDpop and enter the hostname or ip address of the server ncidd is running. Call yourself -- your name and number should pop up on your screen! I have been running ncidd in debug mode for the last 36 hours. It still runs, but I randomly miss calls and/or caller-id info. I'm beginning to suspect a bad phone line to the mini or strangeness due to the phone company installing the fiber-optic box at my house. After I get that ironed out, I am going to proceed to figuring out how to get the ncid-speak script to work. |
Hi kahuna,
Well, I still get the same error I've been getting since I've installed the ncid package: No modem found: /dev/cu.modem This is on a G4/400 with internal modem upgraded to 800 MHz. And it doesn't matter whether sttylocal is set to 0 or 1, ncidd won't find the modem :confused: If you can't stop ncidd with control-c you could do the following in a new terminal: kill `ps auxww | grep ncidd | grep -v grep | awk '{print $2}'` If that doesn't work, you can try kill -9 instead of plain kill. And if you want to reset the modem you can download ZTerm and issue ATZ That should reset the modem AFAIK. Unfortunately, I don't know how to send commands to the modem from the command line, but this should take care of the modem without you having to reset the machine. As for the phone line I guess I can't help you there, mate :) |
d'oh!
Your post reminded me that I've always used minicom in my linux days to play with the modem. It looks like it's been ported to OS X, so I'll be testing that tonight.
(sometimes os x makes things too easy and I guess I got lazy) |
a little disappointed in mac modem
After a lot of playing this weekend, I determined that ncidd isn't my problem. I compiled minicom on my powerbook, copied it to the mini, put a three-way phone splitter on my phone line and tested my caller id on the powerbook, the mini and my old thinkpad (linux) simultaneously. (side note, transparent terminal windows are so cool for this)
The thinkpad works perfectly for every call received. I have numerous problems with the mac modems. The first call after a modem initialization usually results in a ERRM_ICLID_202 message, the next call might show the caller id info, the call after that maybe works, but might be the error message again. After about 7 calls, the modem will only detect a ring and needs to be initialized again. Can anyone provide hints on proper modem initialization strings? I've been reading this, but it hasn't helped: http://manuals.info.apple.com/Apple_...ATCommands.PDF |
While it could very well be just badly implemented in the modem, you might want to give it a try with the modem and nothing else connected to the line.
You might also want to find out and eventually adjust your line current if it is too high. I faintly remember 35 mA, but I could be wrong as I have ISDN-phones for quite some time now. |
how do I test line voltage?
Probably need a "line voltage meter?" Have phone company check/adjust it?
|
Any analog or digital multimeter with a range up to 100 or 200 mA is fine.
Look how much current you get with a phone off-hook. Don't touch the wires when a call comes in, that's 96 V AC and it seriously tingles ! |
Hi kahuna,
I've been having trouble getting minicom to work with fink but then I just went ahead and compiled it myself. Works like a charm, but I still get the No modem found: /dev/cu.modem error with ncidd, even though minicom and ncidd are both using the /dev/cu.modem device. What's different with your ncidd version? I have version 0.5 and compiled it myself. Did you hack the Makefile or anything else? What am I missing here? Thanks. |
hmmm. I'm using the dmg of ncidd 0.50 with the only change being to the sttyclocal setting in ncidd.conf mentioned above. I was having the modem not found problem, but cleared it by deleting /dev/cu.modem and rebooting. It's kind of the brute force method, but it worked. I would definitely prefer a non-reboot type fix for this, but haven't got one yet.
How has your modem responded when using minicom? Are you having any problems when enabling caller id and observing calls coming in? What initialization string are you using? |
What is your output when running `ncidd -vD`?
|
It might be a good idea to check for permissions, a sane cu.modem should look like this:
# ls -l /dev/cu.modem crw-rw-rw- 1 root wheel 8, 1 14 Mar 11:38 /dev/cu.modem Check before and after using different apps opening the device, some may monkey with ownership or permissions. |
Good point, Voldenuit. I'm pretty sure ncidd will touch the modem, but doesn't change anything. I had to reboot after deleting /dev/cu.modem because I was impatient and couldn't get `mknod` to do what I wanted. But a reboot will recreate the device with proper major/minor node numbers.
|
Hi kahuna,
That's interesting. I have two Macs, one G4@400 and an iMac G5. On the iMac ncidd seems to work, after I set the modem to /dev/cu.modem and sttyclocal to 1 in the config file. On the G4 I get the same results no matter what I do, even after deleting /dev/cu.modem. This is ncidd's output on the G4: sudo ncidd -vD Password: Configured to send 'cidlog' to clients. Configured to send 'cidinfo' to clients. Processed config file: /usr/local/etc/ncidd.conf CID logfile: /var/log/cidcall.log Modem logfile: /var/log/cidmodem.log Modem port opened: /dev/cu.modem Modem lock file: /Users/ths/lock/LCK..cumodem Modem control signals disabled No modem found: /dev/cu.modem And here the output on the iMac: sudo ncidd -vD Password: Configured to send 'cidlog' to clients. Configured to send 'cidinfo' to clients. Processed config file: /usr/local/etc/ncidd.conf CID logfile: /var/log/cidcall.log Modem logfile: /var/log/cidmodem.log Modem port opened: /dev/cu.modem Modem lock file: /var/lock/LCK..cu.modem Modem control signals disabled AT Z S0=0 E1 V1 Q0 OK Modem initialized. AT+VCID=1 OK Modem set for CallerID. I installed the ncid package from the source 0.50 version on both Macs. The G4's modem reacted fine when using minicom. I haven't enabled caller id, so when I call I only get the RING message. As for the init string it's still set to the default setting. Actually all settings are still the default settings except for the modem which is set to /dev/cu.modem. |
ths, do you have any idea why the lockfile gets written to two different locations on the two machines while you said both installations were identical ?
The iMac picks a place that looks a lot more unix-like... |
Hi voldenuit,
Oh, must have missed that one. Well, I've been toying around a little with the config file and thought maybe it's a permission thing or something, so I changed the location of the lock file. But it's the same wherever I put the lock file. |
you don't happen to use the modem to dial the internet do you?
|
Hi kahuna,
No, I'm using Ethernet and Airport to connect to the internet. And before you ask, no, I don't have the fax server running, either. |
Sorry, I was kinda thinking out loud. I'm mystified--are there any other messages in console or cidmodem.log? The only clue that looks helpful is the lock file location. Does minicom create the lock file in the same place?
|
I'm out of good ideas now.
For the mini, either the line current is not in the range it likes or CID-support is not stable with that modem. For the G4 unable to open it, other than tracing the source or asking on the ncidd-delevopers mailing-list, no other approaches I could think of. Good luck to you, keep us posted if you make progress... |
ths,
Have you tried running ktrace on your ncidd process? Maybe it will have some other clue. |
Hi kahuna,
Sorry for the delay, I've been on holiday :-) I finally got around running ktrace. On the iMac everything runs very smoothly, I get an "OK" for every command ncidd sends to the modem. On the G4 however, I get nothing, e.g. ---- "AT Z S0=0 E1 V1 Q0\r" 6536 ncidd RET write 19/0x13 6536 ncidd CALL read(0x3,0xbffff540,0x3ff) 6536 ncidd GIO fd 3 read 0 bytes "" ---- When I type the very same init string from above in minicom I get the usual "OK". Interestingly enough, when I run minicom and then start ncidd, the init string from above is launched 9 times in minicom whereupon I get 9 OK's, but ncidd still fails to recognize the modem... In short, ncidd sends the init string to the modem, the modem receives the string and executes it, the modem sends back an OK signal, but ncidd somehow never receives that signal. Strange. |
Are you using the same ncidd binary on each machine or did you compile it on each specific machine? Maybe the modem driver updates rumored in 10.3.9 will help--I'm hoping they do for me.
Otherwise, I'm stumped. I'm afraid I sent you down the wrong path and wasted your time. |
Hi kahuna,
I compiled each binary on each machine respectively. As for the modem drivers, I guess I'll try again once 10.3.9 or even 10.4 is out. And don't worry about wasting my time, it was mine to waste to begin with and I'm sure that an update to ncidd will provide a solution and then I'm sure it's exactly what I've been looking for. I mean, I got it working on one Mac, admittedly not the one I was hoping it would be, but nonetheless. So, thanks for the help for the time being and I'll get back to you as soon as some solution presents itself :-) |
I have been following this thread with interest because what I would like to do is:
1. Split the line to my phone to the modem in my old G4 2. Get the G4 modem to recognize the caller ID but not pick up the phone 3. Take the Caller ID number from the G4 modem and plug it into a Spotlight search 4. Get Spotlight to display the Address Book card that matches the Caller ID and flash the card up on screen. It seems like such a useful procedure that I would have guessed there would be an application like Phone Valet that could this. But apparently not? Any takers on the chances of doing this in 10.4? |
I realize I'm hitting this thread late, but I think you can probably apply Hayes AT commands to the modem directly from the terminal using "echo" just like on the PC. It would look something like this:
"echo ATZ > /dev/cu.modem" Obviously, you can use any AT command you need, but I used the reset command as an example. Greg |
| All times are GMT -5. The time now is 09:05 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.