[asterisk-users] Contact lookup

Gordon Henderson gordon+asterisk at drogon.net
Tue Feb 3 10:51:11 CST 2009


On Tue, 3 Feb 2009, Geoff Lane wrote:

> Hi All,
>
> Asterisk 1.4.12 on CentOS 5
>
> I'd like to be able to look up each incoming CLI to retrieve an
> associated name, if available, and then pass that to the extensions so
> that they can see both the name and number of the caller. I'm not
> after LDAP or anything else maintained externally, just a contact
> lookup for my system.
>
> I suspect that Astdb could be used for this, as could a relational
> database like MySQL or postgres (accessed via AGI?) Probably simpler
> would be to maintain a text configuration file since I'm only
> concerned about less than a hundred entries initially.
>
> I'd appreciate insight into which is the easiest way to do this, and
> also any pointers to tutorials etc.

AstDB:

At it's very simplest:

exten => s,n,Set(CALLERID(name)=Unknown)
exten => s,n,Set(name=${DB(cid/${CALLERID(number)})})
exten => s,n,GotoIf($["${name}" = ""]?endCID)
exten => s,n,Set(CALLERID(name)=${name})
exten => s,n(endCID),Noop(fixCallerID - End of processing - returning ${CALLERID(all)})

... somewhere in the incoming processing. (This is an extract from an 
overly complcated macro I use) Things to check for - a name already being 
present - eg. on an incoming SIP call. No name in the astDB - might want 
to substitute "Unknown" ..

All you need to do now is populate the astDB - I use a web interface and 
some php to drive the manager interface...

My biggest site has just under 300 lookup entries... (Which presents other 
issues with the web interface, but ...)

Gordon




More information about the asterisk-users mailing list