[SR-Users] Kamailio and openLDAP integration.

Phil Lavin phil.lavin at synety.com
Thu Jan 21 13:36:12 CET 2016


Are you using Kamailio’s usrloc module? If so, at what point do you save(‘location’)?


From: sr-users [mailto:sr-users-bounces at lists.sip-router.org] On Behalf Of Safdar Khan
Sent: 21 January 2016 12:24
To: Kamailio (SER) - Users Mailing List <sr-users at lists.sip-router.org>
Subject: [SR-Users] Kamailio and openLDAP integration.

Hi guys,
I have tried to integrate kamailio and ldap.It seems like both are taking to each other.
Here the purpose of ldap is for back-end support for sip user authentication rather than kamailio database.However i am able to log in but could not make call between sip users.I could not figure out what i am missing.

Here is the routing block for ldap in my kamailio.cfg


request_route {
        route(LDAPAUTH);

}
---
route[LDAPAUTH]
{
    if(is_method("REGISTER"))
    {
        if(is_present_hf("Authorization"))
        {
           if (!ldap_search("ldap://sipaccounts/ou=MyUsers,dc=example,dc=com?cn,userPassword?one?(cn=$fU)"))
            {
                switch ($retcode)
                {
                    case -1:
                       sl_send_reply("404", "User Not Found");
                       exit;
                    case -2:
                       sl_send_reply("500", "Internal server error");
                       exit;
                    default:
                       exit;
                }
            }
            ldap_result("cn/$avp(username)");
            ldap_result("userPassword/$avp(password)");
            route(REGISTRAR);
            if (!pv_www_authenticate("$td", "$avp(password)", "4"))
           {
                 www_challenge("$td", "1");
                    exit;
            }
            sl_send_reply("200", "ok");
            exit;
        }
        else
        {
            www_challenge("$td", "1");
            exit;
        }
    }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160121/9b825a78/attachment.html>


More information about the sr-users mailing list