1. DBget - this application allows you to retrieve a value from the Asterisk’s database.
NOTE: This application is valid for Asterisk version 1.0.9 and 1.0.10.
If you are using version 1.2 or newer, then you have to know that this application is deprecated. However, if you want to use its functionality, there is a new syntax, which require the usage of the Set application. For more information click on the link - The new syntax - the DB function.
Syntax:
DBget(varname=family/key)
Purpose and usage
The purpose of this application is to allow you to get a value from the Asterisk’s database and to set it to an arbitrary variable. This application has absolutely the same effect as the CLI command - database get <family> <key>.
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 data and value 122
The extension with the next priority contains the application DBget. In its brackets we have written the following NewVar=test/data. NewVar is the variable in which we would like to extract the value of the key data from the family test in the Asterisk’s database. Please, notice that the name of the variable is written without the ${} characters.
Now, we will call back and display the content of the variable NewVar, by the help of the SendText application. Please, pay attention that here we have to write the variable NewVarwith the ${} characters. So in the brackets you have to write the following: ${NewVar}. In our case this will display on the screen of the caller, the message 122. 122 is the set value in the DBput application. So everything is correct.
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 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
JasonAspix (1758zascpt0jm at mantilia48 dot fancycarnavalmasks dot com) 01 March 2019 14:32:28 cialis on line pharmacy pay palcialis marseille fr Cialis 40 mg <a href="http://xcialis20mg.com">http://xcialis20mg.com</a>
Cheyanna (ijr5afyq8s5 at hotmail dot com) 21 April 2016 03:40:43 Stands back from the keyboard in amatnmeez! Thanks! http://sfdiiaer.com [url=http://osueddubn.com]osueddubn[/url] [link=http://xawrhgrn.com]xawrhgrn[/link]
Aundre (uegsrser3ap at gmail dot com) 19 April 2016 14:58:46 BS low - <a href="http://ckbqyh.com">raiilnaotty</a> high! Really good answer!
Vicki (avxc2edh4m at mail dot com) 19 April 2016 13:34:40 None can doubt the vectriay of this article. http://wncpkcsz.com [url=http://mreeihdoh.com]mreeihdoh[/url] [link=http://gqlsrenj.com]gqlsrenj[/link]