Tom Wellige Posted June 19, 2022 #1 Share Posted June 19, 2022 The following post is restored from the Swyx Forum Archive (2007-2014) and was posted originally at 23.06.2011 by StefanD. Hi, because some of you asked for the samples shown at the last SwyxTechnologyConference: We will add them to a future ClientSDK package, but the most interesting one seems to be the event signalling from the client line manager into VB script (which is possible although the docs tell currently something different - will be corrected). So - how to do that: Put a second parameter (which is a kind of prefix for the event handler) into the CreateObject call, like this: Set PhoneLineMgr = Wscript.CreateObject("CLMgr.ClientLineMgr", "PhoneLineMgr_") After that you can catch all events inside your event handler which has to be named this way (I put the whole source of the sample's event handler here to give a little idea about what's possible and which events are received, e.g. line state changes, name key (=speeddial) changes etc.). The whole list of signalled events and their values can be found inside the header CLMgrPubTypes.h, enum PubCLMgrMessages - it's of course a good idea to define some consts inside your VB script to have some speaking names for the events instead of the enum values): Sub PhoneLineMgr_DispOnLineMgrNotification(ByVal msg, ByVal param) Select Case msg Case 0 'PubCLMgrLineStateChangedMessage, param = index of line Set Line = PhoneLineMgr.DispGetLine(param) WScript.Echo "line " & param & ": state changed to: " & Line.DispState Set Line = Nothing Case 1 'PubCLMgrLineSelectionChangedMessage WScript.Echo "line selection changed" Case 9 'PubCLMgrNameKeyStateChangedMessage If PhoneLineMgr.DispSpeedDialNumber(param) <> "" Then WScript.Echo "NameKeyStateChanged #: " & param &_ " Name: " & PhoneLineMgr.DispSpeedDialName(param) &_ " Number: " & PhoneLineMgr.DispSpeedDialNumber(param) &_ " State: " & PhoneLineMgr.DispSpeedDialState(param) End If End Select End Sub Enjoy Stefan Answer 1: 23.06.2011 by Daaf This is very useful info Stefan! But... Ofcourse I won't make things easy on you... This is not a solution for vbscript but for a wscript (windows scripting host) environment which uses vbcript as it's language. the wscript.createobject method supports the "strPrefix" parameter which you use here...But other vbscript based environments do not. Let's say (our case) that the control is called from a web application (e.g. from within a webbrowser), here one can not use wscript.createObject method, but you have to use the createObject("..") function (see: http://msdn.microsoft.com/en-us/library/dcw63t7z(v=vs.85).aspx) This function does not support the second parameter "strPrefix" (it supports a second parameter "location", but that is a completely different parameter!) So, how do I get access to the events then? Answer 2: 23.06.2011 by Tom Wellige Event handling is actually available in WSH scripts only, not in VBScripts/JScripts hosted by IE, IIS or SwyxServer. Maybe its possible to instantiate the WScript object from within the VBScript and afterwards call the WScript's CreateObject function? Tom. Answer 3: 23.06.2011 by Tom Wellige I have just uploaded a small vbscript that exports current caller information into a text file. It makes use of the event handling mechanism of the Client Line Manager to update the file also for transferred calls. You'll find the script in the download section here at Swyx Forum. Watch out for: VBScript updates textfile with caller information Enjoy! Tom. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now