It works similar to how the dialplan hook works.

When the sip registration or attempted call comes
in with the authorization header, the mod_sofia will
do a directory lookup in the xml for the user/domain
combo specified in the request.

This is done by first requesting the entire domain then
iterating the <user> tags in that result.

So you have 2 choices when the request for the domain comes
in to your cgi.

1) Do exactly as it wants and deliver a <domain> with
all of the users for that domain and let the core find
the right one.

2) Look at the query params in the POST data where many
hints are provided about what the search is for (you may
find this familiar from the dialplan)
You can elect to find the exact user and return a <domain>
with just 1 <user> in it.

As far as doing the auth yourself you have 2 options as well.
 
1) store the a1-hash in your database and return that
   in the a1-hash user param 
   md5hash(<user>:<realm>:<pass>)

2) all the bits of the authorization header are passed to
   you in the POST data so you can perform the digest auth
   yourself in your cgi and return a user with no passwd
   param to indicate a successful auth.
   (exactly how to do that is out of the scope of this reply =])

  
sip_auth_username
sip_auth_realm
sip_auth_nonce
sip_auth_uri
sip_auth_qop
sip_auth_cnonce
sip_auth_nc
sip_auth_response
sip_auth_method



Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org
pstn:213-799-1400


----- Original Message ----
From: Jonas Gauffin <jonas.gauffin@gmail.com>
To: freeswitch-users@lists.freeswitch.org
Sent: Tuesday, February 5, 2008 4:30:02 AM
Subject: [Freeswitch-users] Problems with xml_curl and directory

Hello

I've used xml_curl for a while to supply a dialplan, and it works fine.
I'm now trying to get the directory working.

If I'm not remembering wrong, FS fetches the complete directory at
startup to be able to do presence managing, correct?
Anyway I provide a XML document when it's requested at startup:

<document type="freeswitch/xml">
<section name="directory"><domain name="192.168.1.124">
        <user id="janolov" mailbox="1202">
                <params />
                <variables>
                        <variable name="user_context" value="default" />
                        <variable name="effective_caller_id_name"
value="Jan-Olov Andersson" />
                        <variable name="effective_caller_id_number"
value="1202" />
                </variables>
        </user>
        <user id="jonas" mailbox="1201">
                <params />
                <variables>
                        <variable name="user_context" value="default" />
                        <variable name="effective_caller_id_name"
value="Jonas Gauffin" />
                        <variable name="effective_caller_id_number"
value="1201" />
                </variables>
        </user>
</domain></section>
</document>

I don't know if an empty "params" tag is required anymore, it was
before (when no password is used).

My problem is that registrations do not work when I'm using xml_curl
to fetch directory.
It does not fetch anything upon registration and nothing is written
into the console about the registration.

Everything works if I disable directory handling in xml_curl (it then
uses the standard config files and registration works fine).

Then I got a feature request. I would like to do then authentication
myself in the xml curl call, is that possible?
(FS supplies the password and I can reply with a status code that
indicates that the authentication was unsuccessful)
I'm storing passwords encrypted, and I can therefore not provide a
password back to FS.

Regards,
  Jonas

_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



Never miss a thing. Make Yahoo your homepage.