[Freeswitch-users] Problems with xml_curl and directory

Anthony Minessale anthmct at yahoo.com
Tue Feb 5 09:08:20 EST 2008


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 at hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
IRC: irc.freenode.net #freeswitch

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


----- Original Message ----
From: Jonas Gauffin <jonas.gauffin at gmail.com>
To: freeswitch-users at 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 at lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org






      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20080205/3cd7e01c/attachment.html 


More information about the Freeswitch-users mailing list