Jump to content

Usecases for persistent variables

Tom Wellige

Recommended Posts

The following forum topic is restored from the Swyx Forum Archive (2007-2014)



2011-03-26 14:15:14, Tom Wellige


It seems to me that although often requested it is not widely understood, what persistent variables are and what can be done with them.


The first question, what persistent variables are, is answered in the project page. How to use them is in detail explained in the project documentation.


So the remaining question is: what to do with them?


The project already provides one quite useful example, an often requested and needed nightswitch.


What else could they be used for? Let's try to get a list of some ideas. This list of course can't be complete, as it does contain my current ideas only. Please feel free to use this forum thread to add your ideas and requirements as well!


  • Global (same) redirection for more than one user
    • A script will set two (global) persistent variables, one that keeps the status of the global redirection (0 for off, 1 for on) and another one that keeps the redirection target. The script will make use of the GSE's DTMF blocks for enabling and disabling the global redirection as also to receive the redirection target.
    • Each needed user gets a script (on top of the list of call routing rules) that checks these global variables:
      • if enabled: use a Connect To block to connect the call to the stored redirection target. Afterwards leaving the rule through the Rule Executed exit.
      • if disabled: exit the script through the Rule Skipped exit to allow the other rules to handle the call.
  • Announcement of a most recent (numerical) status
    This can be used to announce e.g. last Saturday's lottery numbers, a currently valid emergency number (if it rotates), a temperature, humidity, rain possibility, radioactivity or what ever.
    An entitled user will be able to call a certain extension and enter the numbers via DTMF. Afterwards they can be announced by another script (of another extension/user).
    • A script will receive the numbers and store them into persistent variable(s) by using the Get DTMF String block.
    • Another script will read the numbers from the persistent variable(s) and announce them by using the Say Number block.
  • Changing announcements
    If you need to be able to switch easily between pre-recorded announcements the above example can be used for something like that as well. The only difference would be that for the modifier you provide a DTMF menu to select an announcement and afterwards store the name of the wav file into a persistent variable.
  • Remember the latest caller
    If it is necessary to remember the latest caller because if he calls in right again the PBXCall.CallingPartyNumber can be stored into a persistent variable. This variable can be checked on each new call with the current calling party number and if equal do some special call handling.
  • What else?

Please feel free to add to this thread your ideas or needs in certain situations.

Have a nice weekend, Tom.




2012-01-20 15:38:34, Xanacas


I use the persistent variables for example rotate the advertise-announcements during the call is in the queue:

Musik = "Wartemusik" & Wartemusik.Value & ".wav"

IF Wartemusik.Value = 5 THEN
	Wartemusik.Value = 1
	Wartemusik.Value = Wartemusik.Value + 1




Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.