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. TIA, -- Geoff
There are some good examples of this at voip-info.org. Shouldn't this be
handled by normal caller-id?
Anyhow, here's an AGI (PERL) example:
#!/usr/local/bin/perl
use Asterisk::AGI;
# the AGI object
my $agi = new Asterisk::AGI;
# send callback reference
my $rc = $agi->set_callerid('IM_A_CALLER');
$agi->say_digits('123');
$agi->send_text('call ext 106');
$agi->exec('Dial', 'SIP/102');
$agi->hangup();
exit;
This sends the message "call ext 106" to the phone display you call
from,
says "123" on the speaker, then calls SIP/102 and shows
"IM_A_CALLER" on the
display (the _ are there because "IM A CALLER" shows as
"IM".
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Geoff Lane
Sent: Tuesday, February 03, 2009 10:05 AM
To: Asterisk Users
Subject: [asterisk-users] Contact lookup
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.
TIA,
--
Geoff
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
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