Go to the first, previous, next, last section, table of contents.
Some telephone companies provide a service to the subscriber, called "Caller ID", where the phone number of the caller is transmitted while your phone is ringing. Not all providers support it, and you'll have to ask for it.
If your modem is able to retrieve callerid information, and mgetty
is compiled with CNDFILE
defined in `policy.h', mgetty
can check the caller's number before answering the phone. (Right now, it
works for most variants out there, ZyXEL, Rockwell, ELSA and isdn4linux
among them). If CNDFILE
is undefined, or if the
file specified does not exist, all calls will be allowed.
One important thing: for most analog modems, you must set the number of RINGs to wait for to two (2) or higher (set `rings 2' in `mgetty.config'), because the ID code is sent between the first and the second RING. If mgetty picks up the phone too soon, the modem can't get this information.
Whether a call is accepted or denied is controlled by the configuration file
set with CNDFILE
in `policy.h'. The usual default is
`/usr/local/etc/mgetty+sendfax/dialin.config' (a sample file is installed per default).
That file contains a series of tokens separated by newlines, commas, tabs and spaces. The callerid number is compared with each token in turn, until a match occurs. A match occurs when the token compares equally to the callerid information up to the length of the token. If the token is prefixed with a "!", a match means "do not answer the phone". The token "all" matches any telephone number, and will terminate scanning of the cndfile. If no callerid number is present, it is assumed to have the value "none". A line starting with "#" is a comment. There is an implicit "all" at the end of the file. For example:
# list of my friends' data lines 3433535, 7445343, 5551212 # dad's fax 4164646777 # disallow [other] calls from numbers matching the following prefix: !416 # disallow that speed dialer that keeps hitting my machine !3444444 # allow all calls with the following prefixes 832, 555 # don't allow calls when there's no callerid: !none # It's okay to accept calls from out of area # ("OUT_OF_AREA" token seems ZyXEL specific) OUT_OF_AREA # disallow all other calls !all
For the future, Chris Lewis is planning on adding special modem initialization strings (e.g., 2400 bps only, fax-only, ...) dependant on the caller number.
For most applications, this kind of static configuration is enough. If
you have special needs, you can choose to run an external program to
decide this. The program name is configured with the cnd-program
statement in `mgetty.config'. Its command line arguments are:
<program> <tty> <CallerID> <Name> <dist-ring-nr.> <Called Nr.>
CallerID
is the number of the caller, if known, or `none', if
not. Name
is the name of the caller, or empty (") if unknown.
dist-ring-nr.
is the RING type, if you have "distinctive
RING" on your telephone line and your modem supports this, or "0"
for an unidentified call. Called Nr.
is the number that was called
(this is only meaningful if you have ISDN, and your modem signals the
complete number called to the host - e.g. ELSA or ZyXEL 2864I do that).
For example, a call from 12345 to 56789, using ISDN, coming in on ttyS3, could lead to a program called like this:
check.cnd ttyS3 12345 " 0 56789
The program return value decides whether the call should be accepted. Currently, the following values are defined:
0 - accept call, no specific preferences 1 - reject call
Future versions will allow external selection of the way mgetty/vgetty is supposed to answer the call (data/voice/fax/...), but that's not implemented yet.
Note: this can not only be used to decide whether to accept a call or not. You could as well use it to display the caller ID on an external LCD screen, in an X11 window, print it, initiate a D-Channel Callback, or do whatever you want that needs the Caller ID data.
Note2: be careful what kind of programs you call! They run with user id 0 (root), so that could easily be a security risk if you're not careful.
Go to the first, previous, next, last section, table of contents.