Asterisk name and location lookup AGI Daemon
Display name or location ('Lc') of caller on your
IP /
VoIP or
soft
SIP
phones;
Flowchart:
This software is highly experimental and not thoroughly tested.
The same applies to the install script.
The install script should support both SysV / Insserv and Systemd.
Please make sure that this is indeed the case.
Furthermore all of this is very Debian Linux oriented. You may need to
change stuff for other distributions.
If you feel I should change something,
please let me know.
Current version of tar: 2024-11-14 10:15:52 UTC
General
This document mainly contains information about how namelookup.agid
is different from namelookup.agi. So it's probably a good idea to read the
namelookup.agi documentation first.
You need the utils that come with namelookup.agi.
You should at least compile (with make wide) and install
agiconf and install the following man pages:
'agiconf.1', 'agi-nameblock.db.5', 'agi-namelookup.conf.5', 'confagi.conf.5'
and 'weblookup.conf.5'.
You also need the compact
numbers, areas and regions databases.
Differences
-
namelookup.agid is a network daemon, namelookup.agi is not;
On startup namelookup.agid will fork and go to the background.
It will start a new thread per incoming connection. After processing the
request, the thread is terminated.
Note: Before terminating the thread, it will shutdown the socket, wait
100 ms and then close the socket. If 100 ms is too short
(which is very unlikely), you need to increase 'ANLD_CLS_SOCK_TIM' in
'common.h' and recompile.
-
There is no compact file option;
Files are always compact.
-
There is no WIDE compile option (make wide) for namelookup.agid;
name and location length are always 'WIDE' (71 bytes).
Compact files generated with a non-wide agiconf
can be used with this daemon.
'agi-nameblock.db' however, does not have a compact equivalent. There is
a block2wide' util which converts a 31-byte name length blocklist to a
71-byte name length blocklist. It reads from stdin and writes to stdout.
Alternatively, (re)compile agiconf with the WIDE option (make wide) and
generate compact databases.
-
There is always a blacklist check after a web look up.
-
The program changes the default dir to it's home directory on startup.
You can chance the default dir with the '-c' option.
-
Logging has micro second resolution and a timezone.
-
Logging is done to '/var/local/log/namelookup/namelookup.log'.
Unless the '-c' option is used, in which case it's in the directory set
with the '-c' option.
Note: '/var/local/log/namelookup/' needs to be writeable by the process
owner.
-
Debug ('-d') does NOT use the default dir. You can set the default dir
with '-c'.
-
There is no dump HTML source to log ('-D') option.
New
-
An optional
'/etc/namelookup-agi/namelookup.acl'
ACL file.
-
An '-a' automatic ACL option;
Automatically create an access control list which limits access to the LAN.
This is like being behind NAT. Even when you're not.
-
A '-c' option sets the default dir.
Note: There is no '-l' option.
-
A '-n' number of threads option. This sets the maximum number of threads.
Set this one or two higher than the maximum number of simultaneously
incoming telephone calls.
Default: 16
Note: On startup the software allocates ca 10 kB memory per thread.
-
A '-p' port number option.
Default: 4573 (FastAGI).
If you are already using FastAGI for something else, set this to an
other unused port number. For instance 4574.
-
An '-u' user option.
This sets both user and group.
The home directory is the home dir of this user.
Note: When you use the numeric UID instead of the user's name, the
software will assume the GID to be identical to the UID. This is not
necessary the case.
It is therefore recommended to use the user's name instead of the UID.
The software will then look up the user's group and GID.
Note: There is no '-l' option.
-
A 'namelookup.pid' PID file.
If '/run/namelookup/' exists it's in this directory, otherwise it's
in /run/.
Unless the '-c' option is used, in which case it's in the directory
set with the '-c' option.
Note: '/run/namelookup/' needs to be writeable by the process owner.
-
A SIGUSR1 will close and then reopen de log.
Use this after a logfile rotation.
Notes
-
There is no reload.
The databases are loaded on startup and remain in memory. You have to
restart (stop and then start) to load new databases.
-
Config files are compatible with namelookup.agi.
Except that the compact option is ignored; Files are always compact.
Options
Namelookup.agid options;
namelookup.agid [-a] [-c confdir] [-d] [-h] [-n threads] [-p port] [-u user] [-v]
- -a
-
Automatic ACL.
Finds all interfaces on this host. Allows access from all LOCAL
networks connected to those interfaces.
Note: Interfaces that aren't up when namelookup.agid is started are not
added to this ACL.
Note: use of the '-a' option disables use of the ACL file.
- -c
-
Alternate configuration directory.
Look in this directory for config files and databases.
With this set it will change to this directory and write the pid file and
log file to this directory. This can be handy for debug purposes.
- -d
-
Enable debug.
See '-c' option.
- -h
-
Print help and exit.
- -n Number of threads
-
2 to 1024.
Set this one or two higher than the maximum number of simultaneously
incoming telephone calls.
Default: 16
- -p Port number
-
Port to listen on.
1024 to 65535.
Default: 4573
If you are already using FastAGI for something else, set this to an other
unused port number. For instance 4574.
- -u User
-
This also sets the group.
Note: When you use the numeric UID instead of the user's name, the software
will assume the GID to be identical to the UID. This is not necessary the
case. It is therefore recommended to use the user's name instead of the UID.
The software will then look up the user's group and GID.
- -v
- Print version and exit.
Download and install
- Download: namagid.tar.gz
- Extract with: tar xvfz namagid.tar.gz
- cd namagid/
- Run make.
- Run make install (as root).
Note: The install script creates user and group 'namelookup'.
Note: You may need to edit '/etc/default/namelookup-agid' before startup.