[Asterisk-Users] Cisco LDAP directory
Jeff Gustafson
ncjeffgus at zimage.com
Tue Mar 2 17:38:43 MST 2004
On Mon, 2004-03-01 at 22:09, Andreas Anderson wrote:
> Hi,
>
> does anyone has an LDAP based directory for the Cisco 7900 Series? I found
> some directorys based on
> sql, but an ldap directory would allow syncronisation with evolution,
> mozilla, multisync (Palm, OPIE, Mobile phones etc...)
>
> Greez Andreas
Here's a simple one:
<?php
$ds=ldap_connect("ldapserver"); // must be a valid LDAP server!
if ($ds) {
$r=ldap_bind($ds); // this is an "anonymous" bind, typically
// read-only access
// Search surname entry
$sr=ldap_search($ds, "ou=People,dc=domainname,dc=com",
"telephoneNumber=*");
echo "<CiscoIPPhoneDirectory>\n";
echo "<Title>IP Telephony Directory</Title>\n";
echo "<Prompt>People reachable via VoIP</Prompt>\n";
$info = ldap_get_entries($ds, $sr);
for ($i=0; $i<$info["count"]; $i++) {
echo "<DirectoryEntry>\n";
echo "<Name>" . $info[$i]["cn"][0] . "</Name>\n";
# print_r($info);
echo "<Telephone>" . $info[$i]["telephonenumber"][0] .
"</Telephone>\n";
echo "</DirectoryEntry>\n";
}
echo "</CiscoIPPhoneDirectory>";
ldap_close($ds);
} else {
echo "error";
}
?>
More information about the asterisk-users
mailing list