1. LookupCIDName - this application allows you to set a Caller ID according to the number of the incoming call.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

Syntax:

LookupCIDName() ;There are no arguments for this application

Purpose and usage

The purpose of this application is to check whether the Caller ID Number is within the Asterisk’s cidname database or not. If the number is in the database, the application will look the assigned name for this number and it will set it as Caller ID Name. If there is no Caller ID received, then the LookupCIDName application has no effect.

You can use this application to set a desired name to a definite number. For example you can create a database with the numbers in your company and you can assign to each number, the name of its corresponding owner.

It is useful, because you can do this centralized. The changes could be made from one place and there is no need to go to each separate phone and to make this configuration on it.

To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.

Asterisk PBX configurations

NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.

iax.conf Configurations

We need one registered user in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.

So, we have registered the user user1.

Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf. Callerid=test <1111> means that the Caller ID of this user will be test and the Caller ID Number of this user will be 1111. You have to write it in the shown way, because there is no separate option for Caller ID Number. This is the way to assign a number to a specific user.

Database Configurations

We have to assign a desired Caller ID Name to the desired Caller ID Number and to put them in the Asterisk’s cidname database.

You can achieve this either by using the DBput application or by entering the command database put manually on the CLI

In our example, we will use the manual configuration. So, we will type the command database put cidname 1111 "Mark Bean".

Here the word cidname is the desired family in the database. The key will be the word 1111. Actually 1111 is the Caller ID Number of the user, which we have set it the iax.conf file. The word in the quotation marks Mark Bean is the value. In our case, the value is the desired Caller ID Name. The name which we want to assign to the number 1111 and which we want to be displayed on the screen of our phone..

You can verify whether the key(1111) is entered in the database by typing the command database show or database show cidname.

In our example, when somebody dials 1010, the call will be answered by the Answer application. The next executed extension will be the one which contains the SendText application. It will send a text message to the caller with the message The Caller ID Name before the LookupCIDName application is: test. We use the ${CALLERIDNAME} variable, which contains the current Caller ID Name, to check the Caller Name. So it is test.

The next extension is with the Wait application, just to give us time between the extensions. In our example we have set the time to 2 seconds.

The extension with priority 4 is the one which contains the LookupCIDName application. It will check whether the Caller ID Number (which in our example is 1111) exist in the Asterisk’s cidname database.

If there is such number, the application will read the value assigned to it. Then this value will become the new Caller ID Name. In our example, the assigned value is Mark Bean. So the application will set this name as the new Caller ID Name.

In the next extension we have again SendText application. Thanks to it we will check whether the change of the Caller ID Name is successful or not. In our example it sends to us the message: The Caller ID after the LookupCIDName application is: Mark Bean. So the change is successful.

If an incoming call, with different Caller ID Number from 1111 is received, its Caller ID name won’t be changed because in the database, there is only a record about the Caller ID Number 1111. However the call will be accepted.

If an incoming call with no Caller ID is received the LookupCIDName application will take no effect.

If you want to remove a key(Caller ID Number) from the family cidname of the Asterisk’s database, you can use either the DBdel application or the database del command on the CLI

For example:

database del cidname 1111 "Mark Bean" ;where 1111 is the key in the family cidname with value Mark Bean

Finally, in order to be sure, that the Asterisk PBX will hang up the line after the conversation is over, it is always a good idea to make an extension for hanging up.

2. Screenshots of what you can see on the CLI of the Asterisk PBX

3. Additional information

For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.

This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.

If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX

Sara (53vsc1im5jc at gmail dot com)19 December 2015 15:17:53he would he used materials of <a href="http://jckzqdbq.com">anethor</a> project that he got off of the openarchitecture website that he had nothing to do with and pawned it off as his own design.Fortunately I was able to help them out with a design based on their sketches in time for a small presentation they were making in order to get funding. The sad thing is, this guy is still considered, and defended by many, as an expert despite the fact that he has never provided any proof of a single project he has designed and/or completed. No photos, no real drawings, nothing by a lot of hot air.Sad. By /

Melania (or2sl1srj at hotmail dot com)18 December 2015 10:28:55Write more, thats all I have to say. Literally, it seems as though you reelid on the video to make your point. You obviously know what youre talking about, why throw away your intelligence on just posting videos to your blog when you could be giving us something enlightening to read for example about graphic design!

Matthew Carlino (christina62587 at aol dot com)08 June 2007 06:05:21I received a call on my cell from the number 1111 and the guy told me he was callin in regards to a credit card offer. I beieve that I just might be a victim of identity theft or fraud. He asked me for all my personal info. and even gave me a pin for the card and everything. i dont know what to do now, because i doubt he was from the credit card company. The customer service number was disconnected. How can I get info on this caller?

Add Comment

Name:

Email:

Comment:

In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.