Posted: Wed Mar 09, 2005 2:20 am Post subject: [Asterisk-doc] Simple tweaks and customisations: LookupCIDN
Simple tweaks and customisations
Asterisk has a useful feature if you subscribe to callerID or use it
internally at your installation. A one-line call to the application
LookupCIDName will set any name you want to be associates with an
incoming number for display on phones and workstation callerid popups.
Sometimes the names sent by the phone company are not specific enough.
If your local install has a lot of user extensions, "Support: Bernie" is
better than "2002".
Using the feature is simple. Early in a dialplan extension that
processes incoming calls, you just add this line:
exten => s,6,LookupCIDName
This will look up the number in the asterisk database and if a key is
found in the cidname family, it will place that value into
${CALLERIDNAME} replacing what was there before, if anything, during
this extension execution.
From the CLI, type database show cidname for the full list or
database show cidname/0102030405
A few simple shell scripts can help you get the list started and
maintain it:
To add a name to a number create a command called "cidset":
/usr/sbin/asterisk -rx "database put cidname $1 \"$2\""
./cidset 0102030405 "His Majesty the Boss"
Updated database successfully
To show a name associated with a number, or the whole list, we'll create
"cidshow":
if [ ! "$1" = "" ]; then
/usr/sbin/asterisk -rx "database show cidname/$1"
else
/usr/sbin/asterisk -rx "database show cidname"
fi
./cidshow 0102030405
/cidname/0102030405 : His Majesty the Boss
If you already have a list of phone correspondants in electronic form,
you can see how simple it would be to insert it into the asterisk db
with a simple script.
Asterisk has a useful feature if you subscribe to callerID or use it
internally at your installation. A one-line call to the application
LookupCIDName will set any name you want to be associates with an
incoming number for display on phones and workstation
callerid popups.
Sometimes the names sent by the phone company are not
specific enough.
If your local install has a lot of user extensions, "Support: Bernie"
is better than "2002".
Using the feature is simple. Early in a dialplan extension that
processes incoming calls, you just add this line:
exten => s,6,LookupCIDName
This will look up the number in the asterisk database and if a key is
found in the cidname family, it will place that value into
${CALLERIDNAME} replacing what was there before, if anything, during
this extension execution.
From the CLI, type database show cidname for the full list or
database show cidname/0102030405
A few simple shell scripts can help you get the list started and
maintain it:
To add a name to a number create a command called "cidset":
/usr/sbin/asterisk -rx "database put cidname $1 \"$2\""
./cidset 0102030405 "His Majesty the Boss"
Updated database successfully
To show a name associated with a number, or the whole list,
we'll create
"cidshow":
if [ ! "$1" = "" ]; then
/usr/sbin/asterisk -rx "database show cidname/$1"
else
/usr/sbin/asterisk -rx "database show cidname"
fi
./cidshow 0102030405
/cidname/0102030405 : His
Majesty the Boss
If you already have a list of phone correspondants in
electronic form,
you can see how simple it would be to insert it into the asterisk db
with a simple script.
Posted: Wed Mar 09, 2005 8:12 am Post subject: [Asterisk-doc] Simple tweaks and customisations: LookupCIDN
Quote:
This is a great recipe for the cookbook!
Not much of a recipe, more like a tweak or fragment, which I (as a
reader) find useful. I think an appendix called "tweaks and
customisations" or something like that is a good idea, though. That's
why I suggested it.
Quote:
Admit it, you want to write!
It's so much easier to read and correct though :)
Quote:
The cookbook needs an editor!
I'd certainly consider maybe reading and testing recipes and suggesting
re-writes (not as a writer but as a user). Maybe also begging them from
people on IRC. At one time I had more free time and started to use the
doc format and submit stuff correctly, but that period was short-lived.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum