route_request{
route(REGISTRAR);
}
---
route[REGISTRAR] {
if (!is_method("REGISTER")) return;
if(isflagset(FLT_NATS))
{
setbflag(FLB_NATB);
#!ifdef WITH_NATSIPPING
setbflag(FLB_NATSIPPING);
#!endif
}
if (!save("location"))
sl_reply_error();
exit;
}
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)");if (!pv_www_authenticate("$td", "$avp(password)", "4")){www_challenge("$td", "1");exit;}route(REGISTRAR);sl_send_reply("200", "ok");exit;}else{www_challenge("$td", "1");exit;}}}
Are you using Kamailio’s usrloc module? If so, at what point do you save(‘location’)?
From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Safdar Khan
Sent: 21 January 2016 12:24
To: Kamailio (SER) - Users Mailing List <sr-users@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;
}
}
}
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users