Neil Burton
Neil Burton

Reputation: 13

Event Capture in classic ASP (vbscript) - is this possible?

We have just purchased some software that provides an API into our phone system allowing us to dial, hangup etc.. The API was designed to be used client side (internet explorer / activex). We want to use this server side and execute the dial commands via an ajax call to a classic ASP script.

The basic VBScript for initialising the component is as follows:

<%
 set objPhone = server.createobject("XariosPhoneManager.PhoneManager")
 objPhone.RemoteHost = "192.168.0.17"
 objPhone.RemotePort = "2001"
 objPhone.OAIPassword = ""
 objPhone.Extension = "1000"
 objPhone.Initialise()
 set objPhone = nothing
 %>

but I can't call the dial command

objPhone.MakeCall("1001")

until the "initialised" event has happened. Is there a way in classic ASP to wait for an event to fire before executing some code?

Upvotes: 1

Views: 1269

Answers (3)

Steveo
Steveo

Reputation: 11

Not the most graceful of solutions but you could catch errors then loop and re-try the call if it fails then you try again - you could put a pause in the loop to give the process chance to finish. You could also put a limit on the number of tries so that it does eventually give up and not end up in an infinate loop. Something like (not complete or tested):

numTries = 0
processComplete = False
Do Until processComplete or numTries>=10
  On Error Resume Next  
  '## YOUR CODE TO CALL THE PROCESS HERE
  On Error Goto 0  
  numTries=CDbl(numTries)+1
Loop

Upvotes: 1

Neil Burton
Neil Burton

Reputation: 13

turns out it simply isn't possible in ASP. There's no property exposed that says the component is initialised, just the initialised event that fires. Unfortunately ASP cannot detect events. The developer has suggested wrapping their component in a new DLL that takes care of the event management, but I don't have the resources to do that. They have promised true serverside capability in a future version of the software

Upvotes: 0

DaveB
DaveB

Reputation: 9530

I don't know anything about this component so the following involves some guesswork.

1) If the component has a property to track when it is initialised, you can check that and once it is initialised, call the MakeCall method.

2) I am guessing that the component has a OnInitializedComplete event(or something like that), if so, write your server side code in JScript and assign a function to the event.

Upvotes: 0

Related Questions