• Idefisk
  • Tools
  • Tutorials
  • Reviews
  • VoIP Providers
  • Archives
ZOIPER softphone
Back to Tutorials

6.1.2.85. SetGlobalVar (dialplan application)

1. SetGlobalVar - this application allows you to change the global variables in the extension.conf file.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

 


Syntax:

SetGlobalVar(variable=value)

 


Purpose and usage

The purpose of this application is to set a value to a global variable or to change an already existing value. We are talking about the special context called [global] in the extensions.conf file.

Usually, once set, the global variable is changed very rarely.

This application is useful within big and complicated dialplans, when you want to change something easily and faster.

Below, we will give you an example of the usage of this application.

 


Prerequisites

To use this application you need a working Asterisk PBX with registered users in iax.conf, sip.conf or mgcp.conf(It depends on which protocol you would like to use) and made extensions.

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.


iax.conf Configurations

We need one registered user 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.

iaxoneuser.jpg

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.


extensions.conf Configurations
extsetglobal1.jpg
extsetglobal.jpg

On the pictures above you can see our extensions.conf file.

On the first picture, it is shown the context [global]. As you can see, that we have defined one global variable, named OFFICE. As value for this variable we have set the following: IAX2/ivan&IAX2/anatoliy.

On the second picture, you can see our extensions in the [test] context. Let’s take a look at the first extension. When somebody dials 5555, the call will be answered by the Answer application. The next executed extension will be the one which contains the Dial application. As argument in the brackets we will call the global variable set in the [global] context. We will call the ${OFFICE} variable. Thanks to it, we will dial the users ivan and anatoliy through the IAX2 channel.

Now, the second extension is the one, where we will use the SetGlobalVar. Again, when somebody dials 6666, the call will be answered by the Answer application. The next executed extension will be the one which contains the SetGlobalVar. In its brackets we have written the following: OFFICE=IAX2/user1. This will cause the change of the value of the global variable OFFICE. The new value will be IAX2/user1.

So, when the next extension, with priority 3, executes the Dial application, with argument in the brackets - ${OFFICE}, the call will be connected to the user user1 through the IAX2 channel. That is because now the value of the variable is IAX2/user1.

In order to be sure that the Asterisk PBX will hang up the line after the conversation is over, it is a good idea to make an extension for hanging up the line.

 


2. Screenshots of what you can see on the CLI of the Asterisk PBX

1) Number 5555
clisetglobal.jpg

2) Number 6666
clisetglobal1.jpg


 


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

 


4. Similar dialplan applications

Set()
 

 
User Comments
canada online pharmacy generic cialis (estellelibby at pecinan dot com)
06 July 2020 01:25:28
canada online pharmacy generic cialis http://www.cialisles.com/
sildenafil citrate tablets cenforce 150 (staceycarruthers at spambog dot com)
02 July 2020 14:17:10
sildenafil citrate tablets cenforce 150 http://cavalrymenforromney.com/
viagra on line no prec (rosella-hugo95 at viagra1 dot icu)
01 July 2020 19:54:33
viagra on line no prec https://viatribuy.com/
Kaylynn (4uubsev6 at gmail dot com)
21 April 2016 03:20:42
Whoa, whoa, get out the way with that good inotamroifn. http://lgzdelvad.com [url=http://zactrnqbvi.com]zactrnqbvi[/url] [link=http://qbnogktqvm.com]qbnogktqvm[/link]
Tessica (6z7k14yyc at hotmail dot com)
19 April 2016 14:34:02
I really wish there were more <a href="http://seftvbmgi.com">arlectis</a> like this on the web.
 
Add Comment
Name:
Email:
Comment:
In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.
Image Verification:
 

Latest Headlines:

  • T.38 faxing with Zoiper 2.15 is now easier than ever
    section: voip software
  • Asterisk 1.4.21 Released
    section: Asterisk
  • Asterisk 1.4.20 Released
    section: Asterisk
  • Asterisk 1.4.20-rc2 Released
    section: Asterisk
  • Asterisk 1.4.20-rc1 Now Available
    section: Asterisk
  • News Archives (older news)

Latest Tutorials:

  • Sending Fax from Zoiper to Zoiper using T.38
    added 08/Dec/2008 18:16
  • VMAuthenticate (dialplan application)
    added 01/Mar/2008 15:57
  • Siptronic ST-530
    added 06/Nov/2007 17:57
  • Siemens C455 IP hardphone
    added 05/Nov/2007 10:24
  • Zoiper
    added 22/Oct/2007 17:53

Latest Comments:

  • https://donde-ver-ant-man-y-la-avispa-qu...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://donde-ver-scream-6-tyt.statuspag...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://donde-ver-guardianes-de-la-noche...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://donde-ver-demon-slayer-villa-de-...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://www.reddit.com/r/BenavidezvPlant...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™