I'm using a USR 5637 56 Kbps USB modem for my project because I had one on hand that hasn't seen use in a few years. They're about $45 new, $25 on eBay. I checked the specs and this one supports Caller ID as does my local phone company.
I plugged the modem into the Mac, fired up ZTerm and connected to usbmodem0000001.
I typed ATH (the code for hang up) just to see whether ZTerm was connected to the Mac - I got the expected 'OK' response.
Then I typed AT#CID=2 - this sets the caller ID output to unformatted. I figured this might be a little easier to parse. Apparently this setting is not "sticky" and needs to be set each time the USB modem powers on.
I plugged in a phone cable, called my number and saw this (this string has extra spaces that I put in for clarity):
RING
MESG=80 27 01 08 31 32 30 33 31 39 32 34 02 0A 34 31 39 35 35 35 31 32 31 32 07 0F 43 65 6C 6C 20 50 68 6F 6E 65 20 20 20 4F 48 FF<CR>
The message is a string of Hexadecimal numbers followed by a Carriage Return. The format of this message is:
message type
length of message
field type 1
field length 2
field 1
field type 2
field length 2
field 2
.
.
.
field type N
field length N
field N
Checksum
The message type is '80' - MESG=80 will be a good indicator of the start of the message.
Field types:
- 1 - date & time
- 2 - phone number
- 4 - number not present
- 7 - name
- 8 - name not present
So manually parsing the message above, I get:
MESG=80 - start of message
39 character long message
Type 1 - date & Time
8 characters for the date and time
12031924 (call was received on 12/03 at 19:24)
Type 2 - phone number
10 characters for the caller's number
4195551212
Type 7 - name
15 characters for the name
Cell Phone OH (there are 3 spaces between "Phone" and "OH"
Checksum: 255
Next step - write a program to parse this. Hmmm: C or Python? I think C...
No comments:
Post a Comment