Genesys CTI User Forum
Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: MatSzafraniec on June 13, 2018, 12:21:19 PM
-
Hi,
I've created new section with one parameter in Environment -> Application -> application_folder.
[img width=640 height=370]http://i68.tinypic.com/107q7vm.png[/img]
Is there any way to read this value from Interaction Workspace application? Cannot find (or look for it badly) any reference in documentation.
Regards,
Matthew
-
Nope, you need to do something with PSDK to access it.
Enviado de meu E6633 usando o Tapatalk
-
[quote author=cavagnaro link=topic=11010.msg50028#msg50028 date=1528896420]
Nope, you need to do something with PSDK to access it.
Enviado de meu E6633 usando o Tapatalk
[/quote]
Ok, but where can I find any doc which explain how to achieve this?
-
Docs.genesyslab.com is one way, other is that similar questions have been asked here in the forum so you can search too
Enviado de meu E6633 usando o Tapatalk
-
Basically you need to use the PDSK to connect to the configuration layer (confserv or a proxy), read the application object and then iterate through the flexible and user attribute properties.
-
Platform SDK will be easiest way to move forward.
I had a code from a while back where we were using it to retrieve CME values. The version is old, but the concept should be pretty much the same.
-
Hi, I'm back :)
I can connect to ConfServer via PSDK, studied a lot of docs, but can't handle with problem described below.
I've created new object [i]1TestPFR[/i] in Business Attributes which contains two values. I want to read this.
[img width=640 height=260]http://i65.tinypic.com/2zs4gp5.png[/img]
I tried to read this by set filterKey object_dbid. If I right understand, this is value after object name (in red box on image below)
[img]http://i64.tinypic.com/2cmxg8k.png[/img]
[quote]
Platform.Commons.Collections.KeyValueCollection filterKey = new Platform.Commons.Collections.KeyValueCollection
{
{ "object_dbid", 1304 }
};
RequestReadObjects requestReadObjects =
RequestReadObjects.Create(
(int)CfgObjectType.CFGFolder,
filterKey);
[/quote]
But when I did it, ConfServer returns me list of all folders. My request works properly when I set key on name and search phrase f.e. "Business Attributes"
[quote]
Platform.Commons.Collections.KeyValueCollection filterKey = new Platform.Commons.Collections.KeyValueCollection
{
{ "name", "Business Attributes" }
};
RequestReadObjects requestReadObjects =
RequestReadObjects.Create(
(int)CfgObjectType.CFGFolder,
filterKey);
[/quote]
But how can I find values from [i]1TestPFR[/i]? Maybe I try to find unapropriate objectType? Unfortunately, any of available [url=http://docs.genesys.com/Documentation/PSDK/latest/ConfigLayerRef/ConfigLayerObjectsList]Layer objects[/url] not fit directly. Have you any idea, how to handle with this?
-
use CfgQuery instead of RequestReadObject
-
[quote author=Kubig link=topic=11010.msg50911#msg50911 date=1542195589]
use CfgQuery instead of RequestReadObject
[/quote]
Thank you for your respond.
Could you describe something more? I read [url=https://docs.genesys.com/Documentation/PSDK/9.0.x/Developer/UsingtheCOMAB#t-1]docs[/url], but can't find how initialize query and how to set filter on object which I want to find.
[quote]IProtocol protocol = confServerProtocol;
IConfService service = ConfServiceFactory.CreateConfService(protocol);
CfgQuery cfgQuery = new CfgQuery(service);[/quote]
-
Check ConfServer logs to get an idea on what kind of Query you need
Example
At CfgServer logs I see:
[code]
11:03:06.899 Trc 04541 Message MSGCFG_GETOBJECTINFO received from 1060 (InteractionWorkspace 'WDE')
MSGCFG_GETOBJECTINFO
attr: IATRCFG_REQUESTID value: 60
attr: BATRCFG_FILTER value:
attr: IATRCFG_OBJECTTYPE value: 35 [CfgEnumerator]
Filter :
key: name type: [String], value : Attach_WDE
key: tenant_dbid type: [Integer], value : 101
key: object_path type: [Integer], value : 0
key: read_folder_dbid type: [Integer], value : 0
Query : CfgBaseTenant[@DBID = 101]/enumerators/*[ (@name = 'Attach_WDE')][/code]
Meaning that WDE is looking for a[font=verdana] CfgEnumerator when looking for a Business Attribute, now change WDE for any app that consumes what you need.[/font]
Now at PSDK docs you search for CfgEnumerator type and available Queries:
[code]Namespaces ► Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.QueriesC#Visual BasicVisual C++[/code]
And then you do a simple query based on the object type:
[code]
CfgEnumeratorQuery q2 = new CfgEnumeratorQuery(confService);
q2.Name = "Attach_WDE";
CfgEnumerator qq2 = q2.ExecuteSingleResult();
CfgEnumeratorValueQuery qqq2 = new CfgEnumeratorValueQuery(confService);
qqq2.EnumeratorDbid = qq2.DBID;
var qqqq = qqq2.Execute();
[/code]
And you read the qqqq collection as you would do normally (for ...)
And done
-
Thank you, it works. I've share some code for anyone who will have that problem in future.
[quote]
[color=green]//Connect to ConfServer[/color]
ConfServerProtocol confServerProtocol =
new ConfServerProtocol(
new Endpoint(
"default",
"someIP",
somePortNumber));
confServerProtocol.UserName = "someUserName";
confServerProtocol.UserPassword = "somePassword";
IProtocol protocol = confServerProtocol;
protocol.Open();
[color=green]//Retrive object from ConfServer (I knew[/color] [b]ID[/b] [color=green]of it)[/color]
IConfService confService = ConfServiceFactory.CreateConfService(protocol);
ICfgObject cfgObject = confService.RetrieveObject([b]1304[/b], CfgObjectType.CFGEnumerator);
[color=green]//Get values from retrieved object[/color]
CfgEnumeratorValueQuery qqq2 = new CfgEnumeratorValueQuery(confService)
{
EnumeratorDbid = qq2.DBID
};
var qqqq = qqq2.Execute();
foreach(var g in qqqq)
{
Debug.WriteLine("**** " + g.Name);
Debug.WriteLine("**** " + g.ObjectPath);
}
protocol.Close();
[/quote]
-
if you are using Interaction Workspace application then the application already creating a connection to Configuration server or configuration proxy to get all its data you can use it like below instead of reopening new connection (consume more resources) and deal with the headache of managing connection disconnection issues.
In module initialization you can use:
readonly IConfigurationService configService;
public XXXXExtensionModule(IObjectContainer container, IViewManager viewManagerObject, IChannelManager channelManager, [b]IConfigurationService configService[/b], IAgent agentObject)
{
this.container = container;
[b]this.configService = configService;[/b]
this.channelManager = channelManager;
agent = agentObject;
viewManager = viewManagerObject;
wdeApp = configService.RetrieveObject<CfgApplication>(new CfgApplicationQuery() { Name = configService.ApplicationName });
this.log = container.Resolve<ILogger>().CreateChildLogger("Initialization");
staticLog = container.Resolve<ILogger>().CreateChildLogger("Initialization");
}
And here is one of my favorite functions that try to retrieve value from agent/agent group/application then tenant until it is found
//////////////////////////////////////////////////////
// Retrieve option from different configuration levels
public static string retrieveOption(string optionName, string section)
{
// Checking agent for the option
if (agent.ConfPerson.UserProperties.ContainsKey(section) && agent.ConfPerson.UserProperties.GetAsKeyValueCollection(section).ContainsKey(optionName))
return agent.ConfPerson.UserProperties.GetAsKeyValueCollection(section).GetAsString(optionName);
// Checking Agent groups for the option
for (int i = 0; agent.AgentGroupsForAgent.Count > i; i++)
{
if (agent.AgentGroupsForAgent[i].GroupInfo.UserProperties.ContainsKey(section) && agent.AgentGroupsForAgent[i].GroupInfo.UserProperties.GetAsKeyValueCollection(section).ContainsKey(optionName))
return agent.AgentGroupsForAgent[i].GroupInfo.UserProperties.GetAsKeyValueCollection(section).GetAsString(optionName);
}
// Checking WDE application for the option
if (wdeApp.Options.ContainsKey(section) && wdeApp.Options.GetAsKeyValueCollection(section).ContainsKey(optionName))
return wdeApp.Options.GetAsKeyValueCollection(section).GetAsString(optionName);
// Checking Tenant for the option
else if (agent.Tenant.UserProperties.ContainsKey(section) && agent.Tenant.UserProperties.GetAsKeyValueCollection(section).ContainsKey(optionName))
return agent.Tenant.UserProperties.GetAsKeyValueCollection(section).GetAsString(optionName);
else
return null;
}
}