Ben Vlaeminck Posted March 6, 2018 #1 Share Posted March 6, 2018 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 More sharing options...
Tom Wellige Posted March 6, 2018 #2 Share Posted March 6, 2018 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 More sharing options...
Ben Vlaeminck Posted March 6, 2018 Author #3 Share Posted March 6, 2018 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 More sharing options...
Tom Wellige Posted March 8, 2018 #4 Share Posted March 8, 2018 Ben if you place the second code snippet into the start block of any of the active rules of the user, you can use the pv in any of the rules directly: sLanguagePrefix = sLanguageForCallID.Value Link to comment Share on other sites More sharing options...
Ben Vlaeminck Posted March 8, 2018 Author #5 Share Posted March 8, 2018 Tom, Any active rule, but not the first one I presume, because the GSe action is being called to connect to the DB only after that Start block in the first rule. Is that assumption correct? or does that sequence doens't matter? Link to comment Share on other sites More sharing options...
Tom Wellige Posted March 8, 2018 #6 Share Posted March 8, 2018 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 More sharing options...
Ben Vlaeminck Posted March 8, 2018 Author #7 Share Posted March 8, 2018 that's clear to me, Tom; I start working on it and confirm when ready. Link to comment Share on other sites More sharing options...
Ben Vlaeminck Posted March 8, 2018 Author #8 Share Posted March 8, 2018 Works perfect Tom! And is much simpler than I originally thought. Thanks a million.... Best regards Ben Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.