value - The new name, you want to set to the caller.
Purpose and usage
The purpose of this function is to allow you to change the Name of the caller. (Name and Number are composite parts of CallerID). So this function could change the callerid name, while keeping the original callerid number.
NOTE: The caller ID (callerid name + callerid number) that is set in the Asterisk PBX (iax.conf, sip.conf or mgcp.conf) overwrites the caller ID set on the softphone client.
To see how the application works we recommend you to use our IAX softphone Idefisk. You could download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.
Asterisk PBX configurations
We need to create one user in the 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.
In this example, when somebody dials 100, the call will be answered by the Answer application. The next executed extension will be the one which contains the Playback application. As arguments in its brackets we have set welcome. This is a standard welcome message, which comes with the Asterisk and which will be played thanks to the application. We have one extension with the NoOp application - just to verify the content of the CALLERID(name) variable. In our case it will show user1, because this is the caller name set in our Idefisk softphone. You could also set the caller's name in the iax.conf file by using the callerid=name <number> option.
Now let's change the caller's name with the CALLERID(name) function.
Use the Set application. As argument in the brackets write the following - CALLERID(name)=test. This will cause the change of the caller name form user1 to test.
We will use an extension with the NoOp application - to verify that the change is successful. Then, by using the Playback application we will play another sound file - vm-goodbye.
NOTE: The function CALLERID(name) is case sensitive. You always have to write it in your dialplans as you see it in our tutorial.
In order to be sure that the Asterisk PBX will hang up the line, when the conversation is over, it is a good idea to use the Hangup application.
2. Screenshots of what you could 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