Well you have to make some decisions here... either use domain or IP not either.  So your users should NOT be allowed to register to the IP and only use the DNS name.  Thats my opinion... else you have to dive into the registration db... and it gets messy.

/b

On Mar 3, 2011, at 3:06 PM, Dmitry Sytchev wrote:

Seems I didn't explain clean what I'm trying to achieve.

I have a domain, say, access.test.com. My users can use srv records to reach
it, or specify server's address directly as IP.
Default configuration with domain="all" works like a charm.

Then I moved from static files to xml_curl directory in database. Now every
time user registers I should respond with directory record, containing
domain in which user is trying to register, so I need to respond with IP if
user registers with IP, and with name if user registers with name. I do this
having DomainAlias table in my DB.

After user registration, I need to bridge calls to it by my routing rules.
But I don't know exactly how to instruct freeswitch to lookup user's
contact, since I don't know in which domain user is registered. I don't want
to interact with Freeswitch registration database, as it decreases
flexibility of solution.

At present I use force-register-domain set to my domain name, but I want to
use several names with different aliases, so looking for another solution =)