function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
HoldcroftHoldcroft 

Salesforce CTI Adapter CTI Log Settings with CTI Toolkit 4.0

We have developed a Salesforce CTI Adapter using CTI Toolkit 3.0, based on the DemoAdapter.  Now we want to update it to use CTI Toolkit 4.0.

CTI Toolkit 3.0 stored the log file settings in the Windows registry, and this worked fine.  Now CTI Toolkit 4.0 uses the Microsoft Application Settings Architecture (see http://msdn.microsoft.com/en-us/library/8eyb2ct1%28v=VS.90%29.aspx), and also copies any changes to the Windows registry.  This works by means of the BrowserConnector maintaining the settings, and whenever the settings change, it sends a message to the CTIAdapterLib, which updates the Windows registry.  When it starts up, CTIAdapterLib initially uses the settings from the Windows registry.  This is OK in many cases, but gives a confusing problem on systems that have been upgraded from CTI Toolkit 3.0 and where non-default settings are in use, for example in the following scenario:

  1. An existing system uses CTI Toolkit 3.0 and has non-default settings A for logging in the Windows registry.
  2. The system is upgraded to use CTI Toolkit 4.0.  Settings A remain in the registry, and default settings B are created in the Application Settings.
  3. Initially CTIAdapterLib starts logging using settings A from the registry, but BrowserConnector is using settings B from the Application Settings.
  4. Then somebody right-clicks the taskbar icon to change the logging settings.  The user is confused, being presented with settings B from the Application Settings.
  5. The user changes the logging settings to new values C, and these are written to both the Application Settings and to thw Windows registry.  Normality is now restored, with all copies of the settings having the same values C.

Please can you suggest what changes to make in order to fix this problem?  I was thinking along the lines of changing CCTILogger::LoadLogInfoFromRegistry() so that it updates the Application Settings somehow.  This could perhaps be done directly, or better by sending a message to BrowserConnector.  Any ideas would be greatly appreciated.

Thanks,

James.

Best Answer chosen by Admin (Salesforce Developers) 
sfdcAnonsfdcAnon

Hi James,

 

This is a tricky problem to solve. It would be somewhat challenging to get the Application Settings from CCTILogger (not sure what is required for this).You might find it easier to inspect the registry settings from Logger.cs in the BrowserConnector C# prroject, compare them with the Applicaiton Settings and update accordingly.

 

I realize this would be messing around with the source code of the adapter.

All Answers

sfdcAnonsfdcAnon

Hi James,

 

This is a tricky problem to solve. It would be somewhat challenging to get the Application Settings from CCTILogger (not sure what is required for this).You might find it easier to inspect the registry settings from Logger.cs in the BrowserConnector C# prroject, compare them with the Applicaiton Settings and update accordingly.

 

I realize this would be messing around with the source code of the adapter.

This was selected as the best answer
HoldcroftHoldcroft

gvasudev,

 

Thanks very much for your help.  In the end, I modified Logger.cs to overrride the user settings with registry settings if any.  It seems to work fine.

 

James.

HoldcroftHoldcroft

For the benefit of others with this problem, here's the code I inserted at the end of LoadLogInfoFromAppConfig() in Logger.cs as a fix:

            /*
             * Overrride the user settings with registry settings if any.  This is required so
             * so that upgrades from before CTI Toolkit 4.0 retain the old settings.
             */
            RegistryKey baseRegistryKey = Registry.CurrentUser;

            // Opening the registry key
            RegistryKey rk = baseRegistryKey;
            // Open a subKey as read-only
            RegistryKey sk1 = rk.OpenSubKey("Software\\Salesforce.com\\CTI");

            // If the RegistrySubKey exists, then use its values in preference to the user settings
            if (sk1 != null)
            {
                try
                {
                    logLevel = (int)sk1.GetValue("LogLevel");
                }
                catch (Exception)
                {
                    // no action required - be happy with the user settings
                }

                try
                {
                    browserConnectorLogFileName = (string)sk1.GetValue("BrowserConnectorLogFile");
                }
                catch (Exception)
                {
                    // no action required - be happy with the user settings
                }

                try
                {
                    ctiConnectorLogFileName = (string)sk1.GetValue("CtiConnectorLogFile");
                }
                catch (Exception)
                {
                    // no action required - be happy with the user settings
                }
            }

 

James.