1. DBdeltree - this application allows you to remove a whole key tree from the Asterisk’s database.
NOTE: This application is valid for Asterisk version 1.0.9 and above.
DBdeltree(family[/keytree]) ;keytree is an optional argument
Purpose and usage
The purpose of this application is to allow you to delete a whole key tree from the Asterisk’s database. This application has absolutely the same effect as the CLI command - database deltree <family> [<keytree>].
However, it gives you more flexibility, because you can manage the Asterisk’s database in your extensions.conf file.
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.
We need one registered users 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.
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 DBput application. In the Asterisk’s it will create the family test with key new/data/user and value 122. Then we have one extension with the Wait application. This application will allow us to wait 15 seconds before the next extension to be executed. This will give us enough time to check whether the key new/data/user is stored on the database. We will achieve this by entering the CLI command database show. The result of this command could be seen below.
As you can see on the screenshot, the family test with key new/data/user is presented in the database. It is on the last line.
The extension with the next priority contains the application DBdeltree. In its brackets, as argument we have written the following test. This will cause the deleting of the family test with the whole key treenew/data/user from the Asterisk’s database. As you can see the only argument, which we have to use, is the name of the family. In our case test.
Again, you can check whether the operation is successful by typing the command database show on the CLI of your system. The result show be the following:
Comparing the picture above with the previous one, you can notice, that the family test with key new/data/user is removed from the database.
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.
NOTE: The difference between the applications DBdel and DBdeltree is that the first one could delete only one key and the second one could delete a whole key tree. Also, the first one takes as argument the name of the family and the key, while the second one could take only the name of the family.
2. Screenshots of what you can see on your Idefisk and 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