Tried earlier like this:
287 ldap_result("memberOf/$avp(s:ldapmemberof)");
288 xlog("L_INFO", "LDAP $fU memberOf =
$avp(s:ldapmemberof)");
289 while (ldap_result_next()) {
290 xlog("L_INFO", "if loop ldap_result");
291 ldap_result("memberOf/$avp(s:ldapmemberof)");
292 xlog("L_INFO", "LDAP $fU memberOf =
$avp(s:ldapmemberof)");
293 }
294 xlog("L_INFO", "end ldap_result_next while");
Can see in log file output from line 288, but while loop doesn’t start at all. Captured
output with ngrep and it shows that i’m receiving all 7 memberOf attributes.
Log output:
Sep 5 10:03:28 localhost /usr/local/sbin/kamailio[5798]: INFO: <script>: fU =
virmantas.variakojis
Sep 5 10:03:28 localhost /usr/local/sbin/kamailio[5798]: INFO: <script>: LDAP
virmantas.variakojis memberOf = CN=AAAAAAAA,OU=Rights
Assignment,OU=Groups,DC=office,DC=xxxxxx,DC=yy
Sep 5 10:03:28 localhost /usr/local/sbin/kamailio[5798]: INFO: <script>: end
ldap_result_next while
On 05 Sep 2014, at 11:33, Daniel-Constantin Mierla <miconda(a)gmail.com> wrote:
Hello,
On 04/09/14 14:49, Virmantas Variakojis wrote:
Hi,
I'm trying to fetch attribute list with kamailio ldap_search:
ldap_search("ldap://agents/ou=Xxxxx,dc=xxxx,dc=yyyyyy,dc=zz?memberOf?sub?(sAMAccountName=$fU)");
ldap_result("memberOf/$avp(s:ldapmemberof1)");
xlog("L_INFO", "LDAP $fU memberOf = $avp(s:ldapmemberof1)");
if (ldap_result_next())
{
xlog("L_INFO", "if loop ldap_result");
ldap_result("memberOf/$avp(s:ldapmemberof2)");
xlog("L_INFO", "LDAP $fU memberOf =
$avp(s:ldapmemberof2)");
}
There's must be seven returning attributes list of memberOf, but I can only retrieve
only one of them (looks like last of seven). First xlog output log into my log file, but
if loop didn't start. What I'm doing wrong?
IF is not a loop, it does one time testing. If you want a loop, then use WHILE, like:
while(ldap_result_next()) {
...
}
Cheers,
Daniel
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda -
http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 -
http://www.asipto.com
Sep 22-25, Berlin, Germany
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users