login | register
Fri 10 of Oct, 2008 [23:19 UTC]

voip-info.org

Discuss [1] History

Asterisk cmd LDAPget

Created by: szunny,Last modification on Thu 12 of Jan, 2006 [17:55 UTC] by andres

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.
and it's downloadable from here

See also


Go back to Asterisk


Comments

Comments Filter
222

333more power to you

by sjobeck, Wednesday 24 of August, 2005 [23:17:46 UTC]
(:razz:)

More power to you.

This is a fantastic idea, piece of code, notion.

I figure everything in the world ought to be two things, certificate-based & LDAP-based. I suppose if we authenticate everything (ie: log-in's, call privileges, et cetera, et cetera) via LDAP, then we are 2/3 the way there.

As soon as our entire organization (ie: including calls) can be authenticated & encrypted via certificates (ie: which I understand is on the way), then I will crack open a frosty one & relax.

Thanks again.

Peace. Love. Linux.

Jason