LDAPget
Synopsis
Retrieve a value from an LDAP directory server (e.g. OpenLDAP or ActiveDirectory).
LDAPget does not require you to use a specific LDAP schema.
Description
LDAPget(varname=config-file-section[/key1,key2,…])
To lookup the Caller-ID’s name you could configure your extensions.conf like this:
exten => 1234,1,LDAPget(CALLERIDNAME=cidname/${CALLERIDNUM},${CALLERIDNUM})
The corresponding section In the ldap.conf file could look like this:
[cidname]
host = ldap.mydomain.com
version = 3
user = cn=root,ou=People,o=mydomain.com
pass = secret
filter = (&(objectClass=person)(|(telephoneNumber=%s)(fax=%s)))
base = ou=Addressbook,o=mydomain.com
The “%s”s will be replaced by key1,key2, etc.
Asterisk variables in ‘filter’ and ‘base’ will also be evaluated. So you could also write the example above like this:
exten => 1234,1,LDAPget(CALLERIDNAME=cidname)
with the following filter in ldap.conf
filter = (&(objectClass=person)(|(telephoneNumber=${CALLERIDNUM})(fax=${CALLERIDNUM})))
TIP: On Mac OS you can use AddressBook2LDAP to Export your AddressBook to an LDAP directory.
Return values
Always returns 0. If the requested key is not found, jumps to priority n+101 if available.
Version information
LDAPget() is not included in Asterisk releases or CVS, it’s a third party application.
See also
- LDAP
- ldap.conf
- Asterisk::LDAP – a totally different, unrelated approach
- Authenticate_LDAP
Go back to Asterisk