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;
}
}
}