Your mission, if you choose to accept it: maintain quotient.proto.sip,
quotient.proto.twisted_sip, and quotient.voiceup. You would do well to
review the CVS logs for these files: they have already stretched the
patience and sanity of several hackers near breaking. 

Nevertheless! Onward. twisted_sip is a copy of the stateless proxy
from twisted.protocols. Theoretically, it should merge back into
twisted eventually. Currently it is at variance due to some changes
made by Anthony Baxter to the Twisted version to support his SIP
client. I haven't reviewed the differences; I assume we'll want to
change this code some more anyway, so it stays for the moment.
RegisterProxy is the primary class here; it uses registry and locator
objects for dealing with user registration and looking up users.
Currently these roles are mostly fulfilled by InMemoryRegistry, which
is probably a bad idea: it should really be looking up the SIP powerup
on avatars and tweaking presence information there.

The main registry used by Quotient's SIP server is
MultiDomainRegistry, which keeps multiple InMemoryRegistry objects,
one for each domain. Also, I put DNS lookup code in there to deal with
calls to domains we don't handle. This will eventually need access
control, to only proxy those kinds of calls from registered users, and
we don't have it here yet. Also the commented-out RegisterProxy
subclass may be a better approach; I just skipped it because I didn't
understand what was going on in there until I had already finished the
resolver code in MultiDomainRegistry.

ForwardingRegistry forwards requests in any of our domains that we
can't resolve to Asterisk. It also looks up 'altcontact' on the voice
powerup for the user if it exists but isn't logged in; the idea being
to implement voicemail in this fashion. Again, we need access control
to keep from forwarding requests to landlines (and probably any other
asterisk extension) from sources other than registered users.

Other future projects in this area: 

  - tracking CDR information from asterisk for call billing.

  - storing presence information on the voice powerup, so the UI can
    render it.

  - stateful proxying, to deal with forking requests and SRV lookups
    producing multiple results.

  - machinery and UI for initiating calls from Quotient, sending the
    INVITE to both ends simultaneously.

  - further integration and/or subsumption of asterisk features, like
    voicemail, conferencing, and PSTN interfacing.

  - A scheme for dealing with users spread over multiple servers in a
    cluster.
