Bevlar Posted April 1, 2016 #1 Share Posted April 1, 2016 Hi, I am looking for resources on how to learn writing VB scripts to use in the Swyx GSE. My first project is to count the number of busy or DND users in a group when a call comes in and connect to an overflow group if 75% of users are unavailable. Any links or general advise will be greatly appreciated. Link to comment Share on other sites More sharing options...
Tom Wellige Posted April 1, 2016 #2 Share Posted April 1, 2016 Hi there, here you will find the "Useful link collection", that contains all freely available information/links about ECR and own scripting. http://www.swyx-forum.com/forum/149-extended-call-routing-ecr/ There are also links to the api references. So all in all this should be everyone's starting point. If you have specific questions you can of course always ask here Link to comment Share on other sites More sharing options...
Bevlar Posted April 1, 2016 Author #3 Share Posted April 1, 2016 Thanks Tom, I didn't see the useful links tucked away at the bottom. Obviously there's a lot of links and a lot of information to read through, please can you point me in the right direction for what I'm trying to achieve? For example to get and evaluate busy and dnd status do I need to look into VB scripting or using the API? I'm comfortable with the GSE for basic routing (using the blocks) but the rest is new to me. Link to comment Share on other sites More sharing options...
Tom Wellige Posted April 3, 2016 #4 Share Posted April 3, 2016 The Swyx KB article kb2910 describes how to enumerate users of a SwyxWare user group. From there you can use this link to check for the status of each user. Link to comment Share on other sites More sharing options...
Bevlar Posted April 4, 2016 Author #5 Share Posted April 4, 2016 Hi Tom, thanks for the links. Would you mind taking a look at my code and let me know if I'm heading in the right direction? In theory if group 101 has 2 members and are both unavailable the script should return 0 dim oPBXConfig set oPBXConfig = PBXScript.CreateObject("IpPBxSrv.PBXConfig") oPBXConfig.Initialize PBXUser Dim nCount nCount = 0 Dim nReturn nReturn = 0 Dim oUsers Set oUsers = oPBXConfig.GetUserByAddress("101") Dim User For Each oUser In oUsers nReturn = User.State if nReturn = 2 then nCount = nCount + 1 elsif nReturn = 4 then nCount = nCount + 1 elsif nReturn = 6 then nCount = nCount +1 else nCount = nCount +0 endif Next UserStatus = nCount Link to comment Share on other sites More sharing options...
Tom Wellige Posted April 4, 2016 #6 Share Posted April 4, 2016 Weren't you interested in busy and DND? If so you should sum up the states 3,5,7. By doing so you sum up all users in the group who are busy (internal or external) or have dnd configured. With oUsers.Count you will get the number of all users in the group. With that you will be able to check for your 75% threshold. Link to comment Share on other sites More sharing options...
Bevlar Posted April 4, 2016 Author #7 Share Posted April 4, 2016 Going forward I want to be able to connect to an overflow group based on user availability. I figured this would be a good building block to work from. With this code I want to skip a connection block if all of the group members are unavailable to take the call. I used 2 3 & 6 because it was the shortest if statement to get a result of either available or unavailable. Would it be better to define the Userstatus result with an if statement? If I understand correctly this would allow me to use the zero and one links on the script block to route the call. Next if nCount = 0 then UserStatus = 0 else UserStatus = 1 Is my code valid? Link to comment Share on other sites More sharing options...
Tom Wellige Posted April 4, 2016 #8 Share Posted April 4, 2016 Actually I pointed you on the UserStatus example to see how to "evaluate" the user status from the collection you get from GetUserByAddress. Of course you can rewrite the code inside that function to what ever you like, but then it simply isn't "UserStatus" anymore. If you only want you function to return two values (connect or don't connect) you should let your function return either True or False, and then use the "Evaluate" block to call it. The return value will then be mapped automatically on the both exits. Link to comment Share on other sites More sharing options...
Jens Kisters Posted October 6, 2017 #9 Share Posted October 6, 2017 Hello, the useful links mentioned by Tom are broken, is there a chance to get the links fixed? thanks Jens Link to comment Share on other sites More sharing options...
Tom Wellige Posted October 11, 2017 #10 Share Posted October 11, 2017 The topic with the useful link collection can be found here: In case there are problems with downloads from the forum page please refer to this topic: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.