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.

1585 lines
38 KiB

  1. <HTML XMLNS:helpcenter>
  2. <HEAD>
  3. #include "header.inc"
  4. #include "debug_js.inc"
  5. #include "common.inc"
  6. #include "constants.inc"
  7. <helpcenter:context id=idCtx />
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  9. <meta http-equiv="MSThemeCompatible" content="Yes">
  10. <TITLE>Remote Assistance</TITLE>
  11. <LINK id="UI_StyleSheet" REL="stylesheet" TYPE="text/css" HREF="../../Css/rc.css">
  12. <script id="Script1" name="Script1" LANGUAGE="Javascript" SRC="../../Common/Constants.js"> </script>
  13. <script id="Script2" name="Script2" LANGUAGE="Javascript" SRC="../../Common/common.js"> </script>
  14. <script id="Script3" name="Script3" LANGUAGE="Javascript" SRC="RAServer.js"> </script>
  15. <!-- The SAF class factory object -->
  16. <OBJECT classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7 height=0 id="oSAFClassFactory" name="oSAFClassFactory"
  17. width=0></OBJECT>
  18. </HEAD>
  19. <frameset framespacing=0 id="idFrameSet0" name="idFrameSet0" cols="*,2px,165px" frameborder=0>
  20. <frame id="idFrameChatTop" name="idFrameChatTop" noresize src="RAChatServer.htm">
  21. <frame id="idFrameblank1" name="idFrameblank1" noresize src="DividerBar1.htm">
  22. <frame id="idFrameTools" name="idFrameTools" noresize src="RAServerToolBar.htm">
  23. </frameset>
  24. <SCRIPT Language="JScript">
  25. /*
  26. * Localizable constants, text and messages
  27. */
  28. var L_ERRSWITCHDESKTOPMODE_Text = "Failed to grant remote control.";
  29. var L_ERRRCPERMDENIED_Text = "Remote control of this computer is not allowed.";
  30. var L_TAKECONTROL1_Text = "\n\n----------\n";
  31. var L_TAKECONTROL2_Text = " has taken control of ";
  32. var L_TAKECONTROL3_Text = "'s computer.\n To stop control, press ESC key.\nNote that using any key sequence or combination including the ESC key such as (ESC+TAB) will also stop control\n----------";
  33. //
  34. // VOIP Messages
  35. //
  36. var L_ERRVOIP1_Text = c_szVoiceConnError;
  37. var L_ERRVOIP2_Text = c_szVoiceError;
  38. //
  39. // Globals
  40. //
  41. var vArgs = null;
  42. var g_numTries = 0;
  43. var g_bChatBoxHidden = false;
  44. var g_bNewBinaries = false;
  45. var g_bUserDisconnect = false;
  46. var g_bChatMode = true;
  47. var g_bConnected = false;
  48. var g_bRC = false;
  49. var g_bNewLine = false;
  50. var g_szLocalUser = null;
  51. var g_bVoipConnected = false;
  52. var g_bVoipOn = false;
  53. var g_bStartEnabled = true;
  54. var g_szVoipIPList = null;
  55. var g_szVoipKey = null;
  56. var g_stateVoipMe = 0; // server
  57. var g_stateVoipYou = 0; // client
  58. var g_VoipBandwidth = 0; // Start at Low (0 = Low, 1 = High)
  59. //var oSAFClassFactory = parent.pchealth;
  60. // States
  61. //---------------
  62. // 0 = unknown
  63. // 1 = good
  64. // 2 = bad
  65. g_bDebug = false; // Enable Tracing
  66. function document.onkeydown()
  67. {
  68. TraceFunctEnter("onkeydown");
  69. try
  70. {
  71. if (window.event.keyCode==8)
  72. {
  73. window.event.returnValue=false;
  74. }
  75. }
  76. catch(error)
  77. {
  78. // ignore
  79. DebugTrace("Error: " + error.description + " Number: " + error.number);
  80. }
  81. TraceFunctLeave();
  82. }
  83. function PostInit()
  84. {
  85. TraceFunctEnter("PostInit");
  86. try
  87. {
  88. //
  89. // GetLocalUser
  90. //
  91. GetLocalUser();
  92. //
  93. // Initialize VoIP
  94. //
  95. InitVoIP();
  96. }
  97. catch(error)
  98. {
  99. FatalError( L_RCCTL_Text, error );
  100. }
  101. TraceFunctLeave();
  102. }
  103. function ResizeUI()
  104. {
  105. try
  106. {
  107. idCtx.setWindowDimensions( idCtx.x, idCtx.y, c_RCChatWidth, c_RCChatHeight);
  108. }
  109. catch(error)
  110. {
  111. // ignore
  112. }
  113. }
  114. //
  115. // InitiateRCSession: Initiates the RC Session
  116. //
  117. function InitiateRCSession()
  118. {
  119. try
  120. {
  121. g_bConnected = true;
  122. //
  123. // Initialization
  124. //
  125. InitTrace();
  126. TraceFunctEnter("InitiateRCSession");
  127. frames.idFrameTools.InitRAServerToolBar();
  128. if( (idCtx.width != c_RCChatWidth ) || ( idCtx.height != c_RCChatHeight ))
  129. {
  130. ResizeUI();
  131. }
  132. g_Helpee_oSAFRemoteDesktopSession = parent.oRCSession;
  133. if( parent.gFrom.length > 0 )
  134. {
  135. g_szLocalUser = parent.gFrom;
  136. }
  137. else
  138. {
  139. oDeskMgr = parent.pchealth.CreateObject_RemoteDesktopManager();
  140. userHelpBlob = oDeskMgr.userHelpBlob;
  141. obj = new ActiveXObject( "SAFRCFileDlg.RASetting" );
  142. var sIsIM = obj.GetPropertyInBlob(userHelpBlob, "IM");
  143. if(sIsIM == "1")
  144. {
  145. var oMsgr = new ActiveXObject("Messenger.UIAutomation");
  146. g_szLocalUser = oMsgr.MyFriendlyName;
  147. parent.gFrom = g_szLocalUser;
  148. }
  149. else
  150. {
  151. g_szLocalUser = GetLocalUser();
  152. }
  153. }
  154. DebugTrace("g_szLocalUser: " + g_szLocalUser);
  155. DebugTrace("parent.gFrom: " + parent.gFrom);
  156. }
  157. catch(error)
  158. {
  159. //
  160. // Fatal Error: Unable to initialize
  161. //
  162. FatalError( L_RCCTL_Text, error );
  163. return;
  164. }
  165. //
  166. // Initialize the Helpee End SALEM Objects
  167. //
  168. Init_Helpee_SALEM();
  169. try
  170. {
  171. setTimeout('PostInit()', 1000);
  172. }
  173. catch(error)
  174. {
  175. FatalError( L_ERRFATAL_Text, error );
  176. }
  177. TraceFunctLeave();
  178. return;
  179. }
  180. //
  181. // Security Check
  182. //
  183. function DoLoad()
  184. {
  185. var L_ERRACCESSDENIED_Text = "Directly launching this page is not allowed. ";
  186. MAC_IF_DIRECTLAUNCH_SERVER
  187. {
  188. idBody.style.visibility = "hidden";
  189. alert( L_ERRACCESSDENIED_Text );
  190. return;
  191. }
  192. }
  193. //
  194. // Control Channel Stuff
  195. //
  196. /*++
  197. HELPEE End of the Control Channel
  198. --*/
  199. //
  200. // Helpee_ControlChannelDataReadyEventHandler: Call back to handle control data from helper
  201. //
  202. function Helpee_ControlChannelDataReadyEventHandler()
  203. {
  204. TraceFunctEnter("Helpee_ControlChannelDataReadyEventHandler");
  205. var ControlData = null;
  206. try
  207. {
  208. //
  209. // Data on control channel
  210. //
  211. ControlData = g_Helpee_oControlChannel.ReceiveChannelData();
  212. }
  213. catch(error)
  214. {
  215. FatalError( L_RCCTL_Text, error );
  216. }
  217. //
  218. // Parse the data sent on the control channel
  219. //
  220. Helpee_ParseControlData ( ControlData );
  221. TraceFunctLeave();
  222. return;
  223. }
  224. var g_oDeskMgr = null;
  225. var nRAType = 0;
  226. //
  227. // Helpee_ParseControlData: Parse the data sent on the control channel at the helpee end
  228. //
  229. function Helpee_ParseControlData ( ControlData )
  230. {
  231. TraceFunctEnter("Helpee_ParseControlData");
  232. var Doc = new ActiveXObject("microsoft.XMLDOM");
  233. var RCCommand = null;
  234. var szCommandName = null;
  235. var L_ERRTAKECONTROL3_Text = "Your screen resolution has been changed, which caused ";
  236. var L_ERRTAKECONTROL4_Text = " to lose keyboard and mouse control of your computer. ";
  237. var L_ERRTAKECONTROL5_Text = " can request control of your computer again and resume the session. ";
  238. try
  239. {
  240. if ( true == parent.gIsURA )
  241. {
  242. nRAType = 1;
  243. }
  244. else
  245. {
  246. nRAType = 0;
  247. }
  248. DebugTrace("Calling idCtx.bringToForeground");
  249. idCtx.minimized = false;
  250. idCtx.bringToForeground();
  251. DebugTrace("Calling loadXML on : " + ControlData);
  252. if( false == Doc.loadXML( ControlData ))
  253. {
  254. FatalError ( Doc.parseError.reason );
  255. }
  256. //
  257. // Get the RCCOMMAND node
  258. //
  259. RCCommand = Doc.documentElement;
  260. //
  261. // Get the NAME of the command
  262. //
  263. szCommandName = RCCommand.getAttribute( c_szRCCommandName );
  264. DebugTrace("szCommandName: " + szCommandName );
  265. if( szCommandName == c_szFileXfer )
  266. {
  267. DebugTrace("Calling SoundBeep");
  268. SoundBeep();
  269. //
  270. // File Transfer Initiation
  271. //
  272. var vArgs = new Array(13);
  273. vArgs[0] = 1; // Destination Mode
  274. vArgs[1] = g_Helpee_oControlChannel; // Control Channel
  275. vArgs[2] = g_Helpee_oSAFRemoteDesktopChannelMgr; // Channel Manager
  276. vArgs[3] = RCCommand.getAttribute( c_szFileName ); // FILENAME
  277. vArgs[4] = RCCommand.getAttribute( c_szFileSize ); // FILESIZE
  278. vArgs[5] = RCCommand.getAttribute( c_szChannelId ); // CHANNELID
  279. vArgs[6] = new ActiveXObject("Scripting.FileSystemObject"); // File system object
  280. vArgs[7] = new ActiveXObject("SAFRCFileDlg.FileSave"); // Save As dialog object
  281. vArgs[8] = oSAFClassFactory; // SAF ClassFactory object
  282. vArgs[9] = parent.gHelper; // Sender
  283. // Logging DCR - Sending in a reference to the RAEventLog object
  284. //
  285. vArgs[10] = new ActiveXObject("RACplDlg.RAEventLog");
  286. vArgs[11] = parent.gHelperIP;
  287. vArgs[12] = g_szLocalUser;
  288. DebugTrace("Launching c_szFileXferURL...");
  289. var subWin = window.showModelessDialog( c_szFileXferURL, vArgs, "dialogwidth:" + c_FileXferWidth + "px;dialogHeight:" + c_FileXferHeight + "px;status:no;resizable:no;help:no");
  290. AddOpenSubWin( subWin );
  291. }
  292. else if ( szCommandName == c_szExpertIP )
  293. {
  294. // Grab the Expert IP Address and store it in a global variable
  295. parent.gHelperIP = RCCommand.getAttribute( c_szExpertIPDATA );
  296. }
  297. else if ( szCommandName == c_szRemoteCtrlStart )
  298. {
  299. DebugTrace("Calling SoundBeep");
  300. SoundBeep();
  301. //
  302. // Remote Control initiation
  303. //
  304. DebugTrace("Reading RA settings...");
  305. var oRARegSetting = new ActiveXObject("RACplDlg.RARegSetting");
  306. var bAllowFullControl = 0;
  307. if( false == parent.gIsURA )
  308. {
  309. bAllowFullControl = oRARegSetting.AllowFullControl;
  310. }
  311. else
  312. {
  313. bAllowFullControl = oRARegSetting.AllowUnSolicitedFullControl;
  314. }
  315. DebugTrace("bAllowFullControl: " + bAllowFullControl);
  316. if( 1 == bAllowFullControl )
  317. {
  318. DebugTrace("Expert is allowed to take control");
  319. var vArgs = new Array(1);
  320. vArgs[0] = parent.gHelperName; // Helper
  321. DebugTrace("Launching TakeControlMsgs.htm...");
  322. #ifdef _BVT
  323. var vRetVal = 0;
  324. if( true == parent.gBVT )
  325. {
  326. vRetVal = 0;
  327. }
  328. else
  329. {
  330. vRetVal = window.showModalDialog( "TakeControlMsgs.htm", vArgs, c_szTakeControlSpecs );
  331. }
  332. #else
  333. var vRetVal = window.showModalDialog( "TakeControlMsgs.htm", vArgs, c_szTakeControlSpecs );
  334. #endif
  335. DebugTrace("vRetVal: " + vRetVal);
  336. if( 0 == vRetVal)
  337. {
  338. DebugTrace("Novice accepted request for Remote control");
  339. //
  340. // Helpee accepts RC request
  341. //
  342. try
  343. {
  344. if(null == g_objPanic)
  345. {
  346. DebugTrace("Instantiating: " + szProgIDPanic );
  347. g_objPanic = new ActiveXObject( szProgIDPanic );
  348. }
  349. DebugTrace("Calling SetPanicHook");
  350. g_objPanic.SetPanicHook(Stop_Control);
  351. if(null != parent.oDeskMgr )
  352. {
  353. DebugTrace("Calling SwitchDesktopMode with argument=1");
  354. try
  355. {
  356. parent.oDeskMgr.SwitchDesktopMode( 1, nRAType );
  357. }
  358. catch(error)
  359. {
  360. parent.oDeskMgr.SwitchDesktopMode( 1 );
  361. }
  362. }
  363. else
  364. {
  365. if( null == g_oDeskMgr )
  366. {
  367. DebugTrace("g_oDeskMgr is null. Calling CreateObject_RemoteDesktopManager...");
  368. g_oDeskMgr = oSAFClassFactory.CreateObject_RemoteDesktopManager();
  369. }
  370. DebugTrace("Calling SwitchDesktopMode with argument=1");
  371. try
  372. {
  373. parent.oDeskMgr.SwitchDesktopMode( 1, nRAType );
  374. }
  375. catch(error)
  376. {
  377. parent.oDeskMgr.SwitchDesktopMode( 1 );
  378. }
  379. }
  380. #ifndef _HSSTOOLBAR
  381. frames.idFrameTools.idStopControl.disabled = false;
  382. frames.idFrameTools.RejectId.disabled = false;
  383. #else
  384. frames.idFrameTools.EnableButton( "idStopControl" );
  385. #endif
  386. g_bRC = true;
  387. Helpee_AcceptRC();
  388. frames.idFrameTools.UpdateStatus( L_INCONTROL_Text );
  389. var szMsg = L_TAKECONTROL1_Text + parent.gHelper + L_TAKECONTROL2_Text + g_szLocalUser + L_TAKECONTROL3_Text;
  390. frames.idFrameChatTop.PrintTakeControlMsg( szMsg );
  391. DebugTrace("Remote control obtained...");
  392. // Log to the event log (event 3)
  393. try
  394. {
  395. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  396. var args = new Array(2);
  397. args[0] = parent.gHelper;
  398. args[1] = g_szLocalUser;
  399. // Novice side
  400. oLogger.LogRemoteAssistanceEvent(0,3,args);
  401. }
  402. catch(e)
  403. {
  404. // do nothing
  405. }
  406. #ifdef _BVT
  407. if( true == parent.gBVT )
  408. {
  409. Helpee_SendControlCommand( c_szBVTPASS );
  410. }
  411. #endif
  412. }
  413. catch(error)
  414. {
  415. DebugTrace("Error: " + error.description + " Number: " + error.number);
  416. #ifdef _BVT
  417. if( true == parent.gBVT )
  418. {
  419. Helpee_SendControlCommand( c_szBVTFAIL );
  420. }
  421. #endif
  422. if(error.number == -2146828218)
  423. {
  424. //
  425. // send reject to helper. Access denied
  426. //
  427. DebugTrace("Calling Helpee_RejectRC with argument=2");
  428. Helpee_RejectRC( 2 );
  429. }
  430. else
  431. {
  432. Helpee_RejectRC( 3 );
  433. FatalError( L_ERRSWITCHDESKTOPMODE_Text, error);
  434. }
  435. }
  436. }
  437. else
  438. {
  439. DebugTrace("Novice rejected request for Remote control. Calling Helpee_RejectRC with argument=0");
  440. //
  441. // send reject to helper. Access denied
  442. //
  443. Helpee_RejectRC( 0 );
  444. #ifdef _BVT
  445. if( true == parent.gBVT )
  446. {
  447. Helpee_SendControlCommand( c_szBVTFAIL );
  448. }
  449. #endif
  450. }
  451. }
  452. else
  453. {
  454. DebugTrace("Expert is NOT allowed to take control. Calling Helpee_RejectRC with argument=2");
  455. //
  456. // Helpee rejects RC request
  457. //
  458. //
  459. // send reject to helper
  460. //
  461. Helpee_RejectRC( 2 );
  462. #ifdef _BVT
  463. if( true == parent.gBVT )
  464. {
  465. Helpee_SendControlCommand( c_szBVTFAIL );
  466. }
  467. #endif
  468. }
  469. }
  470. else if ( szCommandName == c_szRemoteCtrlEnd )
  471. {
  472. DebugTrace("Calling SoundBeep");
  473. SoundBeep();
  474. //
  475. // End of Remote Control
  476. //
  477. // Log event log (event 4)
  478. try
  479. {
  480. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  481. var args = new Array(2);
  482. args[0] = parent.gHelper;
  483. args[1] = g_szLocalUser;
  484. // novice
  485. oLogger.LogRemoteAssistanceEvent(0,4,args);
  486. }
  487. catch(e)
  488. {
  489. // do nothing
  490. }
  491. try
  492. {
  493. if(null != parent.oDeskMgr )
  494. {
  495. DebugTrace("Calling SwitchDesktopMode with argument=0");
  496. try
  497. {
  498. parent.oDeskMgr.SwitchDesktopMode( 0, nRAType );
  499. }
  500. catch(error)
  501. {
  502. parent.oDeskMgr.SwitchDesktopMode( 0 );
  503. }
  504. }
  505. else
  506. {
  507. if( null == g_oDeskMgr )
  508. {
  509. DebugTrace("g_oDeskMgr is null. Calling CreateObject_RemoteDesktopManager...");
  510. g_oDeskMgr = oSAFClassFactory.CreateObject_RemoteDesktopManager();
  511. }
  512. DebugTrace("Calling SwitchDesktopMode with argument=0");
  513. try
  514. {
  515. parent.oDeskMgr.SwitchDesktopMode( 0, nRAType );
  516. }
  517. catch(error)
  518. {
  519. parent.oDeskMgr.SwitchDesktopMode( 0 );
  520. }
  521. }
  522. frames.idFrameTools.UpdateStatus( L_SCREENVIEWONLY_Text );
  523. #ifndef _HSSTOOLBAR
  524. frames.idFrameTools.idStopControl.disabled = true;
  525. frames.idFrameTools.RejectId.disabled = true;
  526. #else
  527. frames.idFrameTools.DisableButton( "idStopControl" );
  528. #endif
  529. g_bRC = false;
  530. if (null != g_objPanic)
  531. {
  532. DebugTrace("Calling ClearPanicHook");
  533. g_objPanic.ClearPanicHook();
  534. }
  535. DebugTrace("Remote control is now closed");
  536. #ifdef _BVT
  537. Helpee_SendControlCommand( c_szBVTPASS );
  538. #endif
  539. }
  540. catch(error)
  541. {
  542. DebugTrace("Error: " + error.description + " Number: " + error.number);
  543. if(error.number != -2146828218)
  544. {
  545. FatalError( L_ERRSWITCHDESKTOPMODE_Text + error);
  546. }
  547. #ifdef _BVT
  548. if( true == parent.gBVT )
  549. {
  550. Helpee_SendControlCommand( c_szBVTFAIL );
  551. }
  552. #endif
  553. }
  554. }
  555. else if( szCommandName == c_szAbortRC)
  556. {
  557. var szMsg = L_ERRTAKECONTROL3_Text + parent.gHelper + L_ERRTAKECONTROL4_Text + parent.gHelper + L_ERRTAKECONTROL5_Text;
  558. DisplayMessage( szMsg );
  559. }
  560. else if ( szCommandName == c_szHIDECHAT )
  561. {
  562. //
  563. // Forcibly hide the Chat Box
  564. //
  565. g_bChatBoxHidden = false;
  566. frames.idFrameTools.Helpee_HideChat();
  567. }
  568. else if ( szCommandName == c_szSHOWCHAT )
  569. {
  570. //
  571. // Forcibly show the Chat Box
  572. //
  573. g_bChatBoxHidden = true;
  574. frames.idFrameTools.Helpee_HideChat();
  575. }
  576. // PreGo
  577. else if (szCommandName == c_szVoipPreGo)
  578. {
  579. DebugTrace("Calling SoundBeep");
  580. SoundBeep();
  581. if (false == g_bVoIPEnabled)
  582. return;
  583. try
  584. {
  585. // This message means that the Helpee(Server) has called Start(). So we need to call start
  586. // and send an ack back to the Helpee
  587. // Put up a Dialog to see if the helpee wants to 'GO VOICE!'
  588. var vArgs = new Array(1);
  589. vArgs[0] = L_VOIPSTART_Text; // Message
  590. var vRetVal = window.showModalDialog( c_szVOIPMsgURL, vArgs, c_szMsgSpecs );
  591. if( 0 == vRetVal)
  592. {
  593. //
  594. // Helper accepts Voice request
  595. //
  596. var szTemp = null;
  597. try
  598. {
  599. // call Listen() and save the key
  600. szTemp = g_Helpee_oSAFIntercomServer.Listen();
  601. // We succeeded so send a message to the Helpee/Server
  602. Helpee_TransmitVoipGo(c_szVoipVersion2, szTemp);
  603. }
  604. catch (e)
  605. {
  606. // Call Helpee_onVoiceDisabled() -
  607. //
  608. // Disabling voice in the case that Listen fails
  609. Helpee_onVoiceDisabled(); }
  610. }
  611. else
  612. {
  613. //
  614. // Helpee rejects Voice request
  615. //
  616. Helpee_SendControlCommand( c_szVoipQNo );
  617. // ungray the voice button
  618. #ifndef _HSSTOOLBAR
  619. frames.idFrameTools.btnVoice.disabled = false;
  620. frames.idFrameTools.txtVoice.disabled = false;
  621. #else
  622. frames.idFrameTools.EnableButton( "btnVoice" );
  623. #endif
  624. g_bStartEnabled = true;
  625. }
  626. }
  627. catch (error)
  628. {
  629. FatalError( L_RCCTL_Text, error );
  630. TraceFunctLeave();
  631. return;
  632. }
  633. }
  634. // QNo
  635. else if (szCommandName == c_szVoipQNo)
  636. {
  637. DebugTrace("Calling SoundBeep");
  638. SoundBeep();
  639. if (false == g_bVoIPEnabled)
  640. {
  641. TraceFunctLeave();
  642. return;
  643. }
  644. try
  645. {
  646. DisplayMessage( L_ERRVOIP1_Text );
  647. // ungray the voice button
  648. #ifndef _HSSTOOLBAR
  649. frames.idFrameTools.btnVoice.disabled = false;
  650. frames.idFrameTools.txtVoice.disabled = false;
  651. #else
  652. frames.idFrameTools.EnableButton( "btnVoice" );
  653. #endif
  654. g_bStartEnabled = true;
  655. }
  656. catch (e)
  657. {
  658. FatalError(L_RCCTL_Text, e );
  659. TraceFunctLeave();
  660. return;
  661. }
  662. }
  663. // GoNo
  664. else if (szCommandName == c_szVoipGoNo)
  665. {
  666. DebugTrace("Calling SoundBeep");
  667. SoundBeep();
  668. if (false == g_bVoIPEnabled)
  669. {
  670. TraceFunctLeave();
  671. return;
  672. }
  673. try
  674. {
  675. DisplayMessage( L_ERRVOIP1_Text );
  676. // ungray the voice button
  677. #ifndef _HSSTOOLBAR
  678. frames.idFrameTools.btnVoice.disabled = false;
  679. frames.idFrameTools.txtVoice.disabled = false;
  680. #else
  681. frames.idFrameTools.EnableButton( "btnVoice" );
  682. #endif
  683. g_bStartEnabled = true;
  684. }
  685. catch (e)
  686. {
  687. FatalError( L_RCCTL_Text, e );
  688. return;
  689. }
  690. }
  691. // GoFail
  692. else if (szCommandName == c_szVoipGoFail)
  693. {
  694. DebugTrace("Calling SoundBeep");
  695. SoundBeep();
  696. if (false == g_bVoIPEnabled)
  697. {
  698. TraceFunctLeave();
  699. return;
  700. }
  701. try
  702. {
  703. DisplayMessage( L_ERRVOIP1_Text );
  704. // ungray the voice button
  705. #ifndef _HSSTOOLBAR
  706. frames.idFrameTools.btnVoice.disabled = false;
  707. frames.idFrameTools.txtVoice.disabled = false;
  708. #else
  709. frames.idFrameTools.EnableButton( "btnVoice" );
  710. #endif
  711. g_bStartEnabled = true;
  712. }
  713. catch (e)
  714. {
  715. FatalError( L_RCCTL_Text, e );
  716. }
  717. }
  718. // PreGo2
  719. else if (szCommandName == c_szVoipPreGo2)
  720. {
  721. if (false == g_bVoIPEnabled)
  722. {
  723. TraceFunctLeave();
  724. return;
  725. }
  726. try
  727. {
  728. var szTemp = null;
  729. szTemp = g_Helpee_oSAFIntercomServer.Listen();
  730. Helpee_TransmitVoipGo(c_szVoipVersion2, szTemp);
  731. }
  732. catch (e)
  733. {
  734. // Call Helpee_onVoiceDisabled() -
  735. //
  736. // Disabling voice in the case that Listen fails
  737. Helpee_onVoiceDisabled();
  738. }
  739. }
  740. // PreStartYes
  741. else if (szCommandName == c_szVoipPreStartYes)
  742. {
  743. if (false == g_bVoIPEnabled)
  744. return;
  745. if (false == g_bVoipConnected)
  746. {
  747. // Start Voice and send a message to the Helpee(Server) so it also starts.
  748. //
  749. try
  750. {
  751. // Send a message to 1. Ask for Voip and 2. if yes, call Listen and continue
  752. Helpee_SendControlCommand ( c_szVoipPreGo );
  753. }
  754. catch (e)
  755. {
  756. FatalError( L_RCCTL_Text, e );
  757. TraceFunctLeave();
  758. return;
  759. }
  760. }
  761. else
  762. {
  763. //
  764. // This is the case where Voice is active. Stop it.
  765. // No message needs to be sent because the onVoiceDisconnected event will fire
  766. try
  767. {
  768. g_Helpee_oSAFIntercomServer.Disconnect();
  769. }
  770. catch (e)
  771. {
  772. // Ungray the voice button
  773. #ifndef _HSSTOOLBAR
  774. frames.idFrameTools.btnVoice.disabled = false;
  775. frames.idFrameTools.txtVoice.disabled = false;
  776. #else
  777. frames.idFrameTools.EnableButton( "btnVoice" );
  778. #endif
  779. // start accepting StartPending messages
  780. g_bStartEnabled = true;
  781. }
  782. }
  783. }
  784. // PreStartNo
  785. else if (szCommandName == c_szVoipPreStartNo)
  786. {
  787. if (false == g_bVoIPEnabled)
  788. {
  789. TraceFunctLeave();
  790. return;
  791. }
  792. // This means, that a connection transaction has already been established the opposite direction
  793. try
  794. {
  795. // Enable Start
  796. g_bStartEnabled = true;
  797. // Ungray the voice button
  798. #ifndef _HSSTOOLBAR
  799. frames.idFrameTools.btnVoice.disabled = false;
  800. frames.idFrameTools.txtVoice.disabled = false;
  801. #else
  802. frames.idFrameTools.EnableButton( "btnVoice" );
  803. #endif
  804. }
  805. catch (error)
  806. {
  807. FatalError( L_RCCTL_Text, error );
  808. TraceFunctLeave();
  809. return;
  810. }
  811. }
  812. // PreStart
  813. else if (szCommandName == c_szVoipPreStart)
  814. {
  815. if (false == g_bVoIPEnabled)
  816. return;
  817. try
  818. {
  819. // This message Starts the connection transaction
  820. // gray the voice button - so that we can't click on it also
  821. #ifndef _HSSTOOLBAR
  822. frames.idFrameTools.btnVoice.disabled = true;
  823. frames.idFrameTools.txtVoice.disabled = true;
  824. #else
  825. frames.idFrameTools.DisableButton( "btnVoice" );
  826. #endif
  827. if (false == g_bStartEnabled )
  828. {
  829. #ifndef _HSSTOOLBAR
  830. // ungray the voice button
  831. frames.idFrameTools.btnVoice.disabled = false;
  832. frames.idFrameTools.txtVoice.disabled = false;
  833. #else
  834. frames.idFrameTools.EnableButton( "btnVoice" );
  835. #endif
  836. // Start is not enables, send PreStartNo
  837. Helpee_SendControlCommand ( c_szVoipPreStartNo );
  838. }
  839. else
  840. {
  841. // it's ok - send PreStartYes
  842. Helpee_SendControlCommand ( c_szVoipPreStartYes );
  843. }
  844. }
  845. catch ( error )
  846. {
  847. FatalError( L_RCCTL_Text, error );
  848. TraceFunctLeave();
  849. return;
  850. }
  851. }
  852. // VoipDisable
  853. else if (szCommandName == c_szVoipDisable)
  854. {
  855. DebugTrace("Calling SoundBeep");
  856. SoundBeep();
  857. try
  858. {
  859. if (g_bVoIPEnabled == true)
  860. {
  861. DisplayMessage( L_ERRVOIP2_Text );
  862. // disable VoIP
  863. g_bVoIPEnabled = false;
  864. // set you to bad
  865. g_stateVoipYou = 2;
  866. // Gray the button
  867. #ifndef _HSSTOOLBAR
  868. frames.idFrameTools.btnVoice.disabled = true;
  869. frames.idFrameTools.txtVoice.disabled = true;
  870. #else
  871. frames.idFrameTools.DisableButton( "btnVoice" );
  872. #endif
  873. }
  874. }
  875. catch ( error )
  876. {
  877. FatalError( L_RCCTL_Text, error );
  878. TraceFunctLeave();
  879. return;
  880. }
  881. }
  882. // VoipWizardGood
  883. else if (szCommandName == c_szVoipWizardGood)
  884. {
  885. try
  886. {
  887. // set you to good
  888. g_stateVoipYou = 1;
  889. // check to see if we can enable voice
  890. if ( (g_stateVoipYou < 2) && (g_stateVoipMe < 2) )
  891. {
  892. // ungray voice button
  893. g_bVoIPEnabled = true;
  894. #ifndef _HSSTOOLBAR
  895. frames.idFrameTools.btnVoice.disabled = false;
  896. frames.idFrameTools.txtVoice.disabled = false;
  897. #else
  898. frames.idFrameTools.EnableButton( "btnVoice" );
  899. #endif
  900. }
  901. }
  902. catch (error)
  903. {
  904. FatalError( L_RCCTL_Text, error );
  905. TraceFunctLeave();
  906. return;
  907. }
  908. }
  909. // VoipWizardBad
  910. else if (szCommandName == c_szVoipWizardBad)
  911. {
  912. DebugTrace("Calling SoundBeep");
  913. SoundBeep();
  914. try
  915. {
  916. g_bVoIPEnabled = false;
  917. DisplayMessage( L_ERRVOIP2_Text );
  918. // set you to bad
  919. g_stateVoipYou = 2;
  920. // gray button
  921. #ifndef _HSSTOOLBAR
  922. frames.idFrameTools.btnVoice.disabled = true;
  923. frames.idFrameTools.txtVoice.disabled = true;
  924. #else
  925. frames.idFrameTools.DisableButton( "btnVoice" );
  926. #endif
  927. }
  928. catch (error)
  929. {
  930. FatalError( L_RCCTL_Text, error );
  931. TraceFunctLeave();
  932. return;
  933. }
  934. }
  935. else if ( szCommandName == c_szHelperVersion )
  936. {
  937. if( true == g_bVersionCheckEnforced )
  938. {
  939. //
  940. // VERSION Check
  941. //
  942. var szSchemaVersion = null;
  943. var szControlChannelVersion = null;
  944. try
  945. {
  946. szSchemaVersion = RCCommand.getAttribute( c_szSchema );
  947. if( szSchemaVersion != c_szSchemaVersion )
  948. {
  949. //
  950. // Schema Versions differ.
  951. //
  952. FatalError(L_ERRSCHEMAVERSION_Text);
  953. TraceFunctLeave();
  954. return;
  955. }
  956. }
  957. catch(error)
  958. {
  959. //
  960. // Our Helpee has an older version
  961. //
  962. FatalError(L_ERRSCHEMAVERSION_Text);
  963. TraceFunctLeave();
  964. return;
  965. }
  966. try
  967. {
  968. szControlChannelVersion = RCCommand.getAttribute( c_szControlChannel );
  969. if( szControlChannelVersion != c_szControlChannelVersion )
  970. {
  971. //
  972. // Control Channel Versions differ.
  973. //
  974. FatalError(L_ERRCHANNELVERSION_Text);
  975. TraceFunctLeave();
  976. return;
  977. }
  978. }
  979. catch(error)
  980. {
  981. //
  982. // Our Helpee has an older version
  983. //
  984. FatalError(L_ERRSCHEMAVERSION_Text);
  985. TraceFunctLeave();
  986. return;
  987. }
  988. }
  989. }
  990. // VoipBandwidthToHigh
  991. else if (szCommandName == c_szVoipBandwidthToHigh)
  992. {
  993. g_VoipBandwidth = 1;
  994. // Set the SamplingRate property
  995. g_Helpee_oSAFIntercomServer.SamplingRate = 2;
  996. }
  997. // VoipBandwidthToLow
  998. else if (szCommandName == c_szVoipBandwidthToLow)
  999. {
  1000. g_VoipBandwidth = 0;
  1001. // Set the SamplingRate property
  1002. g_Helpee_oSAFIntercomServer.SamplingRate = 1;
  1003. }
  1004. else if( szCommandName == c_szTYPINGSTART )
  1005. {
  1006. frames.idFrameTools.UpdateChatStatus( L_EXPERTTYPING_Text );
  1007. //frames.idFrameChatTop.SetFocus();
  1008. }
  1009. }
  1010. catch(error)
  1011. {
  1012. FatalError( L_ERRFATAL_Text, error );
  1013. #ifdef _BVT
  1014. if( true == parent.gBVT )
  1015. {
  1016. Helpee_SendControlCommand( c_szBVTFAIL );
  1017. }
  1018. #endif
  1019. }
  1020. TraceFunctLeave();
  1021. return;
  1022. }
  1023. //
  1024. // Helpee_SendControlCommand: Routine to send a control command across to the helper
  1025. //
  1026. function Helpee_SendControlCommand( szCommandName )
  1027. {
  1028. TraceFunctEnter("Helper_SendControlCommand");
  1029. var Doc = null;
  1030. var RCCommand = null;
  1031. try
  1032. {
  1033. //
  1034. // Create an XML document
  1035. //
  1036. Doc = new ActiveXObject("microsoft.XMLDOM");
  1037. //
  1038. // Create the RCCOMMAND root node
  1039. //
  1040. RCCommand = Doc.createElement( c_szRCCommand );
  1041. //
  1042. // Set the NAME attribute to szCommandName
  1043. //
  1044. RCCommand.setAttribute( c_szRCCommandName, szCommandName );
  1045. //
  1046. // Send control message to other end
  1047. //
  1048. g_Helpee_oControlChannel.SendChannelData( RCCommand.xml );
  1049. }
  1050. catch(error)
  1051. {
  1052. FatalError( L_RCCTL_Text, error );
  1053. }
  1054. TraceFunctLeave();
  1055. return;
  1056. }
  1057. //
  1058. // Helpee_TransmitVoipGo: Sends the Cryptographically Generated Key to the expert/client side
  1059. //
  1060. function Helpee_TransmitVoipGo(version, szTemp)
  1061. {
  1062. TraceFunctEnter("TransmitCryptKey");
  1063. var Doc = null;
  1064. var RCCommand = null;
  1065. var szVoipKey = null;
  1066. var szVoipIPList = null;
  1067. var i = 0;
  1068. try
  1069. {
  1070. // Parse out the key and the iplist
  1071. i = szTemp.indexOf(";")
  1072. if (i == -1)
  1073. {
  1074. // Somehow you are running an old version of the Intercom objects
  1075. // act like the old version of the script
  1076. szVoipKey = szTemp;
  1077. szVoipIPList = null;
  1078. }
  1079. else
  1080. {
  1081. // grab the Key part of the string
  1082. szVoipKey = szTemp.slice(0,i);
  1083. szVoipIPList = szTemp.slice(i+1);
  1084. }
  1085. //
  1086. // Create an XML document
  1087. //
  1088. Doc = new ActiveXObject("microsoft.XMLDOM");
  1089. //
  1090. // Create the RCCOMMAND root node
  1091. //
  1092. RCCommand = Doc.createElement( c_szRCCommand );
  1093. //
  1094. // Set the NAME attribute to VoipGo
  1095. //
  1096. RCCommand.setAttribute( c_szRCCommandName, c_szVoipGo );
  1097. //
  1098. // Set the VOIP Version
  1099. //
  1100. RCCommand.setAttribute( c_szVoipVer, version );
  1101. //
  1102. // Set the VOIPGOKEY Attribute
  1103. //
  1104. RCCommand.setAttribute( c_szVoipGoKey, szVoipKey );
  1105. //
  1106. // Set the c_szVoipIPList Attribute
  1107. //
  1108. RCCommand.setAttribute( c_szVoipIPList, szVoipIPList );
  1109. //
  1110. // Send the XML across
  1111. //
  1112. g_Helpee_oControlChannel.SendChannelData( RCCommand.xml );
  1113. }
  1114. catch (e)
  1115. {
  1116. FatalError( L_ERRFATAL_Text, e );
  1117. }
  1118. TraceFunctLeave();
  1119. return;
  1120. }
  1121. //
  1122. // Helpee_TransmitScreenInfo: Sends the user's screen resolution to the expert
  1123. //
  1124. function Helpee_TransmitScreenInfo()
  1125. {
  1126. TraceFunctEnter("TransmitScreenInfo");
  1127. var Doc = null;
  1128. var RCCommand = null;
  1129. try
  1130. {
  1131. //
  1132. // Create an XML document
  1133. //
  1134. Doc = new ActiveXObject("microsoft.XMLDOM");
  1135. //
  1136. // Create the RCCOMMAND root node
  1137. //
  1138. RCCommand = Doc.createElement( c_szRCCommand );
  1139. //
  1140. // Set the NAME attribute to SCREENINFO
  1141. //
  1142. RCCommand.setAttribute( c_szRCCommandName, c_szScreenInfo );
  1143. //
  1144. // Set the WIDTH attribute
  1145. //
  1146. RCCommand.setAttribute( c_szWidth, screen.width );
  1147. //
  1148. // Set the HEIGHT attribute
  1149. //
  1150. RCCommand.setAttribute( c_szHeight, screen.height );
  1151. //
  1152. // Set the COLORDEPTH attribute
  1153. //
  1154. RCCommand.setAttribute( c_szColorDepth, screen.colorDepth );
  1155. //
  1156. // Set the SCHEMAVERSION attribute
  1157. //
  1158. RCCommand.setAttribute( c_szSchema, c_szSchemaVersion );
  1159. //
  1160. // Set the CONTROLCHANNELVERSION attribute
  1161. //
  1162. RCCommand.setAttribute( c_szControlChannel, c_szControlChannelVersion );
  1163. //
  1164. // Send the XML across
  1165. //
  1166. g_Helpee_oControlChannel.SendChannelData( RCCommand.xml );
  1167. }
  1168. catch(error)
  1169. {
  1170. FatalError( L_ERRFATAL_Text, error );
  1171. }
  1172. TraceFunctLeave();
  1173. return;
  1174. }
  1175. function Stop_Control()
  1176. {
  1177. try
  1178. {
  1179. //
  1180. // Stop Control
  1181. //
  1182. // Log event log (event 4)
  1183. try
  1184. {
  1185. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  1186. var args = new Array(2);
  1187. args[0] = parent.gHelper;
  1188. args[1] = g_szLocalUser;
  1189. // novice
  1190. oLogger.LogRemoteAssistanceEvent(0,4,args);
  1191. }
  1192. catch(e)
  1193. {
  1194. // do nothing
  1195. }
  1196. Helpee_SendControlCommand( c_szEscRC );
  1197. try
  1198. {
  1199. try
  1200. {
  1201. parent.oDeskMgr.SwitchDesktopMode( 0, nRAType );
  1202. }
  1203. catch(error)
  1204. {
  1205. parent.oDeskMgr.SwitchDesktopMode( 0 );
  1206. }
  1207. frames.idFrameTools.UpdateStatus( L_SCREENVIEWONLY_Text );
  1208. }
  1209. catch(error)
  1210. {
  1211. Helpee_RejectRC( 3 );
  1212. FatalError( L_ERRSWITCHDESKTOPMODE_Text , error);
  1213. }
  1214. #ifndef _HSSTOOLBAR
  1215. frames.idFrameTools.idStopControl.disabled = true;
  1216. frames.idFrameTools.RejectId.disabled = true;
  1217. #else
  1218. frames.idFrameTools.DisableButton( "idStopControl" );
  1219. #endif
  1220. if (null != g_objPanic)
  1221. {
  1222. g_objPanic.ClearPanicHook();
  1223. }
  1224. //
  1225. // Tell User what he did !!
  1226. //
  1227. idCtx.minimized = false;
  1228. idCtx.bringToForeground();
  1229. var vArgs = new Array(1);
  1230. vArgs[0] = parent.gFrom + L_OR_Text + parent.gHelperName + L_ESCHIT_Text; // Message
  1231. var vRetVal = window.showModelessDialog( c_szMsgURL, vArgs, c_szMsgSpecs );
  1232. AddOpenSubWin( vRetVal );
  1233. }
  1234. catch(error)
  1235. {
  1236. Helpee_RejectRC( 3 );
  1237. FatalError( L_ERRFATAL_Text, error );
  1238. }
  1239. }
  1240. //
  1241. // Helpee_RejectRC: Sends a reject to the helper
  1242. //
  1243. function Helpee_RejectRC( mode )
  1244. {
  1245. TraceFunctEnter("Helpee_RejectRC");
  1246. try
  1247. {
  1248. if( false == g_bConnected )
  1249. {
  1250. //
  1251. // Not connected or Stop Control btn is disabled
  1252. //
  1253. TraceFunctLeave();
  1254. return;
  1255. }
  1256. switch (mode) {
  1257. case 0:
  1258. //
  1259. // Reject
  1260. //
  1261. Helpee_SendControlCommand( c_szRejectRC );
  1262. break;
  1263. case 1:
  1264. //
  1265. // Stop Control
  1266. //
  1267. // Log event log (event 4)
  1268. try
  1269. {
  1270. var oLogger = new ActiveXObject("RACplDlg.RAEventLog");
  1271. var args = new Array(2);
  1272. args[0] = parent.gHelper;
  1273. args[1] = g_szLocalUser;
  1274. // novice
  1275. oLogger.LogRemoteAssistanceEvent(0,4,args);
  1276. }
  1277. catch(e)
  1278. {
  1279. // do nothing
  1280. }
  1281. Helpee_SendControlCommand( c_szTakeControl );
  1282. try
  1283. {
  1284. try
  1285. {
  1286. parent.oDeskMgr.SwitchDesktopMode( 0, nRAType );
  1287. }
  1288. catch(error)
  1289. {
  1290. parent.oDeskMgr.SwitchDesktopMode( 0 );
  1291. }
  1292. frames.idFrameTools.UpdateStatus( L_SCREENVIEWONLY_Text );
  1293. }
  1294. catch(error)
  1295. {
  1296. FatalError( L_ERRSWITCHDESKTOPMODE_Text , error);
  1297. }
  1298. if (null != g_objPanic)
  1299. {
  1300. g_objPanic.ClearPanicHook();
  1301. }
  1302. break;
  1303. case 2:
  1304. //
  1305. // Policy denies Remote Control
  1306. //
  1307. Helpee_SendControlCommand( c_szDeniedRC );
  1308. var vArgs = new Array(1);
  1309. vArgs[0] = L_ERRRCPERMDENIED_Text; // Message
  1310. var vRetVal = window.showModelessDialog( c_szMsgURL, vArgs, c_szMsgSpecs );
  1311. AddOpenSubWin( vRetVal );
  1312. break;
  1313. case 3:
  1314. //
  1315. // Hit a Error Switching Desktop
  1316. //
  1317. Helpee_SendControlCommand( c_szErrorRC );
  1318. break;
  1319. }
  1320. #ifndef _HSSTOOLBAR
  1321. frames.idFrameTools.idStopControl.disabled = true;
  1322. frames.idFrameTools.RejectId.disabled = true;
  1323. #else
  1324. frames.idFrameTools.DisableButton( "idStopControl" );
  1325. #endif
  1326. }
  1327. catch(error)
  1328. {
  1329. FatalError( L_ERRFATAL_Text, error );
  1330. }
  1331. TraceFunctLeave();
  1332. return;
  1333. }
  1334. //
  1335. // Helpee_AcceptRC: Sends an accept to the helper
  1336. //
  1337. function Helpee_AcceptRC()
  1338. {
  1339. TraceFunctEnter("Helpee_AcceptRC");
  1340. try
  1341. {
  1342. Helpee_SendControlCommand( c_szAcceptRC );
  1343. }
  1344. catch(error)
  1345. {
  1346. FatalError( L_ERRFATAL_Text, error );
  1347. }
  1348. TraceFunctLeave();
  1349. return;
  1350. }
  1351. </SCRIPT>
  1352. <BODY id="idBody" name="idBody" onload='DoLoad();' bgcolor="LightGrey" scroll=no tabindex=-1>
  1353. </BODY>
  1354. </HTML>