Lightweight Directory Access Protocol

LDAP is an open-standard protocol for accessing X.500 directory services. The protocol runs over Internet transport protocols, such as TCP.

LDAP is a lightweight alternative to the X.500 Directory Access Protocol (DAP) for use on the Internet. It uses TCP/IP stack verses the overly complex OSI stack. It also has other simplications, such as the representing most attribute values and many protocol items as textual strings, that are designed to make clients easier to implement.

The directory is a database optimized for read operations.

You can access an LDAP directory in your dialplan with LDAPget.

You can use Asterisk::LDAP to generate Asterisk 1.0 compatible configuration files from LDAP.

The Source of application module LDAPget can be
downloaded from: http://www.mezzo.net/asterisk

Asterisk Ldap Realtime Usage

res_config_ldap.c is now part of the Asterisk 1.6.x Beta releases (as of Feb 2008). Download any asterisk 1.6.x beta release greater than 1.6.0beta2 and follow these:

Files you need to alter:
  • /etc/asterisk/extconfig
  • /etc/asterisk/res_ldap.conf
  • /etc/asterisk/extensions.conf (for realtime extensions)

Known Bugs:
  • Pattern matching extensions do NOT work
  • Queue Member lookup fails

To save on time, I am pasting my configuration files here. Please note that:

  • res_ldap.conf is a simple mapping of Asterisk Realtime values to ldap objects (you can name your ldap objectclasses/attributes whatever you want!)
  • Schema provided with the distribution does not conform to res_ldap.conf in the distribution. use THIS schema instead
A lite note: it is best to rename your current res_ldap.conf and replace it with the attachement here. or copy the content of this attachement into the res_ldap.conf

my extconfig:

sipusers => ldap,"dc=emergen,dc=biz",sip
sippeers => ldap,"dc=emergen,dc=biz",sip
voicemail => ldap,"dc=emergen,dc=biz",voicemail
voicemail_data => ldap,"dc=emergen,dc=biz",voicemail
extensions => ldap,"dc=emergen,dc=biz",extensions
queues => ldap,"dc=emergen,dc=biz",queue
queue_members => ldap,"dc=emergen,dc=biz",queue_member
musiconhold => mysql,asterisk
queue_log => mysql,asterisk
meetme => ldap,"dc=emergen,dc=biz",meetme
; A little note: Copy this piece and place it at the bottom of the extconfig.conf

In extension.conf (For Realtime Extensions) you need to enable the switch to Realtime in that particular context:

For example:

switch => Realtime/@

A sample res_ldap.conf file is attached here with complete mappings which adheres to the schema provided above:

IMPORTANT NOTICE regarding res_ldap.conf: DON'T use quotes (") for basedn=... and user=... configuration entries. Otherwise asterisk will include the quotes in DN which results in "Invalid DN syntax" error messages. I haven't check the rest of the config file, but this is definitely an error in that (using asterisk The following syntax worked for me:


There is an auto install script available for installing asterisk 1.2 with realtime ldap driver support, check it out http://cyrenity.wordpress.com/2008/12/28/asterisk-12-with-realtime-ldap-driver/

Created by: szunny, Last modification: Thu 04 of Nov, 2010 (05:17 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+