1. Random - this application allows you to jump to another extension, another context or another priority based on a probability from 1 to 100.
NOTE: This application is valid for Asterisk version 1.0.9 and above.
Syntax:
Random([probability]:[[context|]extension|]priority) ; the context and extension are optional settings. The numbers for the probability are equal to percents
Purpose and usage
This application is almost equal to the GoTo application. The difference is that with Random you can set a probability for the jump to the another extension, context, or priority. In this way you decide, what would be the chance, something to happen.
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 two 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 and 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.
We have decided that we want to jump to context [test1], extension s, priority 1 with a 50% chance to happen.
So when somebody dials 222 the call will be answered, thanks to the Answer application. The extension with the next priority will contain the Random application. As argument in the brackets we will set (50:test1,s,1)(50 is equal to 50%). This will cause the jump to the context [test1], extension s, priority 1 with 50% chance to happen. The other 50% are chance for a continue with the extension with priority n+1 where n is the number of the current extension. If this happen(to continue), the caller will hear a busy tone and the line will be hung up after 5 seconds.
If you would like to learn more about the Busy application, please read our tutorial.
If the call hits the 50% percents chance for jumping to another context, then the caller will hear a welcome message and if he/she enters one the call will be connected to the user user1 through the IAX2 channel.
Extension s is a special type, predefined extension. More information about it you can find in extensions.conf.
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
User Comments
careprost bimatoprost ophthalmic best price (franziska-melrose69 at xikohogum dot cf) 30 June 2020 19:15:05 careprost bimatoprost ophthalmic best price https://www.jueriy.com/
viagra for sale (christena-sixsmith at lm360 dot us) 28 June 2020 04:47:49 viagra for sale http://viacheapusa.com/
Kaeden (9xplrdt534k at outlook dot com) 21 April 2016 03:20:58 Almnfzaam-ikaoraation found, problem solved, thanks! http://htiiwdqv.com [url=http://rynuguhp.com]rynuguhp[/url] [link=http://nozyhdhdpvp.com]nozyhdhdpvp[/link]
Jacie (f1oi3vazo at mail dot com) 19 April 2016 14:34:23 Just the type of <a href="http://tspxzvgebw.com">insgiht</a> we need to fire up the debate.
Jaylene (a0bdcyqjf1 at yahoo dot com) 18 April 2016 20:39:05 Your story was really <a href="http://oiysfisj.com">invotmarife,</a> thanks!
Kayli (unv0cxfe at yahoo dot com) 18 April 2016 00:42:00 Always a good job right here. Keep rolling on thorugh.