[asterisk-users] Contact lookup

D Tucny d at tucny.com
Tue Feb 3 19:04:30 CST 2009


2009/2/4 Gordon Henderson
<gordon+asterisk at drogon.net<gordon%2Basterisk at drogon.net>
>

> 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 ...)
>
> I use a slight variant of this...

exten =>
s,n,Set(CALLERID(name)=${IF(${ISNULL(${DB(cidname/${CALLERID(num)})})}?"Unknown":${DB(cidname/${CALLERID(num)})})})
exten => s,n,NoOp("Caller ID name mapped to ${CALLERID(name)}")

Basically the same as yours above (including substitution of Unknown when
not found), but, all on one line...

I've been looking into changing it recently such that where I don't have the
name I can substitute something more useful than Unknown, such as the site,
or for external calls, the country/province/state/city/type/telco/etc,
though that won't be in astdb due to the current 100s of thousands of
rows...

d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090204/7c72d507/attachment.htm 


More information about the asterisk-users mailing list