Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2020 lines
62 KiB

  1. <!-- This page allow the user to originate a call from a given address and using the selected address type
  2. This sample is also able to accept incoming calls.
  3. What is covered by this sample:
  4. 1. Address enumerations and registering on address in order to receive call notifications
  5. 2. Call operations: create, connect, answer, disconnect
  6. 3. Setting application priority (which application will receive notifications about incoming calls)
  7. 4. Processing of TAPI events.
  8. 5. QOS usage.
  9. 6. Call forwarding setup (minimal)
  10. What is not covered:
  11. This page does not manage the positioning of video windows.
  12. (In order to do this, you can change the sample to use an ActiveX control that is able
  13. to set properties in IVideoWindow. This requires window handle values - HWND - which
  14. are not available in vbscripting).
  15. -->
  16. <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
  17. <html>
  18. <head>
  19. </head>
  20. <meta content="text/html; charset=unicode" http-equiv="Content-Type">
  21. <title>Call operations</title>
  22. <SCRIPT LANGUAGE="JavaScript"><!--
  23. var ua = navigator.userAgent;
  24. var an = navigator.appName;
  25. // Is it IE?
  26. bMSIE = (ua.indexOf("MSIE")>=1);
  27. if (! bMSIE)
  28. {
  29. alert("You need to use IE to run this page");
  30. window.close;
  31. }
  32. //-->
  33. </SCRIPT>
  34. <script LANGUAGE="VbScript">
  35. Const CallerName ="name1"
  36. 'Constants section
  37. 'These constants are copied from tapi3if.idl
  38. Const TAPIMEDIAMODE_AUDIO = &H08&
  39. Const TAPIMEDIAMODE_VIDEO = &H8000&
  40. Const S_MEDIA_AUDIOVIDEO = &H8008&
  41. Const TD_CAPTURE = 0
  42. Const TD_RENDER = 1
  43. Const QSL_NEEDED = 1
  44. Const AS_INSERVICE = 0
  45. Const DC_NORMAL = 0
  46. Const TE_CALLSTATE = 8
  47. Const TE_CALLNOTIFICATION = 4
  48. Const TE_DIGITEVENT = &H00008000&
  49. Const CS_DISCONNECTED = 3
  50. Const CS_IDLE = 0
  51. Const CS_OFFERING = 4
  52. Const CS_CONNECTED = 2
  53. Const CNE_OWNER = 0
  54. Const CIS_CALLERIDNAME = 0
  55. Const CIS_CALLERIDNUMBER = 1
  56. Const CIS_REDIRECTINGIDNAME = 8
  57. Const CIS_REDIRECTINGIDNUMBER = 9
  58. Const CIS_DISPLAYABLEADDRESS = 12
  59. Const CIS_COMMENT = 11
  60. Const CIS_CALLINGPARTYID = 13
  61. Const CIS_CALLEDPARTYFRIENDLYNAME = 10
  62. Const CIL_REASON = 8
  63. Const LINEDIGITMODE_DTMF = 2
  64. 'Interface IDs for casting
  65. 'Note: you can find the following IID-s in tapi3.idl, tapi3if.idl or rend.idl
  66. Const IID_String_ITMediaSupport = "{B1EFC384-9355-11D0-835C-00AA003CCABD}"
  67. Const IID_String_ITTerminalSupport="{B1EFC385-9355-11D0-835C-00AA003CCABD}"
  68. Const IID_String_ITBasicCallControl = "{B1EFC389-9355-11D0-835C-00AA003CCABD}"
  69. 'Const IID_String_ITCallInfo = "{B1EFC390-9355-11d0-835C-00AA003CCABD}"
  70. 'New interface
  71. Const IID_String_ITCallInfo = "{350F85D1-1227-11D3-83D4-00C04FB6809F}"
  72. Const IID_String_ITStreamControl= "{EE3BD604-3868-11D2-A045-00C04FB6809F}"
  73. Const IID_String_ITDirectoryObjectConference= "{F1029E5D-CB5B-11D0-8D59-00C04FD91AC0}"
  74. Const IID_String_ITCallStateEvent = "{62F47097-95C9-11d0-835D-00AA003CCABD}"
  75. Const IID_String_ITCallNotificationEvent = "{895801DF-3DD6-11d1-8F30-00C04FB6809F}"
  76. Const IID_String_ITDigitDetectionEvent = "{80D3BFAC-57D9-11d2-A04A-00C04FB6809F}"
  77. ' IID of IVideoWindow
  78. ' Note: you can find this IID defined in control.h (from your sdk\inc directory),
  79. ' which contains the interface to type library QuartzTypeLib for quartz.dll;
  80. ' (search for the interface IVideoWindow)
  81. Const IID_String_IVideoWindow = "{56A868B4-0AD4-11CE-B03A-0020AF0BA770}"
  82. ' The following CLSID is defined in tapi3.h
  83. '(and it's used for creating a terminal of class "video window terminal")
  84. Const CLSID_String_VideoWindowTerm = "{F7438990-D6EB-11d0-82A6-00AA00B5CA1B}"
  85. '****************************************************************************
  86. 'Global variable section
  87. '****************************************************************************
  88. DIM spITAddress
  89. spITAddress = Empty
  90. 'Set on True when we are unable to complete the connecting phase, to skip rest of processing
  91. DIM sUnableToComplete
  92. DIM sbNeedToExit
  93. sUnableToComplete = False
  94. sbNeedToExit = False
  95. ' If we want to receive incoming calls, we have to register on the corresponding addresses.
  96. 'We don't really use the values returned by registration (they are supposed to be used
  97. 'for unregistration), because Unregistration is performed automatically when we shutdown the TAPI object
  98. 'The variable pRegisteredCallNotification is an array that contains cookies returned by RegisterCallNotifications;
  99. 'these would normally be used to call UnregisterNotifications.
  100. 'The variable pRegisteredName holds correspondent AddressName
  101. DIM pRegisteredCallNotification(50)
  102. DIM pRegisteredName(50)
  103. DIM iQtaRegistered
  104. iQtaRegistered = 0
  105. 'Set by radio button "Select Address Type"
  106. DIM sCurrentAddressType
  107. sCurrentAddressType = -1
  108. ' This variable will hold a references to the currently established calls
  109. Const MaxCallNumber = 20
  110. DIM spITCall(20)
  111. DIM spCallState(20)
  112. DIM spCallerCallee(20)
  113. DIM spTerminalState(20)
  114. DIM spDtmfDetected(20)
  115. DIM spCallOnHold(20)
  116. spTerminalsNumber = 0
  117. DIm pVideoWindow1
  118. DIm pVideoWindow2
  119. DIM FwdType
  120. FwdType = 0
  121. </script>
  122. <script ID="clientEventHandlersVBS" LANGUAGE="vbscript">
  123. 'Simplest error processing
  124. Sub CheckError(strMsg)
  125. if not Err.number = 0 Then
  126. MsgBox strMsg & ":" & Err.number & ";"&Err.description
  127. sbNeedToExit = True
  128. Err.Clear
  129. End If
  130. End Sub
  131. '********************************************************************
  132. '********************************************************************
  133. '********************************************************************
  134. '********************************************************************
  135. ' Enumerate addresses, register for incoming calls and fill listbox
  136. Sub window_onload
  137. On Error Resume Next
  138. ' If TAPI object is not initialized, we can't do anything, so exit.
  139. If sUnableToComplete = True Then
  140. Exit Sub
  141. End If
  142. radioFType.value = ""
  143. 'Listen on ALL available addresses
  144. DIM intTmp
  145. intTmp = Find_Address_And_Register()
  146. If sbNeedToExit Then
  147. Exit Sub
  148. End If
  149. If intTmp = 0 Then
  150. MsgBox "Unable to find any valid address. Try to reload page.",0,"Initializing"
  151. Exit Sub
  152. End If
  153. ' Select first address option
  154. selAddress.options(0).selected = True
  155. call changeOptionsState()
  156. Call PopulateFwdRules
  157. window.status = "Done."
  158. End Sub
  159. '********************************************************************
  160. '********************************************************************
  161. '********************************************************************
  162. '********************************************************************
  163. ' Find all addresses that have state "in service" and have at least audio capabilities.
  164. ' Register the app as "owner" on all these addresses
  165. ' Return number of addresses for which we registered...
  166. Function Find_Address_And_Register()
  167. On Error Resume Next
  168. DIM bUsefulAddress
  169. DIM bSupportVideoOrAudio
  170. DIM bSupportVideo
  171. Find_Address_And_Register = 0
  172. For Each pITAddress in TAPIOBJ.Addresses
  173. bUsefulAddress = False
  174. if pITAddress.State = AS_INSERVICE Then
  175. 'Check if this address supports Audio or Video
  176. 'Obtain ITMediaSupport
  177. DIM pITMediaSupport
  178. Set pITMediaSupport = MAPPER.QueryDispatchInterface(_
  179. IID_String_ITMediaSupport,pITAddress)
  180. 'If this address does not support streaming
  181. '(such as the addresses exposed by RemoteSP, data modems, etc,)
  182. 'skip it
  183. if not Err.number = 0 Then
  184. Err.Clear
  185. Else
  186. 'Check if audio or video are supported
  187. bSupportVideo = pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_VIDEO)
  188. bSupportVideoOrAudio = _
  189. pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_AUDIO) or bSupportVideo
  190. call CheckError("Find_Address_And_Register:ITMediaSupport.QueryMediaType" )
  191. bUsefulAddress = bSupportVideoOrAudio
  192. End If
  193. End If
  194. if bUsefulAddress and pITAddress.AddressName="H323 Line" Then
  195. ' This address should be used:
  196. ' register the application to receive notifications on this address
  197. iQtaRegistered = iQtaRegistered + 1
  198. Set spITAddress = pITAddress
  199. if bSupportVideo Then
  200. modes = S_MEDIA_AUDIOVIDEO
  201. Else
  202. modes = TAPIMEDIAMODE_AUDIO
  203. End If
  204. 'Register as Owner of any incoming call
  205. pRegisteredCallNotification(iQtaRegistered) = TAPIOBJ.RegisterCallNotifications(pITAddress,True,True,modes,0)
  206. pRegisteredName(iQtaRegistered) = pITAddress.AddressName
  207. if not Err.number = 0 Then 'Probably this address does not support incoming calls
  208. iQtaRegistered = iQtaRegistered - 1
  209. Err.Clear
  210. Else
  211. Find_Address_And_Register = Find_Address_And_Register + 1
  212. End If
  213. 'Fill address list
  214. DIM oOption
  215. Set oOption = document.createElement("OPTION")
  216. oOption.text = pITAddress.AddressName
  217. oOption.value = pITAddress.AddressName
  218. selAddress.add(oOption)
  219. Set oOption = Nothing
  220. End IF
  221. Next
  222. 'This section shows how to override Application Priority:
  223. 'after the execution of the following lines, our app will always receive incoming calls
  224. 'even if there are other running tapi apps that had registered for receiving calls before our app.
  225. call TAPIOBJ.SetApplicationPriority("IEXPLORE.EXE",TAPIMEDIAMODE_AUDIO,TRUE)
  226. call TAPIOBJ.SetApplicationPriority("IEXPLORE.EXE",TAPIMEDIAMODE_VIDEO,TRUE)
  227. End Function
  228. '******************************************************************
  229. '******************************************************************
  230. '******************************************************************
  231. 'fired when user changes selected outgoing address radio button
  232. Sub changeOptionsState
  233. On Error Resume Next
  234. 'Find address selected
  235. Selstr = ""
  236. bSupportVideo = false
  237. For i = 0 to selAddress.length - 1
  238. If selAddress.options(i).selected = True Then
  239. selstr = selAddress.options(i).value
  240. Exit For
  241. End If
  242. Next
  243. 'Find this address and check if video is supported
  244. For Each pITAddress in TAPIOBJ.Addresses
  245. if pITAddress.AddressName =SelStr Then
  246. 'Obtain ITMediaSupport
  247. DIM pITMediaSupport
  248. Set pITMediaSupport = MAPPER.QueryDispatchInterface(_
  249. IID_String_ITMediaSupport,pITAddress)
  250. call CheckError("changeOptionsState:Query ITAddress for ITMediaSupport" )
  251. 'Check if video is supported
  252. bSupportVideo = _
  253. pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_VIDEO)
  254. call CheckError("changeOptionsState:ITMediaSupport.QueryMediaType" )
  255. Set pITMediaSupport = Nothing
  256. Exit For
  257. End If
  258. Next
  259. call CheckError("changeOptionsState:After enumerating the Addresses")
  260. checkAOnly.disabled = not bSupportVideo
  261. checkNoOutgoingVideo.disabled = not bSupportVideo
  262. End Sub
  263. '******************************************************************
  264. '******************************************************************
  265. '******************************************************************
  266. ' Check parameters of a call before connecting it
  267. Sub PressConnect
  268. On Error Resume Next
  269. DIM iAddressType
  270. DIM pConnectTo
  271. DIM addressFrom
  272. DIM selStr
  273. ' Find new entry in call array
  274. DIM CallNumber
  275. CallNumber = 0
  276. For i = 1 to MaxCallNumber
  277. if IsEmpty(spITCall(i)) Then
  278. CallNumber = i
  279. Exit For
  280. End If
  281. Next
  282. If CallNumber = 0 Then
  283. MsgBox "Maximum number of calls reached. Disconnect call first",0,"connect"
  284. Exit Sub
  285. End If
  286. If txtAddress.value = "" Then
  287. MsgBox "You have not entered a destination address",0,"connect"
  288. Exit Sub
  289. End If
  290. 'Check if type is supplied
  291. if sCurrentAddressType < 0 Then
  292. MsgBox "You have not selected addres type",0,"connect"
  293. Exit Sub
  294. End If
  295. ' Address type. This app uses only type = 1 ("Phone") and type = 16 ("ip address")
  296. iAddressType = CInt(sCurrentAddressType)
  297. pConnectTo = txtAddress.value
  298. 'Find selected originating address
  299. For i = 0 to selAddress.length - 1
  300. If selAddress.options(i).selected = True Then
  301. addressFrom = selAddress.options(i).value
  302. Exit For
  303. End If
  304. Next
  305. If addressFrom = "" Then
  306. MsgBox "Originating Address is not selected or doesn't exist at all: uable to connect",0,"COnnect"
  307. Exit Sub
  308. End If
  309. Call Connect(CallNumber, pConnectTo,iAddressType,addressFrom,checkAOnly.value="on" or checkAOnly.disabled,checkNoOutgoingVideo.value="on" or checkNoOutgoingVideo.disabled)
  310. End Sub
  311. '******************************************************************
  312. '******************************************************************
  313. '******************************************************************
  314. ' Create Call object, setup terminals, connect call
  315. Sub Connect(CallNumber, pConnectTo,iAddressType,addressFrom,blnAOnly,blnNoOutVideo)
  316. On Error resume Next
  317. sUnableToComplete = False
  318. window.status = "Connecting to " & pConnectTo & "..."
  319. 'Create new internal call representation
  320. 'Find address selected
  321. DIM pITAddress_Connect
  322. DIM blnFoundAddress
  323. blnFoundAddress = False
  324. DIM pITAddress
  325. For Each pITAddress in TAPIOBJ.Addresses
  326. if pITAddress.AddressName = addressFrom Then
  327. 'Obtain ITMediaSupport
  328. DIM pITMediaSupport
  329. Set pITMediaSupport = MAPPER.QueryDispatchInterface(_
  330. IID_String_ITMediaSupport,pITAddress)
  331. call CheckError("connect:Query ITAddress for ITMediaSupport" )
  332. 'Check what is supported
  333. bSupportVideo = _
  334. pITMediaSupport.QueryMediaType(TAPIMEDIAMODE_VIDEO)
  335. call CheckError("connect:ITMediaSupport.QueryMediaType" )
  336. blnFoundAddress = True
  337. Set pITAddress_Connect = pITAddress
  338. Exit For
  339. End If
  340. Next
  341. Set pITAddress = Nothing
  342. if not blnFoundAddress Then
  343. MsgBox "Sorry, outgoing address " & addressFrom & "does not exist",0,"Connect"
  344. window.status = "Call to "& pConnectTo & " failed."
  345. Exit Sub
  346. End If
  347. Call UnselectTerminals
  348. Call CheckError("Connect: before CreateCallWindow")
  349. Call CreateCallWindow(pITAddress_Connect,blnAOnly or not bSupportVideo,blnNoOutVideo or not bSupportVideo)
  350. Call CheckError("Connect: after CreateCallWindow")
  351. 'Obtain Terminal support
  352. DIM pITTerminalSupport
  353. 'Set pITTerminalSupport = MAPPER.QueryDispatchInterface(_
  354. 'IID_String_ITTerminalSupport,pITAddress_Connect)
  355. Set pITTerminalSupport = pITAddress_Connect
  356. call CheckError("connect:Query ITAddress for ITTerminalSuport" )
  357. 'Create a Call
  358. DIM MediaTypes
  359. If not bSupportVideo or blnAOnly Then
  360. MediaTypes = TAPIMEDIAMODE_AUDIO
  361. Else
  362. MediaTypes = S_MEDIA_AUDIOVIDEO
  363. End If
  364. Set pCall = pITAddress_Connect.CreateCall(pConnectTo,iAddressType,MediaTypes)
  365. call CheckError("connect:CreateCall" )
  366. window.status = "Configure terminals..."
  367. Call AssignTerminals(CallNumber,pCall,blnAOnly,blnNoOutVideo,True, False)
  368. call CheckError("connect:after AssignTerminals" )
  369. if sUnableToComplete Then
  370. Call DisconnectCall(CallNumber,1)
  371. window.status = "Call to "& pConnectTo & " failed."
  372. Exit Sub
  373. End If
  374. DIM pITCallInfo
  375. Set pITCallInfo = MAPPER.QueryDispatchInterface( _
  376. IID_String_ITCallInfo, pCall)
  377. call CheckError("connect:get CalllInfo from Call" )
  378. 'XXXX-XX
  379. pITCallInfo.CallInfoString(CIS_CALLINGPARTYID) = CallerName
  380. call CheckError("connect:Set caller name" )
  381. window.status = "Connecting..."
  382. Call pCall.Connect(false)
  383. ' Check for error "invalid address" (see in tapi3err.h TAPI_E_INVALADDRESS=(HRESULT)0x8004000C)
  384. if Err.Number = &H8004000C Then
  385. Err.Clear
  386. Call DisconnectCall(CallNumber,1)
  387. window.status = "Call to "& pConnectTo & " failed: Address is invalid"
  388. Set pCall = Nothing
  389. Else
  390. if not Err.Number = 0 Then
  391. Err.Clear
  392. Call DisconnectCall(CallNumber,1)
  393. window.status = "Call to "& pConnectTo & " failed: error " & Hex(Err.number)
  394. Set pCall = Nothing
  395. Else
  396. Set spITCall(CallNumber) = pCall
  397. spCallState(CallNumber) = "Connecting..."
  398. spCallerCallee(CallNumber) = "To " & pConnectTo
  399. spDtmfDetected(CallNumber) = ""
  400. Call RefreshCallTable
  401. End if
  402. End If
  403. call CheckError("connect:main connect" )
  404. Set pCall = Nothing
  405. End Sub
  406. '
  407. '
  408. ' Refreshing Call Table
  409. '
  410. '
  411. Sub RefreshCallTable
  412. On error Resume Next
  413. ' Delete all entries
  414. For i = 0 to selectCalls.options.length
  415. selectCalls.remove(0)
  416. Next
  417. For i = 1 to MaxCallNumber
  418. if Not IsEmpty(spITCall(i)) Then
  419. if Not spCallerCallee(i) = "" Then
  420. CallString = spCallerCallee(i) & " " & spCallState(i)
  421. if spCallOnHold(i) Then
  422. CallString = CallString & "(On Hold)"
  423. End If
  424. if spTerminalState(i) Then
  425. CallString = "==>" & CallString
  426. End IF
  427. if Not spDtmfDetected(i) = "" Then
  428. CallString = CallString & " DTMF:" & spDtmfDetected(i)
  429. End If
  430. Set oOption = document.createElement("OPTION")
  431. oOption.text = CallString
  432. oOption.value = i
  433. selectCalls.add(oOption)
  434. End If
  435. End if
  436. Next
  437. End Sub
  438. '*
  439. '* Unselect terminals from the call which has them
  440. '*
  441. '*
  442. Sub UnselectTerminals
  443. On Error Resume Next
  444. 'Find call which have terminals selected
  445. ActiveCall = 0
  446. For i = 1 to MaxCallNumber
  447. if spTerminalState(i) = TRUE Then
  448. ActiveCall = i
  449. Exit For
  450. End If
  451. Next
  452. if ActiveCall = 0 Then
  453. Exit Sub
  454. End If
  455. DIM pITStreamControl
  456. 'Set pITStreamControl = MAPPER.QueryDispatchInterface(_
  457. 'IID_String_ITStreamControl, spITCall(ActiveCall))
  458. Set pITStreamControl = spITCall(ActiveCall)
  459. if Not Err.Number = 0 Then
  460. Err.Clear
  461. Exit Sub
  462. End If
  463. DIM pITStream
  464. DIM lMediaType
  465. DIM lDirection
  466. DIM pITTerminal
  467. Set pVideoWindow1 = Nothing
  468. Set pVideoWindow2 = Nothing
  469. spTerminalsNumber = 0
  470. spTerminalState(ActiveCall) = FALSE
  471. 'Unselect all audio terms...
  472. For Each pITStream in pITStreamControl.Streams
  473. pITStream.StopStream
  474. If Not Err.Number = 0 Then ' most likely call is already closed
  475. Err.Clear
  476. Exit Sub
  477. End If
  478. For Each pITTerminal in pITStream.Terminals
  479. pITStream.UnselectTerminal(pITTerminal)
  480. If Not Err.Number = 0 Then ' most likely call is already closed
  481. Err.Clear
  482. End If
  483. Next
  484. Set pITTerminal = Nothing
  485. Next
  486. End Sub
  487. '******************************************************************
  488. '******************************************************************
  489. '******************************************************************
  490. ' For static terminals: get default static terminal, select it on stream and start the stream
  491. Sub AssignTerminals(CallNumber,pCall, is_no_video, is_no_render,bSetQOS, StartStreams)
  492. On Error Resume Next
  493. ' Terminals may already selected somewhere
  494. 'Find call which have terminals selected
  495. ActiveCall = 0
  496. For i = 1 to MaxCallNumber
  497. if spTerminalState(i) = TRUE Then
  498. ActiveCall = i
  499. Exit For
  500. End If
  501. Next
  502. if Not ActiveCall = 0 Then
  503. 'Exit Sub
  504. End If
  505. DIM pITCallInfo
  506. Set pITCallInfo = MAPPER.QueryDispatchInterface( _
  507. IID_String_ITCallInfo, pCall)
  508. Call CheckError("AssignTerminals:query for pITCallInfo")
  509. DIM pITAddress
  510. Set pITAddress = pITCallInfo.Address
  511. Call CheckError("AssignTerminals:pITCallInfo.Address")
  512. DIM pITTerminalSupport
  513. 'Set pITTerminalSupport = MAPPER.QueryDispatchInterface(_
  514. ' IID_String_ITTerminalSupport,pITAddress)
  515. Set pITTerminalSupport = pITAddress
  516. Call CheckError("AssignTerminals:query for pITTerminalSupport")
  517. DIM pITStreamControl
  518. 'Set pITStreamControl = MAPPER.QueryDispatchInterface(_
  519. 'IID_String_ITStreamControl,pCall)
  520. Set pITStreamControl = pCall
  521. call CheckError("AssignTerminals:Query ITCall for ITStreamControl" )
  522. DIM pITStream
  523. DIM lMediaType
  524. DIM lDirection
  525. 'Setup all static terminals: video capture,
  526. ' and both audio terminals (microphone and speakers)
  527. For Each pITStream in pITStreamControl.Streams
  528. lMediaType = pITStream.MediaType
  529. lDirection = pITStream.Direction
  530. 'Try to find correspondent terminal (if we need one ;))
  531. if not ((is_no_video and lMediaType = TAPIMEDIAMODE_VIDEO) or _
  532. (is_no_render and lMediaType = TAPIMEDIAMODE_VIDEO and lDirection=TD_CAPTURE) ) Then
  533. if (lMediaType = TAPIMEDIAMODE_VIDEO) and (lDirection=TD_RENDER) Then
  534. is_error = false
  535. Else
  536. Set pITTerminal = pITTerminalSupport.GetDefaultStaticTerminal(lMediaType,lDirection)
  537. if not (Err.number = 0) Then 'No such terminal?
  538. is_error = True
  539. Err.Clear
  540. Else
  541. is_error = False
  542. pITStream.SelectTerminal(pITTerminal)
  543. End if
  544. call CheckError("AssignTerminals:SelectTerminal" )
  545. End If
  546. if is_error Then 'Maybe unnecessary
  547. ' Maybe join audio only - special case
  548. if (lMediaType = TAPIMEDIAMODE_VIDEO and lDirection=TD_CAPTURE) Then
  549. 'MsgBox "Unable to find video capture device: attach video receive only"
  550. Else
  551. if (lMediaType = TAPIMEDIAMODE_AUDIO and lDirection=TD_CAPTURE) Then
  552. 'MsgBox "Unable to find audio recording device: attach audio receive only"
  553. Else
  554. MsgBox "Unable to find audio playback device."
  555. Err.Clear
  556. sUnableToComplete = True
  557. Exit Sub
  558. End If
  559. End if
  560. Else 'No errors, start this stream!
  561. 'call CheckError("AssignTerminals:StartStream" )
  562. 'And now setup specific devices: video windows...
  563. if (lMediaType = TAPIMEDIAMODE_VIDEO ) Then
  564. 'for Video Capture we will create a "Preview Window"terminal
  565. 'for Video Render we will create a "Video Window" Terminal
  566. if lDirection = 0 Then 'see TD_CAPTURE = 0 in tapi3if.idl
  567. 'Preview window
  568. pITStream.SelectTerminal(pVideoWindow2)
  569. call CheckError("AssignTerminals: SelectTerminalStream")
  570. 'Show preview window (this will show the video stream sent by our app to the other party)
  571. Dim pIVideoWindow2
  572. Set pIVideoWindow2 = MAPPER.QueryDispatchInterface(IID_String_IVideoWindow, pVideoWindow2)
  573. call CheckError("AssignTerminals: query for IVideoWindow")
  574. pIVideoWindow2.AutoShow = True
  575. 'pIVideoWindow2.Visible = TRUE
  576. call CheckError("AssignTerminals: set visibility")
  577. End If
  578. if lDirection = 1 Then 'see TD_RENDER = 1 in tapi3if.idl
  579. pITStream.SelectTerminal(pVideoWindow1)
  580. call CheckError("AssignTerminals: SelectTerminalStream")
  581. 'Show window (this will show us the video stream received by our app from the other party)
  582. Dim pIVideoWindow1
  583. Set pIVideoWindow1 = MAPPER.QueryDispatchInterface(IID_String_IVideoWindow, pVideoWindow1)
  584. call CheckError("AssignTerminals: query for IVideoWindow")
  585. pIVideoWindow1.AutoShow = True
  586. 'pIVideoWindow1.Visible = TRUE
  587. call CheckError("AssignTerminals: set visibility")
  588. End If
  589. call CheckError("AssignTerminals: SelectTerminalStream")
  590. End If 'Create Preview
  591. End if 'have error
  592. End if 'our Stream
  593. call CheckError("AssignTerminals:GeneralChecking1" )
  594. if StartStreams Then
  595. Call pITStream.StartStream
  596. Err.Clear
  597. End If
  598. Next ' End cycle for ITStreams
  599. spTerminalState(CallNumber) = TRUE
  600. call CheckError("AssignTerminals:Streams cycle problems" )
  601. if bSetQOS Then
  602. 'Let's try to setup QoS level for video and audio
  603. if not is_no_video Then
  604. call pCall.SetQOS(TAPIMEDIAMODE_VIDEO,QSL_NEEDED)
  605. call CheckError("AssignTerminals:set QOS_REQUIRED for Video" )
  606. End If
  607. call pCall.SetQOS(TAPIMEDIAMODE_AUDIO,QSL_NEEDED)
  608. call CheckError("AssignTerminals:set QOS_REQUIRED for Audio" )
  609. End IF
  610. End Sub
  611. '******************************************************************
  612. '******************************************************************
  613. '******************************************************************
  614. ' Create two new Video Window terminals
  615. Sub CreateCallWindow(pITAddress, AOnly,NoOutgoingVideo)
  616. On Error Resume Next
  617. 'Obtain Terminal support
  618. DIM pITTerminalSupport
  619. 'Set pITTerminalSupport = MAPPER.QueryDispatchInterface(_
  620. 'IID_String_ITTerminalSupport,pITAddress)
  621. Set pITTerminalSupport = pITAddress
  622. call CheckError("CreateCallWindow:Query ITAddress for ITTerminalSuport" )
  623. if not AOnly Then 'create window for your party
  624. Set pVideoWindow1 = pITTerminalSupport.CreateTerminal(CLSID_String_VideoWindowTerm,TAPIMEDIAMODE_VIDEO,TD_RENDER)
  625. End If
  626. if not AOnly and not NoOutgoingVideo Then
  627. Set pVideoWindow2 = pITTerminalSupport.CreateTerminal(CLSID_String_VideoWindowTerm,TAPIMEDIAMODE_VIDEO,TD_RENDER)
  628. End If 'Create window for preview
  629. call CheckError("CreateCallWindow:GeneralChecking1" )
  630. End Sub
  631. '******************************************************************
  632. '******************************************************************
  633. '******************************************************************
  634. ' Tapi events processing:
  635. ' - call state events ("connected", "disconnected")
  636. ' - and call notification events (these calls will be in "offering" state)
  637. Sub TAPIOBJ_Event(event_type, tapi_event)
  638. On Error Resume Next
  639. DIM pITCallInfo
  640. DIM pITCall
  641. 'MsgBox CStr(event_type)
  642. if event_type = 2 Then
  643. Call PopulateFwdRules
  644. End if
  645. 'Check For disconnected call
  646. if event_type = TE_CALLSTATE Then
  647. DIM pITCallStateEvent
  648. Set pITCallStateEvent = MAPPER.QueryDispatchInterface(_
  649. IID_String_ITCallStateEvent,tapi_event)
  650. call CheckError("TAPIOBJ_Event:unable to map" )
  651. iCallState = pITCallStateEvent.State
  652. 'MsgBox "Call state" &Cstr(iCallState)
  653. call CheckError("TAPIOBJ_Event:get CallState" )
  654. Set pITCallInfo = pITCallStateEvent.Call
  655. call CheckError("TAPIOBJ_Event:get CallInfo" )
  656. Set pITCall = MAPPER.QueryDispatchInterface( _
  657. IID_String_ITBasicCallControl, pITCallInfo)
  658. call CheckError("TAPIOBJ_Event:get Call from CallInfo" )
  659. if iCallState= CS_DISCONNECTED or iCallState= CS_IDLE Then
  660. cause = pITCallStateEvent.Cause
  661. strinnerHTML = ""
  662. Select Case cause
  663. Case 1 ' CEC_DISCONNECT_NORMAL
  664. ' Normal disconnect
  665. Case 2 ' CEC_DISCONNECT_BUSY
  666. strinnerHTML = "Your Party is busy.Try Later."
  667. Case 3 ' CEC_DISCONNECT_BADADDRESS
  668. strinnerHTML = "Address is invalid"
  669. case 4 ' CEC_DISCONNECT_NOANSWER
  670. strinnerHTML = "No answer from your party."
  671. case 0 'CEC_NONE
  672. strinnerHTML = "No answer from your party."
  673. Case Else
  674. strinnerHTML = "Your call is cancelled, rejected or failed"
  675. End Select
  676. window.status = "Done."
  677. 'Find call entry
  678. ActiveCall = 0
  679. For i = 1 to MaxCallNumber
  680. if spITCall(i) Is pITCall Then
  681. ActiveCall = i
  682. Exit For
  683. End If
  684. Next
  685. if ActiveCall = 0 Then
  686. 'Bogus call : no such call
  687. Exit Sub
  688. End If
  689. if strinnerHTML= "" Then
  690. window.status = "Disconnected"
  691. Else
  692. window.status = strinnerHTML
  693. End if
  694. spCallState(ActiveCall) = window.status
  695. Call UnselectTerminals
  696. Call RefreshCallTable
  697. End If 'Call is disconnected
  698. if iCallState = CS_CONNECTED Then 'Call is connected
  699. window.status = "Call is connected."
  700. 'Find call entry
  701. ActiveCall = 0
  702. For i = 1 to MaxCallNumber
  703. if spITCall(i) Is pITCall Then
  704. ActiveCall = i
  705. Exit For
  706. End If
  707. Next
  708. if ActiveCall = 0 Then
  709. 'Bogus call : no such call
  710. Exit Sub
  711. End If
  712. spCallState(ActiveCall) = "Connected"
  713. Call RefreshCallTable
  714. ' Set digit detection
  715. spITCall(ActiveCall).DetectDigits LINEDIGITMODE_DTMF
  716. call CheckError("connect:Detect digits" )
  717. End If 'Call is connected
  718. End If ' event: call state
  719. 'Check only for incoming calls
  720. if event_type = TE_CALLNOTIFICATION Then ' We have an incoming call (an "offering" call)
  721. DIM pITCallNotificationEvent
  722. Set pITCallNotificationEvent = MAPPER.QueryDispatchInterface(_
  723. IID_String_ITCallNotificationEvent,tapi_event)
  724. Call CheckError("TAPIOBJ_Event:query for pITDirectoryObjectUser")
  725. CallOwnership = pITCallNotificationEvent.Event
  726. Set pITCallInfo = pITCallNotificationEvent.Call
  727. Call CheckError("TAPIOBJ_Event:get pITCallInfo")
  728. if not blnShowOnlyOnce and pITCallInfo.CallState = CS_OFFERING and not ( CallOwnership = CNE_OWNER) Then
  729. MsgBox "Unable to accept incoming calls: is other instance of this app running?",0,"Info"
  730. blnShowOnlyOnce = True
  731. Exit Sub
  732. End IF
  733. if CallOwnership = CNE_OWNER Then 'We are the owner!
  734. 'Create new call entry
  735. ' Find new entry in call array
  736. DIM CallNumber
  737. CallNumber = 0
  738. For i = 1 to MaxCallNumber
  739. if IsEmpty(spITCall(i)) Then
  740. CallNumber = i
  741. Exit For
  742. End If
  743. Next
  744. If CallNumber = 0 Then
  745. MsgBox "Maximum number of calls reached. Disconnect call first",0,"connect"
  746. Exit Sub
  747. End If
  748. if pITCallInfo.CallState = CS_OFFERING Then 'Offering
  749. sCalleeName = pITCallInfo.CallInfoString(CIS_CALLERIDNAME)
  750. if not Err.number = 0 then ' Caller ID name is not supported
  751. sCalleeName = "Unknown"
  752. Err.Clear
  753. End if
  754. sCallerNumber = pITCallInfo.CallInfoString(CIS_CALLERIDNUMBER)
  755. if not Err.number = 0 then ' Caller ID number is not supported
  756. sCallerNumber = ""
  757. Err.Clear
  758. Else
  759. sCallerNumber = " {" & sCallerNumber & "}"
  760. End If
  761. sCalleeName = sCalleeName & sCallerNumber
  762. sRName2 = pITCallInfo.CallInfoString(CIS_REDIRECTINGIDNAME)
  763. if not Err.number = 0 then
  764. sRName2 = ""
  765. Err.Clear
  766. End If
  767. sRNumber = pITCallInfo.CallInfoString(CIS_REDIRECTINGIDNUMBER)
  768. if not Err.number = 0 then ' Caller ID number is not supported
  769. sRNumber = ""
  770. Err.Clear
  771. Else
  772. sRNumber = " {" & sRNumber & "}"
  773. End If
  774. sRName2 = sRName2 & sRNumber
  775. if not sRName2 = "" Then
  776. ' Trying to get forwarding reason
  777. dueTo = ""
  778. reason = pITCallInfo.CallInfoLong( CIL_REASON)
  779. if not Err.number = 0 then ' non che
  780. Err.Clear
  781. Else
  782. 'tapi.h:#define LINECALLREASON_FWDBUSY 0x00000002
  783. 'tapi.h:#define LINECALLREASON_FWDNOANSWER 0x00000004
  784. 'tapi.h:#define LINECALLREASON_FWDUNCOND 0x00000008
  785. if reason = 2 Then
  786. dueTo = " since original caller was busy"
  787. Else
  788. if reason = 4 Then
  789. dueTo = " since original caller does not answer"
  790. End If
  791. End If
  792. End if
  793. sRName2 = " ( Forwarded from " & sRName2 & dueTo &" )"
  794. End if
  795. DIM pITCallOffer
  796. Set pITCallOffer = MAPPER.QueryDispatchInterface( _
  797. IID_String_ITBasicCallControl, pITCallInfo)
  798. Call CheckError("TAPIOBJ_Event:query for pITCall")
  799. Set spITCall(CallNumber) = pITCallOffer
  800. spCallState(CallNumber) = "Offering..."
  801. spCallerCallee(CallNumber) = "Incoming " & sCalleeName &" " & sRName2
  802. spTerminalState(CallNumber) = FALSE
  803. spDtmfDetected(CallNumber) = ""
  804. Call RefreshCallTable
  805. if AutoAnswer.value ="on" Then
  806. Call AcceptIncomingCall(CallNumber,pITCallOffer, pITCallInfo)
  807. End If
  808. End If 'Call is offering
  809. End If 'We are owner
  810. End If 'Call Notification has arrived
  811. 'DTMF detection
  812. if event_type = TE_DIGITEVENT Then
  813. DIM pITDigitDetectionEvent
  814. Set pITDigitDetectionEvent = MAPPER.QueryDispatchInterface(_
  815. IID_String_ITDigitDetectionEvent,tapi_event)
  816. Call CheckError("TAPIOBJ_Event:query for pITDigitDetectionEvent")
  817. digit = pITDigitDetectionEvent.Digit
  818. Set pITCallInfo = pITDigitDetectionEvent.Call
  819. call CheckError("TAPIOBJ_Event:get CallInfo" )
  820. Set pITCall = MAPPER.QueryDispatchInterface( _
  821. IID_String_ITBasicCallControl, pITCallInfo)
  822. call CheckError("TAPIOBJ_Event:get Call from CallInfo" )
  823. 'Find call entry
  824. ActiveCall = 0
  825. For i = 1 to MaxCallNumber
  826. if spITCall(i) Is pITCall Then
  827. ActiveCall = i
  828. Exit For
  829. End If
  830. Next
  831. if ActiveCall = 0 Then
  832. 'Bogus call : no such call
  833. Exit Sub
  834. End If
  835. spDtmfDetected(ActiveCall) = spDtmfDetected(ActiveCall) & Chr(digit)
  836. Call RefreshCallTable
  837. End if
  838. End Sub
  839. '*
  840. '*
  841. '*
  842. '*
  843. Sub AnswerCall
  844. On Error Resume Next
  845. if check_call() Then
  846. ActiveCall = selectCalls.value
  847. DIM pITCallInfo
  848. Set pITCallInfo = MAPPER.QueryDispatchInterface( _
  849. IID_String_ITCallInfo,spITCall(ActiveCall))
  850. Call CheckError("Get CallInfo from Call in AnswerCall")
  851. Call AcceptIncomingCall(ActiveCall,spITCall(ActiveCall), pITCallInfo)
  852. Call RefreshCallTable
  853. End If
  854. End Sub
  855. '******************************************************************
  856. '******************************************************************
  857. '******************************************************************
  858. ' Sub for incoming calls processing
  859. Sub AcceptIncomingCall(CallNumber,pITCallIncoming,pITCallInfoIncoming)
  860. On Error Resume Next
  861. 'Get address
  862. sUnableToComplete = False
  863. DIM pITAddress
  864. Set pITAddress = pITCallInfoIncoming.Address
  865. Call CheckError("AcceptIncomingCall:pITCallInfo.Address")
  866. sname1 = pITCallInfoIncoming.CallerIDName
  867. if not Err.number = 0 Then
  868. sname1 = "Unknown"
  869. Err.Clear
  870. End If
  871. Call CheckError("AcceptIncomingCall:sFriendltName")
  872. Call UnselectTerminals
  873. 'sAddressName = pITAddress.AddressName
  874. Call CheckError("AcceptIncomingCall:AddressName")
  875. Call CreateCallWindow(pITAddress,False,False)
  876. Call CheckError("AcceptIncomingCall: after CreateCallWindow")
  877. window.status = "Configure terminals."
  878. Call AssignTerminals(CallNumber,pITCallIncoming,False,False,False, False)
  879. call CheckError("AcceptIncomingCall:after AssignTerminals" )
  880. if sUnableToComplete or sbNeedToExit Then
  881. window.status = ""
  882. pITCallIncoming.Disconnect 6 'rejected
  883. Exit Sub
  884. End If
  885. window.status = "Answering..."
  886. Call pITCallIncoming.Answer()
  887. window.status = "Connected."
  888. call CheckError("AcceptIncomingCall:main connect" )
  889. window.status = "Done."
  890. End Sub
  891. '******************************************************************
  892. '******************************************************************
  893. '******************************************************************
  894. ' Disconnect current call
  895. Sub DisconnectCall(CallNumber,callDisc)
  896. On Error resume Next
  897. if not IsEmpty(spITCall(CallNumber)) Then
  898. if not callDisc = 8 and not callDisc = 0 Then
  899. ' We need some kind of message pump here. The following call to MsgBox does exactly this:
  900. MsgBox "A call is disconnected",0,"Disconnect"
  901. End If
  902. Set pVideoWindow1 = Nothing
  903. Set pVideoWindow2 = Nothing
  904. window.status = "You are disconnected"
  905. if callDisc=0 Then
  906. spITCall(CallNumber).Disconnect(DC_NORMAL)
  907. End If
  908. spITCallTransferred(ActiveCall) = Empty
  909. End If
  910. Call RefreshCallTable
  911. End Sub
  912. '******************************************************************
  913. '******************************************************************
  914. '******************************************************************
  915. ' Disconnect call if we have one and shutdown TAPI object on exit from page
  916. Sub window_onunload
  917. On Error Resume Next
  918. Call DisconnectCall(0)
  919. TAPIOBJ.Shutdown
  920. End Sub
  921. '******************************************************************
  922. '******************************************************************
  923. '******************************************************************
  924. ' Used by radio button: address type
  925. Sub change_type
  926. sCurrentAddressType = CInt(window.event.srcElement.value )
  927. End Sub
  928. '********************************************************************
  929. '********************************************************************
  930. '********************************************************************
  931. '********************************************************************
  932. 'small function to change value of checkboxes in a more appropriate
  933. ' manner.
  934. Sub togglechk()
  935. 'Toggle state of checkbox
  936. If (window.event.srcElement.value = "off") Then
  937. window.event.srcElement.value ="on"
  938. Else
  939. window.event.srcElement.value ="off"
  940. End IF
  941. End Sub
  942. '********************************************************************
  943. '********************************************************************
  944. '********************************************************************
  945. '********************************************************************
  946. Sub PressCreateRule
  947. buttFCreate.disabled = True
  948. editDestination.value = ""
  949. editCaller.value = ""
  950. FwdInfo.style.visibility = "visible"
  951. End Sub
  952. '******************************************************************
  953. '******************************************************************
  954. '******************************************************************
  955. ' Used by radio button: forward type
  956. Sub changeF_type
  957. On Error resume Next
  958. FwdType = CInt(window.event.srcElement.value )
  959. End Sub
  960. '********************************************************************
  961. '********************************************************************
  962. '********************************************************************
  963. '********************************************************************
  964. Sub FRuleCancel
  965. On Error resume Next
  966. buttFCreate.disabled = False
  967. FwdInfo.style.visibility = "hidden"
  968. End Sub
  969. '********************************************************************
  970. '********************************************************************
  971. '********************************************************************
  972. '********************************************************************
  973. Sub FRuleCreate
  974. On Error resume Next
  975. if FwdType = 0 Then
  976. MsgBox "Forwarding type is not selected"
  977. Exit Sub
  978. End if
  979. 'Find address selected
  980. DIM pITAddress_Connect
  981. Set pITAddress_Connect = spITAddress
  982. call CheckError("Before create" )
  983. Set pCall = pITAddress_Connect.CreateCall("",1,S_MEDIA_AUDIOVIDEO)
  984. call CheckError("CreateCall" )
  985. Set pForwarding = pITAddress_Connect.CreateForwardInfoObject
  986. call CheckError("CreateForwardInfoObject" )
  987. pForwarding.NumRingsNoAnswer = 2
  988. call CheckError("NumRingsNoAnswer" )
  989. if editCaller.value = "" Then
  990. if FwdType = 1 Then
  991. FwdT = 1
  992. elseif FwdType = 2 Then
  993. FwdT = 16
  994. elseif FwdType = 3 Then
  995. FwdT = 256
  996. else
  997. FwdT = 4096
  998. end if
  999. else
  1000. if FwdType = 1 Then
  1001. FwdT = 8
  1002. elseif FwdType = 2 Then
  1003. FwdT = 128
  1004. elseif FwdType = 3 Then
  1005. FwdT = 2048
  1006. else
  1007. FwdT = 32768
  1008. end if
  1009. end if
  1010. pForwarding.SetForwardType FwdT, editDestination.value, editCaller.value
  1011. call CheckError("An error occured while preparing forward information" )
  1012. pITAddress_Connect.Forward pForwarding, pCall
  1013. call CheckError("An error occured while setting forward information" )
  1014. Call FRuleCancel
  1015. Call PopulateFwdRules
  1016. End Sub
  1017. '********************************************************************
  1018. '********************************************************************
  1019. '********************************************************************
  1020. '********************************************************************
  1021. Sub PopulateFwdRules
  1022. On Error resume Next
  1023. ' clear select
  1024. 'Remove all from list
  1025. 'For i = 0 to selectRules.options.length
  1026. ' selectRules.remove(0)
  1027. 'Next
  1028. 'get forward info
  1029. Set CurrentFwd = spITAddress.CurrentForwardInfo
  1030. call CheckError("CurrentForwardInfo" )
  1031. 'now lets find all about it...
  1032. FwdT = 1
  1033. fRule.innerHTML = ""
  1034. For i = 1 to 18
  1035. s1 =""
  1036. s2 =""
  1037. s2 = CurrentFwd.ForwardTypeCaller(FwdT)
  1038. call CheckError("GetForwardType" )
  1039. s1 = CurrentFwd.ForwardTypeDestination(FwdT)
  1040. call CheckError("GetForwardType1" )
  1041. if Not (s1 ="") Then
  1042. if FwdT = 1 or FwdT = 8 Then
  1043. s4 = "always"
  1044. elseif FwdT = 16 or FwdT = 128 Then
  1045. s4 = "when we are busy"
  1046. elseif FwdT = 256 or FwdT = 2048 Then
  1047. s4 = "on no answer"
  1048. else
  1049. s4 = "on no answer or busy"
  1050. end if
  1051. if Not (Asc(s1) = 63) Then
  1052. s5 = "from "& s1 & " "
  1053. else
  1054. s5 = " "
  1055. end if
  1056. s3 = "Forward calls "& s5 & s4 & " to "& s2
  1057. 'Set oOption = document.createElement("OPTION")
  1058. 'oOption.text = s3
  1059. 'oOption.value = s3
  1060. 'selectRules.add(oOption)
  1061. fRule.innerHTML = fRule.innerHTML & s3 & "<BR>"
  1062. End if
  1063. FwdT = FwdT * 2
  1064. Next
  1065. if fRule.innerHTML = "" Then
  1066. fRule.innerHTML = "No rules are active"
  1067. End if
  1068. End Sub
  1069. '
  1070. ''
  1071. ''
  1072. ''
  1073. '
  1074. '********************************************************************
  1075. Function check_call
  1076. On Error Resume Next
  1077. check_call = True
  1078. if selectCalls.value = "" or IsEmpty(selectCalls.value) Then
  1079. MsgBox "You need to select call first",0,"Operations"
  1080. check_call= False
  1081. End if
  1082. End Function
  1083. '
  1084. ''
  1085. ''
  1086. ''
  1087. Sub DeleteCall
  1088. On Error Resume Next
  1089. if check_call() Then
  1090. ActiveCall = selectCalls.value
  1091. Set spITCall(ActiveCall) = Nothing
  1092. spITCall(ActiveCall) = Empty
  1093. spCallerCallee(ActiveCall) = ""
  1094. Call RefreshCallTable
  1095. End If
  1096. End Sub
  1097. '
  1098. '
  1099. '
  1100. '
  1101. '
  1102. Sub DisconnectThisCall
  1103. On Error Resume Next
  1104. if check_call() Then
  1105. ActiveCall = selectCalls.value
  1106. Call DisconnectCall(ActiveCall, 0)
  1107. Call RefreshCallTable
  1108. End If
  1109. End Sub
  1110. '
  1111. '
  1112. '
  1113. '
  1114. '
  1115. Sub HoldCall
  1116. On Error Resume Next
  1117. if check_call() Then
  1118. ActiveCall = selectCalls.value
  1119. if ISEmpty(spCallOnHold(ActiveCall)) Or spCallOnHold(ActiveCall) = FALSE Then
  1120. spCallOnHold(ActiveCall) = TRUE
  1121. Else
  1122. spCallOnHold(ActiveCall) = FALSE
  1123. End If
  1124. spITCall(ActiveCall).Hold(spCallOnHold(ActiveCall))
  1125. Call CheckError("HoldCall: ITBAsicCallControl.Hold")
  1126. Call RefreshCallTable
  1127. End If
  1128. End Sub
  1129. '
  1130. '
  1131. '
  1132. '
  1133. '
  1134. Sub BlindTransferCall
  1135. On Error Resume Next
  1136. if check_call() Then
  1137. ActiveCall = selectCalls.value
  1138. sDestinationAddress= InputBox("Enter destination for call transfer", "Blind Transfer")
  1139. spITCall(ActiveCall).BlindTransfer(sDestinationAddress)
  1140. spCallerCallee(ActiveCall) = spCallerCallee(ActiveCall) & "(BTRNSF:"&sDestinationAddress& ")"
  1141. CheckError("Call BlindTransfer")
  1142. End If
  1143. End Sub
  1144. '
  1145. '
  1146. '
  1147. '
  1148. '
  1149. Sub RedirectCall
  1150. On Error Resume Next
  1151. if check_call() Then
  1152. ActiveCall = selectCalls.value
  1153. sDestinationAddress= InputBox("Enter new destination for call", "Call Redirection")
  1154. spITCall(ActiveCall).BlindTransfer(sDestinationAddress)
  1155. spCallerCallee(ActiveCall) = spCallerCallee(ActiveCall) & "(Blind TRSFR:"&sDestinationAddress& ")"
  1156. CheckError("Call BlindTransfer")
  1157. End If
  1158. End Sub
  1159. '
  1160. '
  1161. '
  1162. '
  1163. '
  1164. '
  1165. Sub SelectTerminals
  1166. On Error Resume Next
  1167. if check_call() Then
  1168. ActiveCall = selectCalls.value
  1169. Call UnselectTerminals
  1170. DIM pITCallInfo
  1171. Set pITCallInfo = MAPPER.QueryDispatchInterface( _
  1172. IID_String_ITCallInfo, spITCall(ActiveCall))
  1173. Set pITAddress = pITCallInfo.Address
  1174. call CheckError("connect:get CalllInfo from Call" )
  1175. Call CreateCallWindow(pITAddress,False,False)
  1176. Call CheckError("SelectTerminals: after CreateCallWindow")
  1177. Call AssignTerminals(ActiveCall,spITCall(ActiveCall),False,False,False, True)
  1178. Call RefreshCallTable
  1179. End If
  1180. End Sub
  1181. '
  1182. '
  1183. '
  1184. '
  1185. '
  1186. Sub TransferCall
  1187. 'Not yet fully implemented, workaroud for now..
  1188. On Error Resume Next
  1189. if check_call() Then
  1190. ActiveCall = selectCalls.value
  1191. sDestinationAddress= InputBox("Enter destination for call transfer", "Transfer")
  1192. spCallerCallee(ActiveCall) = spCallerCallee(ActiveCall) & "(TRNSFR:"&sDestinationAddress& ")"
  1193. DIM pITCallInfo
  1194. Set pITCallInfo = MAPPER.QueryDispatchInterface( _
  1195. IID_String_ITCallInfo, spITCall(ActiveCall))
  1196. Set pITAddress = pITCallInfo.Address
  1197. Set pCall = pITAddress.CreateCall(sDestinationAddress,16, S_MEDIA_AUDIOVIDEO)
  1198. CheckError("Call Transfer: Create Call")
  1199. Set Call1= spITCall(ActiveCall)
  1200. 'Unselect Terminals from previous call
  1201. 'if Not spCallOnHold(ActiveCall) Then
  1202. ' Call1.Hold(TRUE)
  1203. ' CheckError("Call Transfer: Hold Call")
  1204. ' spCallOnHold(ActiveCall) = TRUE
  1205. 'End If
  1206. Call UnselectTerminals
  1207. 'Set spITCallTransferred(ActiveCall) = pCall
  1208. 'do not make Call UnselectTerminals
  1209. ' Find new entry in call array
  1210. DIM CallNumber
  1211. CallNumber = 0
  1212. For i = 1 to MaxCallNumber
  1213. if IsEmpty(spITCall(i)) Then
  1214. CallNumber = i
  1215. Exit For
  1216. End If
  1217. Next
  1218. If CallNumber = 0 Then
  1219. MsgBox "Maximum number of calls reached. Disconnect call first",0,"connect"
  1220. Exit Sub
  1221. End If
  1222. Set spITCall(CallNumber) = pCall
  1223. spCallState(CallNumber) = "Initiating transfer..."
  1224. spCallerCallee(CallNumber) = "To " & pConnectTo
  1225. spDtmfDetected(CallNumber) = ""
  1226. 'Select Terminals
  1227. Call CreateCallWindow(pITAddress,False,False)
  1228. Call CheckError("Call Transfer: after CreateCallWindow")
  1229. window.status = "Configure terminals."
  1230. Call AssignTerminals(CallNumber,pCall,False,False,False,False)
  1231. call CheckError("Call Transfer:after AssignTerminals" )
  1232. Call1.Transfer pCall , FALSE
  1233. Call CheckError("CreateTransfer: Transfer")
  1234. End If
  1235. Call RefreshCallTable
  1236. End Sub
  1237. Sub FinishTransferCall
  1238. On Error Resume Next
  1239. if check_call() Then
  1240. ActiveCall = selectCalls.value
  1241. Set Call1= spITCall(ActiveCall)
  1242. 'if IsEmpty(spITCallTransferred(ActiveCall)) Then
  1243. ' MsgBox "Wrong call to finish transfer"
  1244. ' Exit Sub
  1245. ' End If
  1246. Call1.Finish 0
  1247. Call CheckError("FinishTransferCall: Finish")
  1248. spITCallTransferred(ActiveCall) = Empty
  1249. End If
  1250. End Sub
  1251. '
  1252. '
  1253. '
  1254. '
  1255. DIM sKeypadCall
  1256. Sub SendDTMF
  1257. if check_call() Then
  1258. ActiveCall = selectCalls.value
  1259. sKeypadCall = ActiveCall
  1260. divKeypad.style.visibility = "visible"
  1261. End If
  1262. End Sub
  1263. Sub CancelDtmf
  1264. divKeypad.style.visibility = "hidden"
  1265. End Sub
  1266. '******************************************************************
  1267. '******************************************************************
  1268. '******************************************************************
  1269. Sub DoClick
  1270. On Error Resume Next
  1271. window.event.cancelBubble = True
  1272. '1. Determine element that is clicked
  1273. Set sCurrentlyClickedButton = window.event.srcElement
  1274. '2. Change background to blue
  1275. sCurrentlyClickedButton.style.background = "blue"
  1276. 'Send DTMF code
  1277. spITCall(sKeypadCall).GenerateDigits sCurrentlyClickedButton.value,2 'DTMF mode
  1278. Call CheckError("DoClick:pITLegacyCallMediaControl.GenerateDigits")
  1279. sCurrentlyClickedButton.style.background = "gray"
  1280. End Sub
  1281. </script>
  1282. <div id="AllElementsNonSimple" style="position:absolute;top:5px" >
  1283. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 0px;width:400px;background:blue;LEFT:0px;FONT-SIZE:18px;COLOR:white;TEXT-ALIGN:center">
  1284. Dialing center
  1285. </p>
  1286. <div id="UserSelectionSection" style="position:absolute;Width:300px">
  1287. <p style="HEIGHT: 20px; background:#000080;POSITION: absolute; TOP: 20px;width:200px;LEFT:20px;FONT-SIZE:16px;COLOR:white;TEXT-ALIGN:center">
  1288. Address to call
  1289. </p>
  1290. <p style="HEIGHT: 20px; POSITION: absolute; background:#000080;TOP: 75px;width:200px;LEFT:20px;FONT-SIZE:16px;COLOR:white;TEXT-ALIGN:center">
  1291. Address type
  1292. </p>
  1293. <input id="txtAddress" style="HEIGHT: 30px; POSITION: absolute; TOP: 40px;LEFT:20px;FONT-SIZE:16px;COLOR:black;WIdth:200px">
  1294. <div id="divRadioGroup" style="BORDER-BOTTOM: black 2px solid; BORDER-LEFT: black 2px solid; BORDER-RIGHT: black 2px solid; BORDER-TOP: black 2px solid; HEIGHT: 80px; LEFT: 20px; POSITION: absolute; TOP: 100px; WIDTH: 200px">
  1295. <font style="COLOR: black; FONT-SIZE: 12px;font-style:oblique">
  1296. <input id="radioAddressType" name="radioAddressType" onclick="change_type()" style="HEIGHT: 20px; POSITION: absolute; TOP: 10px;LEFT:10px" type="radio" value="16" title="IP Address">
  1297. <input id="radioAddressType" name="radioAddressType" onclick="change_type()" style="HEIGHT: 20px; POSITION: absolute; TOP: 40px; LEFT:10px" type="radio" value="1" title="Phone Number">
  1298. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 10px;LEFT:40px">
  1299. IP Address
  1300. </p>
  1301. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 40px;LEFT:40px">
  1302. Phone Number
  1303. </p>
  1304. </font>
  1305. </div>
  1306. </div>
  1307. <div id="Separator3" style="position:absolute;BORDER-BOTTOM: blue 2px solid; BORDER-LEFT: blue 2px solid; BORDER-RIGHT: blue 2px solid; BORDER-TOP: blue 2px solid; HEIGHT: 305px; LEFT:405px; POSITION: absolute; TOP: 0px; WIDTH: 0px">
  1308. </div>
  1309. <div id="PropertiesSelectionSection" style="LEFT:0px;ALIGN:CENTER;position:absolute;top:190px;Width:400px">
  1310. <p style="HEIGHT: 10px; POSITION: absolute; TOP: 0px;background:#808080;width:100%;LEFT:0px;FONT-SIZE:18px;COLOR:white;TEXT-ALIGN:center">
  1311. Originating address and call properties
  1312. </p>
  1313. <p style="HEIGHT: 20px; POSITION: absolute;background:#000080; TOP: 20px;width:200px;LEFT:0px;FONT-SIZE:16px;COLOR:white;TEXT-ALIGN:center">
  1314. Address
  1315. </p>
  1316. <select id="selAddress" name="selAddress" onchange="changeOptionsState()" style="position:absolute;width:200px;Left:0px;FONT-SIZE:16px;COLOR:black;top:40px">
  1317. </select>
  1318. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 20px;width:150px;LEFT:200px;FONT-SIZE:16px;COLOR:black;TEXT-ALIGN:center">
  1319. Setup audio only
  1320. </p>
  1321. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 40px;width:150px;LEFT:200px;FONT-SIZE:16px;COLOR:black;TEXT-ALIGN:center">
  1322. Setup no video-out
  1323. </p>
  1324. <input type="checkbox" id="checkAOnly" name="checkAROnly" value="off" onclick="togglechk()" style="HEIGHT: 20px; LEFT: 350px; POSITION: absolute; TOP: 20px; WIDTH: 20px" title="Connect Audio Only">
  1325. <input type="checkbox" id="checkNoOutgoingVideo" value="off" onclick="togglechk()" style="HEIGHT: 20px; LEFT: 350px; POSITION: absolute; TOP: 40px; WIDTH: 20px" title="Do not send outgoing video">
  1326. </div>
  1327. </div>
  1328. <INPUT type=button id="buttConnect" style="cursor:hand;LEFt:40px; HEIGHT: 30px; POSITION: absolute; WIDTH: 300px; top:270px" onclick="PressConnect()" value="Create new call" title="Create new call">
  1329. <!--p id=ConnANN style="HEIGHT: 20px; POSITION: absolute; TOP: 305px;width:100%;background:blue;LEFT:3px;FONT-SIZE:18px;COLOR:white;TEXT-ALIGN:center">
  1330. </p-->
  1331. <hr id=secHr1243 size=1 ALIGN=RIGHT style="color:blue;position:absolute;Top:310px;Left:0px;width:100%">
  1332. <div style="HEIGHT: 150px; POSITION: absolute; TOP: 315px;width:100%;LEFT:10px;FONT-SIZE:18px;COLOR:black">
  1333. <p style="POSITION: absolute; background:blue; TOP: 10px;width:400px;LEFT:0px;FONT-SIZE:18px;COLOR:white;TEXT-ALIGN:center">
  1334. Forwarding information
  1335. </p>
  1336. <P id=FRule style="FONT-SIZE: 16px;color:blue;z-index:10; HEIGHT: 100px; LEFT: 20px; POSITION: absolute; TOP: 35px; WIDTH: 350px;BORDER-BOTTOM: blue 1px solid; BORDER-LEFT: blue 1px solid; BORDER-RIGHT: blue 1px solid; BORDER-TOP: blue 1px solid">
  1337. </P>
  1338. <INPUT type=button id="buttFCreate" style="cursor:hand;LEFt:20px; HEIGHT: 30px; POSITION: absolute; WIDTH: 350px; top:140px" onclick="PressCreateRule()" value="Create New Forward rule" title="Create New Forward rule">
  1339. <!--INPUT type=button id="buttFClear" style="visibility:hidden;cursor:hand;LEFt:20px; HEIGHT: 30px; POSITION: absolute; WIDTH: 200px; top:100px" onclick="PressClearForward()" value="Clear Forwarding" title="Clear Forwarding"-->
  1340. <!--hr id=secHr1 size=1 ALIGN=RIGHT style="color:blue;position:absolute;Top:135px;Left:0px;width:300px"-->
  1341. <!--p style="POSITION: absolute; TOP: 140px;width:100%;LEFT:50px;FONT-SIZE:18px;COLOR:black">
  1342. Current forward rules
  1343. </p-->
  1344. <!--SELECT size=2 id=selectRules name=selectRules
  1345. style="FONT-SIZE: 12px;z-index:10; HEIGHT: 150px; LEFT: 20px; POSITION: absolute; TOP: 160px; WIDTH: 200px">
  1346. </SELECT-->
  1347. <!--INPUT type=button style="cursor:hand;LEFt:30px; HEIGHT: 20px; POSITION: absolute; WIDTH: 180px; top:320px" onclick="PopulateFwdRules()" value="refresh" title="Refresh Rules"-->
  1348. <hr id=secHr1 size=2 ALIGN=RIGHT style="color:blue;position:absolute;Top:180px;Left:0px;width:405px">
  1349. <div id="Separator3" style="position:absolute;BORDER-BOTTOM: blue 2px solid; BORDER-LEFT: blue 2px solid; BORDER-RIGHT: blue 2px solid; BORDER-TOP: blue 2px solid; HEIGHT: 250px; LEFT:405px; POSITION: absolute; TOP: -10px; WIDTH: 0px">
  1350. </div>
  1351. <p style="POSITION: absolute; background:blue; TOP: 190px;width:400px;LEFT:0px;FONT-SIZE:18px;COLOR:white;TEXT-ALIGN:center">
  1352. Application features
  1353. </p>
  1354. <input disabled type="checkbox" id="AutoAnswer" name="AutoAnswer" value="off" onclick="togglechk()" style="HEIGHT: 20px; LEFT: 140px; POSITION: absolute; TOP: 220px; WIDTH: 20px" title="Auto Answer">
  1355. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 220px;LEFT:20px">
  1356. Auto Answer
  1357. </p>
  1358. <!--p style="POSITION: absolute; TOP: 250px;width:100%;LEFT:50px;FONT-SIZE:18px;COLOR:black">
  1359. DTMF digits detected
  1360. </p>
  1361. <P id=DTMFD style="FONT-SIZE: 16px;color:blue;z-index:10; HEIGHT: 100px; LEFT: 20px; POSITION: absolute; TOP: 280px; WIDTH: 200px">
  1362. </P-->
  1363. <div id=TransfInfo style="visibility:hidden;POSITION: absolute; TOP: 0px;width:350;LEFT:420px;FONT-SIZE:22px;COLOR:black;background-color:grey">
  1364. <p style="POSITION: absolute; TOP: 10px;width:350px;LEFT:20px;FONT-SIZE:22px;COLOR:white;background:blue">
  1365. Call Transfer
  1366. </p>
  1367. <p id=transp style="POSITION: absolute; TOP: 50px;width:350px;LEFT:20px;FONT-SIZE:22px;COLOR:black">
  1368. </p>
  1369. <INPUT type=button style="cursor:hand;LEFt:10px; HEIGHT: 30px; POSITION: absolute; WIDTH: 150px; top:200px" onclick="CreateTransfer()" value="Make Transfer" title="Make Transfer">
  1370. <INPUT type=button style="cursor:hand;LEFt:180px; HEIGHT: 30px; POSITION: absolute; WIDTH: 150px; top:200px" onclick="CancelTransfer()" value="Cancel Transfer" title="Cancel Transfer">
  1371. </div>
  1372. <div id=FwdInfo style="visibility:hidden;POSITION: absolute; TOP: 0px;width:350;LEFT:420px;FONT-SIZE:22px;COLOR:black;background-color:grey">
  1373. <p style="POSITION: absolute; TOP: 10px;width:100%;LEFT:20px;FONT-SIZE:22px;COLOR:black">
  1374. New Forward Rule
  1375. </p>
  1376. <p style="POSITION: absolute; TOP: 50px;width:100%;LEFT:20px;FONT-SIZE:18px;COLOR:black">
  1377. Forward to
  1378. </p>
  1379. <INPUT id="editDestination" style="LEFt:20px; HEIGHT: 25px; POSITION: absolute; WIDTH: 120px; top:70px" >
  1380. <p style="POSITION: absolute; TOP: 100px;width:100%;LEFT:20px;FONT-SIZE:18px;COLOR:black">
  1381. When
  1382. </p>
  1383. <div style="HEIGHT: 200px; LEFT: 20px; POSITION: absolute; TOP: 110px; WIDTH: 300px">
  1384. <font style="COLOR: black; FONT-SIZE: 12px;font-style:oblique">
  1385. <input id="radioFType" name="radioFType" onclick="changeF_type()" style="HEIGHT: 20px; POSITION: absolute; TOP: 10px;LEFT:10px" type="radio" value="1" title="Unconditional forward">
  1386. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 10px;LEFT:40px">
  1387. Always
  1388. </p>
  1389. <input id="radioFType" name="radioFType" onclick="changeF_type()" style="HEIGHT: 20px; POSITION: absolute; TOP: 30px;LEFT:10px" type="radio" value="2" title="Forward when we are busy">
  1390. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 30px;LEFT:30px">
  1391. Forward when we are busy
  1392. </p>
  1393. <input id="radioFType" name="radioFType" onclick="changeF_type()" style="HEIGHT: 20px; POSITION: absolute; TOP: 50px;LEFT:10px" type="radio" value="3" title="Forward on no answer">
  1394. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 50px;LEFT:30px">
  1395. Forward on no answer
  1396. </p>
  1397. <input id="radioFType" name="radioFType" onclick="changeF_type()" style="HEIGHT: 20px; POSITION: absolute; TOP: 70px;LEFT:10px" type="radio" value="4" title="Forward on no answer or busy">
  1398. <p style="HEIGHT: 20px; POSITION: absolute; TOP: 70px;LEFT:30px">
  1399. Forward on no answer or busy
  1400. </p>
  1401. </font>
  1402. </div>
  1403. <p style="POSITION: absolute; TOP: 200px;width:100%;LEFT:20px;FONT-SIZE:18px;COLOR:black">
  1404. Forward only this caller:
  1405. </p>
  1406. <INPUT id="editCaller" style="LEFt:20px; HEIGHT: 25px; POSITION: absolute; WIDTH: 120px; top:220px" >
  1407. <INPUT type=button id="buttFRule" style="cursor:hand;LEFt:20px; HEIGHT: 30px; POSITION: absolute; WIDTH: 100px; top:250px" onclick="FRuleCreate()" value="Create" title="Create Rule">
  1408. <INPUT type=button id="buttFRule" style="cursor:hand;LEFt:140px; HEIGHT: 30px; POSITION: absolute; WIDTH: 100px; top:250px" onclick="FRuleCancel()" value="Cancel" title="Cancel Rule Creation">
  1409. </div>
  1410. </div>
  1411. <div style="position:absolute;top:0px;left:410px">
  1412. <p style="POSITION: absolute; TOP: 5px;width:580px;background:blue;LEFT:0px;FONT-SIZE:18px;COLOR:white;TEXT-ALIGN:center;LEFT:20px;FONT-SIZE:18px;COLOR:white">
  1413. Call Table
  1414. </p>
  1415. <SELECT size=2 id=selectCalls name=selectCalls
  1416. style="FONT-SIZE: 10px;z-index:10; HEIGHT: 262px; LEFT: 20px; POSITION: absolute; TOP: 40px; WIDTH: 380px">
  1417. </SELECT>
  1418. <INPUT type=button id="buttAnswer" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:35px" onclick="AnswerCall()" value="Answer Call" title="Answer Call">
  1419. <INPUT type=button id="buttRedirect" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:60px" onclick="RedirectCall()" value="Redirect Call" title="Redirect Call">
  1420. <INPUT type=button id="buttBlindTransfer" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:85px" onclick="BlindTransferCall()" value="Blind Transfer" title="Blind Transfer">
  1421. <INPUT type=button id="buttTransfer" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:110px" onclick="TransferCall()" value="Start Transfer" title="StartTransfer">
  1422. <INPUT type=button id="buttDisconnect" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:135px" onclick="FinishTransferCall()" value="Finish Transfer" title="Finish Transfer">
  1423. <INPUT type=button id="buttDisconnect" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:160px" onclick="DisconnectThisCall()" value="Disconnect" title="Disconnect">
  1424. <INPUT type=button id="buttHold" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:185px" onclick="HoldCall()" value="Hold/UnHold" title="Hold/UnHold">
  1425. <INPUT type=button id="buttUnselect" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:210px" onclick="SelectTerminals()" value="SelectTerminals" title="SelectTerminals">
  1426. <INPUT type=button id="buttDelete" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:235px" onclick="DeleteCall()" value="Delete Call" title="Delete Call">
  1427. <INPUT type=button id="buttDTMF" style="cursor:hand;LEFt:405px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:260px" onclick="SendDTMF()" value="Send DTMF" title="Send DTMF">
  1428. </div>
  1429. <div id=divKeypad style="visibility:hidden;HEIGHT: 200px; LEFT: 460px; POSITION: absolute; TOP: 305px; WIDTH: 150px">
  1430. <div style="BORDER-BOTTOM: black 2px solid; BORDER-LEFT: black 2px solid;
  1431. BORDER-RIGHT: black 2px solid; BORDER-TOP: black 2px solid;
  1432. HEIGHT: 180px; LEFT: 0px; POSITION: absolute; TOP: 20px; WIDTH: 150px;background:#000080;">
  1433. <INPUT id=butt1 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:10px;left:20px;width:30px"
  1434. value="1">
  1435. <INPUT id=butt2 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:10px;left:60px;width:30px"
  1436. value="2">
  1437. <INPUT id=butt3 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:10px;left:100px;width:30px"
  1438. value="3">
  1439. <INPUT id=butt4 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:50px;left:20px;width:30px"
  1440. value="4">
  1441. <INPUT id=butt5 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:50px;left:60px;width:30px"
  1442. value="5">
  1443. <INPUT id=butt6 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:50px;left:100px;width:30px"
  1444. value="6">
  1445. <INPUT id=butt7 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:90px;left:20px;width:30px"
  1446. value="7">
  1447. <INPUT id=butt8 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:90px;left:60px;width:30px"
  1448. value="8">
  1449. <INPUT id=butt9 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:90px;left:100px;width:30px"
  1450. value="9">
  1451. <INPUT id=buttA onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:130px;left:20px;width:30px"
  1452. value="*">
  1453. <INPUT id=butt0 onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:130px;left:60px;width:30px"
  1454. value="0">
  1455. <INPUT id=buttD onclick="DoClick()" type=button style="color:white;background:gray;position:absolute;height:30px;top:130px;left:100px;width:30px"
  1456. value="#">
  1457. <INPUT type=button style="cursor:hand;LEFt:0px; HEIGHT: 25px; POSITION: absolute; WIDTH: 150px; top:200px" onclick="CancelDTMF()" value="Cancel" title="Cancel">
  1458. </div>
  1459. <!-- Listed objects : TAPI(tapi3.idl), DispatchMapper(tapi3.idl) -->
  1460. <object classid="clsid:21D6D48E-A88B-11D0-83DD-00AA003CCABD" id="TAPIOBJ"></object>
  1461. <object classid="clsid:E9225296-C759-11d1-A02B-00C04FB6809F" id="MAPPER"></object>
  1462. <script LANGUAGE="vbscript">
  1463. ' Be shure that you call TAPIOBJ.Initialize before window_onload, otherwise you'll
  1464. ' never receive events from tapi...
  1465. On Error Resume Next
  1466. window.status = "Initialization phase started..."
  1467. call TAPIOBJ.Initialize
  1468. sUnableToComplete = False
  1469. TAPIOBJ.EventFilter = &H1FFFF&
  1470. if Not Err.number = 0 Then
  1471. MsgBox "Unable to perform Tapi3 initialization",0,"Init"
  1472. sUnableToComplete = True
  1473. End If
  1474. </script>
  1475. </body></html>