How can I read Caller ID information in a Cocoa app?
Specifically, I have the Apple USB modem that says it supports Caller ID and I want my app to be able to know when a call comes in and whose calling. In the future I may add dialer capabilities, etc., but cart-before-the-horse. Caller ID is stop-one!
That said, I can't believe this has proven sooo ellusive to find even a single example of ANYWHERE (I have googled the CRAP out of this!) but can anyone show me how to do basic Caller ID detection in a Mac app? I'd prefer Cocoa but wi开发者_运维技巧ll be willing to go Carbon if I must.
Now I'm not looking for a full-on telephony API example although again, I'll go that route if I have to, but I can't even find that! Found this all over the place on the Windows side of things, but can't find a damn thing on Mac!
As mentioned elsewhere you can (and I have) use screen /dev/tty.usbmodem00001
or some such to access the modem directly from terminal, send AT commands or see RINGs and CallerID (once enabled via AT or NCID).
They also walk through minicom usage as mentioned above.
Googling /dev/tty mac callerid
reveals quite a few ideas.
As to writing software, I imagine NCID will either prove useful (there's a growl plugin too!) or can serve as example code. See the Mac install instructions, specifically under TEST USING A MODEM
. Here's an example way of extending NCID to launch your own program/script with CallerID info.
Man, that is going old school. I haven't seen anything related to analog modems in five years. I know that back in the day, even the NextStep modem stuff was down in the BSD and written in C. I don't think there ever was Objective-C API for it all. Today, everything is volIP.
Asterisks looks like something you might be able to use.
Are you able to talk to the modem with Hayes
commands? Then I think you should be able to enable the caller id feature with
AT#CID=1
If you need a terminal program to talk to the modem with I can recommend minicom
. I got it to compile for the mac just now with
LIBS=-liconv ./configure ; make ; sudo make install
I'm not sure how the caller id will be presented but I think using the terminal program you should be able to see it probably when the RING
is outputed from the modem.
All new to this? Maybe this can be a start
Then back to Cocoa, how to speak to a modem? See this discussion
This page has a discussion about the caller id, interesting. Apparently the caller id and more is outputted after the first RING
It's much harder than you'd think because there's no API to control the modem.
Asterisk referred by TechZen above is a good reference, but Asterisk has no driver for the USB modem you're trying to use. The folks over at sunrisetel started an effort to write a driver for Apple's USB modem but I'm not sure if they have not abandoned it in the meantime: see afelio
Quoting from Afelio's page:
A media server for the Motorola SM56 modem used by Apple in recent Macs and in the external Apple USB modem is now under development.
精彩评论