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 three 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 users anatoliy, user1 and user2.
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.
Now, lets take a look at extensions.conf(the picture above). This is a screenshot of our file and it shows the context [test].
We want to restart the system by making a call. So, we need some kind of security check and for this purpose we will use the dialplan application Authenticate.
Also we will use the application SendText for sending a warning message to the caller.
When we want to restart the Asterisk PBX, we have only to dial 111. The first thing we will hear is the security check. We have to enter the correct password. In our case this is 1111. We achieve this with the Authenticate application. Next step is the welcome message. This is the extension with Playback application. You can do the same with the application Background. The difference between Playback and Background is that if you use the first one, you have to wait till the end of the message and then you can choose another option. If you use the second one then it’s not necessary to wait till the end of the message and you can choose the desired option while listening to the message.
Next extension is the one with priority 4. This one contains the application Sendtext. With its help we will send a message to the caller to remind him that after 5 seconds the system will reload. In our case this message si Your asterisk PBX system will be restarted after 5 seconds.
Then we have to set this 5 seconds and for this purpose we will use the Wait application. It is very simple and all we have to do is to set as argument 5.
Now we are ready to execute the command. Here we should use the System application. As argument we should write the command. In our case this is asterisk -rx reload.
At last it is a good idea to make an extension for hanging up to be sure that the Asterisk will hang up the line after the conversation is over.
2. Screenshots of what you can see on your Idefisk and on the CLI of the Asterisk PBX
And then, the messages from executing the program will appear.
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