- Place a call in VbScript:
Sub DialString(DialStr,Name,Extension)
'create an instance of CTILink
Set CTIPhoneBar = CreateObject("CTILink.CTILinkComserver")
'dial the number
CTIPhoneBar.DialNumber DialStr,Name,Extension
'now wait to hangup, this example does not use events
MsgBox "Press OK to Hangup"
'CTILink is in the connected state
'so clicking the connect button hangs up
CTIPhoneBar.ConnectBtnClick
'free the CTILink instance
set CTIPhoneBar = Nothing
MsgBox "Disconnected"
End Sub
- Place a call in JScript:
function DialString(DialStr,Name,Extension) {
'create an instance of CTILink
var oCTILink = new ActiveXObject("CTILink.CTILinkComServer")
//dial the number
oCTILink.DialNumber(DialStr,Name,Extension);
//now wait to hangup, this example does not use events
alert("Press OK to hangup");
//CTILink is in the connected state
//so clicking the connect button hangs up
oCTILink.ConnectBtnClick();
alert("Disconnected")
- Getting a Caller ID Event in Visual Basic
Set a reference to CTILink by clicking "Project" - "References" and checking "CTILink Library". Then
enter the following code:
Dim WithEvents oCTILink As CTILinkComServer
Private Sub Form_Load()
Set oCTILink = GetObject("", "CTILink.CTILinkComServer")
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set oCTILink = Nothing
End Sub
Private Sub oCTILink_HaveCallerID(ByVal DeviceID As Long, ByVal AssociatedContact As Variant, ByVal CallerNbr As String, ByVal CalledNbr As String, ByVal CallerName As String)
MsgBox "The Caller Number is: " & CallerNbr
End Sub
- Getting a Caller ID Event in JScript Using the Phone Bar ocx
Place the following object tag somewhere in the HTML body. This creates an instance of the CTILink Phone
Bar. Notice that the width and height are set to 1 pixel because we don't want the phone bar to be visible, but still
need it on the page so it will be activated.
<OBJECT id=CTILinkBar style="WIDTH: 1px; HEIGHT: 1px"
classid=clsid:07245D45-97EE-11D2-B621-00104B97FCB1></OBJECT>
The following script block catches the caller ID event and displays the caller number:
<SCRIPT LANGUAGE=javascript FOR=CTILinkBar EVENT=OnHaveCallerID(DeviceID,AssociatedContact,CallerNbr,CalledNbr,CallerName)>
<!-- alert("Caller Number is: " + CallerNbr); //-->
</SCRIPT>
For a more in-depth example, examine the code in ctilinkdialdemo.htm in the help sub-directory of the
CTILink directory.