[OpenSER-Users] automatically generated aliases with usrloc and ldap
Daniel-Constantin Mierla
miconda at gmail.com
Wed Mar 26 22:03:23 CET 2008
Hello,
On 03/26/08 22:19, Lukasz Stelmach wrote:
> Greetings All.
>
> I have managed to set up OpenSER with LDAP authentication. Now I would
> like it to create memory cached aliases each time a user registers. I
> do not wan to use any persistent storage because I have it already it
> is my LDAP directory. However, I would like OpenSER to cache those
> aliases as doing ldap lookup for every message does not look too apealing
> to me.
>
> Let me explain how I see it:
>
> if (is_method("REGISTER"))
> {
> if(is_present_hf("Proxy-Authorization"))
> {
> if (!ldap_search("ldap://sipaccounts/ou=dept,o=TELMARK,c=PL?uid,mail,uidNumber,userPassword?one?(uid=$f))
> { #error handling }
>
> ldap_result("uid/$avp(s:username)");
> ldap_result("userPassword/$avp(s:password)");
> ldap_result("mail/$avp(s:longalias)");
> ldap_result("uidNumber/$avp(s:numalias)");
>
> if(pv_proxy_authorize("telmark"))
> {
> proxy_challenge("telmark", "1");
> exit;
> }
> } else {
> proxy_challenge("telmark", "1");
> exit;
> }
>
> if(!save("location"))
> sl_reply_error();
>
> # And here the big thing!
> }
>
> What to do to make
>
> save("aliases");
>
> (called twice) save uidNumber and mail (without @domain, these are
> transformations, I know) as aliases in usrloc?
>
save() function is exported by registrar module and it saves the contact
address from REGISTER message along with several other attributes to
usrloc, in a table mentioned by the parameter. There is no clean
solution for what you want with registrar/usrloc modules now. AFAIK ldap
is very fast for search operations, but, of course, there could be other
delays from the network.
However, you can try a hack:
- after save() replace the contact address and other headers (e.g., To)
with what you need using text/header operations exported by textops module
- send the REGISTER to server itself
- don't authenticate REGISTERs coming via loopback (from server iself)
- use save_noreply() to save to aliases table
Should work.
Cheers,
Daniel
>
>
> PS. Please cc answers I am not a subscriber.
>
More information about the Users
mailing list