LDAP integration for Asterisk
The "light weight directory" offers a means for central user administration for your network, including VoIP data.To integration openldap with Asterisk
First Install and Configure the Openldap Server
After Installation Asterisk
In Extconfig.config do Following Changes
; sipusers => ldap,"dc=myDomain,dc=myDomainExt",sip
; sippeers => ldap,"dc=myDomain,dc=myDomainExt",sip
; extensions => ldap,"dc=myDomain,dc=myDomainExt",extensions
; sip.conf => ldap,"dc=myDomain,dc=myDomainExt",config
; voicemail => ldap,"dc=myDomain,dc=myDomainExt",voicemail
And In res_ldap.conf
[_general]
; Specify one of either host and port OR url. URL is preferred, as you can
; use more options.
;host=192.168.1.1 ; LDAP host
;port=389 ;Ldap port
;url=ldap://ldap3.mydomain.com:3890
;protocol=3 ; Version of the LDAP protocol to use; default is 3.
;basedn=MyRootDN ; Base DN
;user=MyDN ; Bind DN
;pass=MyPassword ; Bind password
And
[config]
;
; additionalFilter - This specifies an additional set of criteria to be used
; when querying the LDAP server.
additionalFilter=(objectClass=AstConfig)
;
filename = AstConfigFilename
category = AstConfigCategory
variable_name = AstConfigVariableName
variable_value = AstConfigVariableValue
cat_metric = AstConfigCategoryMetric
commented = AstConfigCommented
[extensions]
context = AstExtensionContext
exten = AstExtensionExten
priority = AstExtensionPriority
app = AstExtensionApplication
appdata = AstExtensionApplicationData
additionalFilter=(objectClass=AstExtension)
[sip]
name = cn
amaflags = AstAccountAMAFlags
callgroup = AstAccountCallGroup
callerid = AstAccountCallerID
directmedia = AstAccountDirectMedia
context = AstAccountContext
dtmfmode = AstAccountDTMFMode
fromuser = AstAccountFromUser
fromdomain = AstAccountFromDomain
fullcontact = AstAccountFullContact
fullcontact = gecos
host = AstAccountHost
insecure = AstAccountInsecure
mailbox = AstAccountMailbox
md5secret = realmedPassword ; Must be an MD5 hash. Field value can start with ,{md5} but it is not required.
nat = AstAccountNAT
deny = AstAccountDeny
permit = AstAccountPermit
pickupgroup = AstAccountPickupGroup
port = AstAccountPort
qualify = AstAccountQualify
restrictcid = AstAccountRestrictCID
rtptimeout = AstAccountRTPTimeout
rtpholdtimeout = AstAccountRTPHoldTimeout
type = AstAccountType
disallow = AstAccountDisallowedCodec
allow = AstAccountAllowedCodec
MusicOnHold = AstAccountMusicOnHold
regseconds = AstAccountExpirationTimestamp
regcontext = AstAccountRegistrationContext
regexten = AstAccountRegistrationExten
CanCallForward = AstAccountCanCallForward
ipaddr = AstAccountIPAddress
defaultuser = AstAccountDefaultUser
regserver = AstAccountRegistrationServer
lastms = AstAccountLastQualifyMilliseconds
additionalFilter=(objectClass=AsteriskSIPUser)
[voicemail]
context = AstAccountContext
mailbox = AstAccountMailbox
password=AstAccountPassword
email=AstAccountEmail
pager=AstAccountPager
tz=AstAccountTz
attach=AstAccountAttach
saycid=AstAccountSaycid
dialout=AstAccountDialout
callback=AstAccountCallback
review=AstAccountReview
operator=AstAccountOperator
envelope=AstAccountEnvelope
sayduration=AstAccountSayduration
saydurationm=AstAccountSaydurationm
sendvoicemail=AstAccountSendvoicemail
delete=AstAccountDelete
forcename=AstAccountForcename
forcegreetings=AstAccountForcegreetings
hidefordir=AstAccountHidefordir
stamp=AstAccountStamp
In extensions.conf
exten => 1234,1,LDAPget(CIDNAME=cidname/${CALLERIDNUM},${CALLERIDNUM},${CALLERIDNUM})
exten => 1234,2,SetCIDName(${CIDNAME})
exten => 1234,3,Dial(SIP/${EXTEN},15