mariusv.com

Watch as I awkwardly stumble through life

Asterisk – setting the caller id through an ldap lookup

Posted by Marius Voila on September 30, 2010 in London, U.K . — 0 comments This post contains 97 words

Having just upgraded to asterisk 1.6, I was faced with the problem of callerid lookup no longer working. We’d previously used the external LDAPGet module to lookup against our internal LDAP directory – but the module doesn’t compile in 1.6, so here’s a quick and dirty workaround which requires you have ldap-utils installed on your server.

In my extensions.conf : exten => _[a-zA-Z0-9].,9,Set(CALLERID(name)=${SHELL(ldapsearch -w thepassword -D “cn=admin,dc=mydomain,dc=com” -h ldapserver -b “ou=addressbook,dc=mydomain,dc=com” -s children “(&(objectClass=person)(telephoneNumber=${CALLERID(num)}))” cn | grep ^cn | cut -d: -f2 | xargs echo -n)}) Where I used to have : exten => _[a-zA-Z0-9].,9,LDAPget(CALLERID(name)=cidname)