This is the Astium Daemon. It connects to one or more asterisk 
servers, and to the Astium database.

It keeps internal memory database copies of critical database tables,
for fast access, and tables of asterisk channels.

From the asterisk servers it receives status updates through
the Manager Interface, and uses these to channel statuses
to create statuses for persons, trunks, and queues.

All this to facilitate *lots* of clients connecting to this
daemon, who retrieve copies of the database tables, and
receive status info on contacts, queues, trunks, etcetera.
These clients can subscribe to contacts, trunks, or queues
to receive update events on them, and display those to the
end-users.

So basically the Astium Daemon is a program that converts channel
statuses into contact, trunks, and queue statuses.
Also it writes register, unregister, reachable messages
to the database.

It is *very* important that a client request can be fullfilled
without disk I/O, so all client interaction is done in a single 
thread using the super-fast libevent library, and all disk I/O is 
done in separate threads.
To improve speed, all memory allocation is done using the g_slice()
functions instead of g_malloc(), which is much faster if your
datastructures have a fixed size. 

Source file layout:

astiumd.c	- general init, signals, main loop, logging function.
config.c	- reads configuration file and starts threads as needed.
cli.c		- Command Line Interface thread. By default on port 5656.
asterisk.c	- Handles asterisk connections. These connections are managed
                  by libevent. If some function within astiumd wants to
                  write a message to some asterisk, it posts that message
                  to a queue, there is a separate thread to empty this
                  queue and actually write it out to asterisk.
                  Incoming asterisk messages are processed by libevent first
                  and then handed over to asterisk-event.c
asterisk-event.c  process all data coming in on an asterisk manager interface.
astchannel.c	- Keeps state of asterisk channels
database.c	- creates a database thread. Queries are posted to a queue, and
                  the threads empties the queue, and excutes the queries.
                  Other threads in the system (but not the libevent thread)
                  can read from the database at will. There is only one database
                  connection.
server.c	- Handles connecting desktop clients
client-action.c	- Handles Action requests from connected desktop clients.
client-event.c	- Handles Events from connected desktop clients.
table.c		- Generic functions for handling table suscribtions.
table-*.c	- Table specific functions.
util.c		- Various utility functions
dial.c		- Functions for Originating calls


