Jump to content

Use of Persistent Variables in consecutive rules

Recommended Posts

Hi all,

I'm New to Persistent Variables... but managed to get them working within 1 rule.

I am a bit confused about the exact 'preparation' to use Persistent Variables in consecutive Call routing rules for a particular user.

As outcome of another Post in this forum , the use of Persistent Variables was the best/only solution.

Now, I want to implement this, and all works fine inside one rule. When Rules are SKipped (from within the rule), in the next rule I need to access the same Persistent Variable as used in the previous rule.

I presume I need to include the GSE Action Block in the next rule and declare (Dim PV and Set as New PV) the Persistent variable again? 

Thanks for your input in these

Link to comment
Share on other sites

Hello Ben,


every GSE rule that makes use of persistent variables needs to use the "Run GSE Action" block to includes them. If they are included into several rules of one of the same user, the server will make sure, their code will only be added once to the resulting vbscript call routing code.


If you use your instances of persistent variables within the "Start" block they are globally available in all call routing script of this user. The "Start" block contains global code for the user. The content of a "Insert Script code" block contains local code for the current call routing script.


Does this answer your question?


Link to comment
Share on other sites

Hi Tom, thanks for the quick reply.

This answers my question partially.

My first rule where I set the Language, works perfectly, I can see the selected language in the DB table as value of the Persistent Variable.

In the second rule, I already figured out I need to include the GSE Action Block.

Next to that, in that second rule I want to read the value of the Persistent Variable from the table. Here's what I have in a script Block in the second rule:


Dim sLanguageForCallId
sLanguageForCallID.Name = "Language_" & PBXCall.CallId
sLanguagePrefix = sLanguageForCallID.Value
Should this do the Job? What is missing / wrong?
Do I understand correctly that if I place following in the Start Block of the first rule, it is available for all following rules in the same user call routing rules?
Dim sLanguageForCallID
Set sLanguageForCallID = new PersistentVariable
sLanguageForCallID.Name = "Language_" & PBXCall.CallId
Link to comment
Share on other sites

The sequence doesn't matter at all as VBScript, i.e. The Windows Scripting Engine, don't care. 


What happens in behind is, that one large VBScript file is generated from all the rules you have. Every GSE rule is one VBScript function within this larger file. Stuff you put into the start block ends up outside of these functions and is therefore global over in the large file, and therefore global over all rules. 


Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • 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.