Asterisk Active directory schema extension
I came across a request where a client want to add Asterisk LDAP extenstion attributes to get populated in Windows active directory. After searching internet, i didn’t come across a single help article to do that. After doing lot of research i was able to get this done.
The goal is go get the following attributes populated in AD, so that asterisk can create extensions based on these attributes
New Attributes need to be populated in AD:
AstAccountCallerID: Russell Bryant
AstAccountContext: LocalSets
AstAccountDTMFMode: rfc2833
AstAccountMailbox: 101@shifteight
AstAccountNAT: yes
AstAccountQualify: yes
Existing Attributes in AD
displayName: Russell Bryant
uidNumber: 1001
gidNumber: 10001
userPassword: {md5}a7be810a28ca1fc0668effb4ea982e58
uid: rbryant
Steps follows:
Create the attributes in Active directory schema
Open command prompt and type regsvr 32 schmmgmt.dll
from command prompt type mmc and add active directory schema management console
Right click on any of the attribute and go into properties. Copy the ID number
we need last 4 digits to be unite for each new custom attributes, I decided to use 33200 and onward five digit number, it will look like
right click on attribute and click on create attribute.
Ignore the warning and add the attribute, as asterisk just need to see values and string can take any kind of value I choose “Unicode String†in the syntax
Click ok and add rest of the attributes in exactly same way, make sure you use unique X500 OID for rest of the attributes, like in above example the last digits are 33201 and now for next attribute, use 33202 in the OID for last 5 digits.
Add the attributes to “user†class
Expand classes and look for “user†class
Right click on user and select properties, select attribute tab in the properties window. Add the newly created attributes and click on ok. MMC may give you error but it usually adds the attributes to user class. If MMC crash, re-pen and make sure the attributes are showing in the user class.
Import the user attributes using ldifde utility. create the file in following format and save it as .ldf file.
dn: CN=Russell Bryant,OU=Employees,DC=domain,DC=local
changetype: modify
add: AstAccountCallerID
AstAccountCallerID: Russell Bryant
–
add: AstAccountContext
AstAccountContext: LocalSets
–
add: AstAccountDTMFMode
AstAccountDTMFMode: rfc2833
–
add: AstAccountMailbox
AstAccountMailbox: 101@shifteight
–
add: AstAccountNAT
AstAccountNAT: yes
–
add: AstAccountQualify
AstAccountQualify: yes
–
add: uidNumber
uidNumber: 1001
–
add: gidNumber
gidNumber: 10001
–
add: userPassword
userPassword: {md5}a7be810a28ca1fc0668effb4ea982e58
–
you need to use – after every attribute ldifde treat it as terminator. Save the file as .ldf file.
import the file using following command.
ldifde -i –f <filename> –s <DC name> in my case I used
ldifde -i -f Exportuser.ldf –s spi-dc05
Please contact us if you need any assistance or have any questions related to this post.