System information

configure how Asterisk is going to connect to our LDAP server. Our first option is
url, which will determine how to connect to the server. We have defined a connection
as ldap://172.16.0.103:389, which will connect to the LDAP server at IP address
172.16.0.103 on port 389. If you have a secure connection to your LDAP server, you
can replace ldap:// with ldaps://. Additionally, we have set protocol=3 to state that
we’re connecting with protocol version 3, which in most (if not all) cases will be correct.
The last three options, basedn, user, and pass, are used for authenticating to our LDAP
server. We need to specify:
The basedn (dc=shifteight,dc=org), which is essentially our domain name
The user name we’re going to authenticate to the LDAP server as (admin)
The password for the user to authenticate with (canada)
If we put it all together, we end up with something like the following:
[_general]
url=ldap://172.16.0.103:389
protocol=3
basedn=dc=shifteight,dc=org
user=cn=admin,dc=shifteight,dc=org
pass=canada
Beyond this, in the rest of the sample configuration file we’ll see lots of templates we
can use for mapping the information in Asterisk onto our LDAP schema. Lets take a
look at the first lines of the [sip] template that we’ll be using to map the information
of our SIP peers into the LDAP database:
[sip]
name = cn
amaflags = AstAccountAMAFlags
callgroup = AstAccountCallGroup
callerid = AstAccountCallerID
...
lastms = AstAccountLastQualifyMilliseconds
useragent = AstAccountUserAgent
additionalFilter=(objectClass=AsteriskSIPUser)
On the left side we have the field name Asterisk will be looking up, and on the right is
the mapping to the LDAP schema for the request. Our first set of fields is mapping the
name field to the cn field on the LDAP server. If you look back at the data we imported
in “Configuring OpenLDAP” on page 435, you’ll see that we have created a user and
assigned the value of RussellBryant to the cn field. So, in this case, we’re mapping the
authentication name (the name field) from the SIP user to the value of the cn field in the
LDAP server (RussellBryant).
This goes for the rest of the values all the way down, with some fields (i.e., useragent,
lastms, ipaddr, etc.) simply needing to exist so Asterisk can write information (e.g.,
registration information) to the LDAP server.
438 | Chapter 18:External Services