Genesys CTI User Forum
Genesys CTI User Forum => Genesys-related Development => Topic started by: bublepaw on August 17, 2007, 03:44:59 PM
-
Hi Guys,
Some time ago ( 2 years or so ) I wrote configuration synchronizator for A4400 and Genesys. I found COM component called COMCfgManager. It allowed me to manipulate configuration objects ( create, delete, update ) in configuration database. As far as I know it is unsupported but it works as this is foundation for all wizards. Here is sample code to log in to CME. When I find the rest of this project I will post some more usefull demo
Dim y As COMCFGMGRLib.COMCfgManager
Set y = New COMCfgManager
y.Connect "GenesysCore01", "9020", CFGSCE, "default", "default", "password"
y.Disconnect
Set y = Nothing
One more thing this api is very memory consuming under .NET
PS.
In Platform SDK there is separate class for communicating directly with OCS. Also on gendev there is sample how to use it to build web base OCM.
-
Hi bublepaw,
I am trying to make a function to change password in CME using ActiveX app - because our project deployment does not allow installing CME to every agent just for changing password only.
Is this possible using COMCfgManager? If you have a sample code pls post it here.
Many thanks in advance
-
I don't think you can actually pro-actively change something using ActiveX in CME. At least I did not know you could, because I was under the impression it was a read-only component.
If you figure out how to do it, can you please share it with the rest of us?
Best regards,
Vic
-
Hi,
I didn't find old code but luckily I've managed to recreate some simple operations. First of all program is based on "COMCfgMgr 1.4.1 Type Library" which is instaled with wizards ( by default in \Program Files\Common Files\GCTI\CFG Wizards y.x ).
All samples are C# because I don't have VB6 installed but it should be fairly easy to convert them to VB
1) Changing password
[code]
{
COMCFGMGRLib.COMCfgManagerClass server = new COMCFGMGRLib.COMCfgManagerClass();
server.Connect("server", "port", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "user", "password");
// this line is need if You don't want to use standard genesys window for changing password
server.UseGUIElements = 0;
server.ChangePassword("old password", "new password");
server.Disconnect();
}
[/code]
2) Finding some object
[code]
{ COMCFGMGRLib.COMCfgManagerClass server = new COMCFGMGRLib.COMCfgManagerClass();
server.Connect("server", "port", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "user", "password");
COMCFGMGRLib.ICfgQuery query = server.CreateQuery();
// what we want to find
query.ObjectType = COMCFGMGRLib.enum_COMCfgObjectType.COMCFGApplication;
// some filters to narrow search
object value;
// we will be searching for all OCS servers
value = ( object )COMCFGMGRLib._CfgAppType.CFGCMServer;
query.AddFilterValue(COMCFGMGRLib._CfgFilterType.FILTER_APP_TYPE , ref value);
// 1,0 - wait for query to finish for infinity
query.Execute(1, 0);
if (query.Count > 0) {
// we found something
// result is 1 based array
for (int i = 1; i <= query.Count ;i++) {
COMCFGMGRLib.ICfgObject foundObject = (COMCFGMGRLib.ICfgObject)query[i];
Console.WriteLine(" Object :{0} dbid = {1} ", foundObject.Name, foundObject.DBID);
}
}
server.Disconnect();
}
[/code]
I will post soon some other samples for changing data.
Victor - as for changing object - this api is internaly used by all wizards so it must be able to change data in configserver :)
Paul
-
Hi bublepaw,
Thanks for your sample code. I will try the ChangePassword() method. Looking at the class method, there seems to be no return value to check if the change password is successful or not.. but still a very good solution for web based CTI app. Great code!
Regards,
-
Hi dbudi,
When there is an error during password change method will throw exception. In C# in is enough to put ChangePassword inside try/catch block. In VB "On Error ..." statement should work
Paul
-
Hi all,
Here are some more examples to mess with configuration server.
1) adding new object
[code]
{
COMCFGMGRLib.COMCfgManagerClass server = new COMCFGMGRLib.COMCfgManagerClass();
server.Connect("server", "port", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "default", "password");
// here we create new empty DN object
COMCFGMGRLib.ICfgObject newDN = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.COMCFGDN);
// object name
newDN[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_number] = "112345";
// switchDBID contains id of switch in which we create object - can be found using previous sample
newDN[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_switchDBID] = 101;
newDN[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_switchSpecificType] = 1;
// new DN is extension
newDN[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_type] = 1;
// filed Register is set to true
newDN[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_registerAll] = 2;
// route type is set to default
newDN[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_routeType] = 1;
// we send update request to configuration server
newDN.Create(server);
server.Disconnect();
}
[/code]
2) modifying and deleting object - before we can update or modify object we have to acquire ICfgObject interface for our instance - this can be done by using query
[code]
{
COMCFGMGRLib.COMCfgManagerClass server = new COMCFGMGRLib.COMCfgManagerClass();
server.Connect("server", "port", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "default", "password");
// first lets find object to modify/delete
COMCFGMGRLib.ICfgQuery query = server.CreateQuery();
query.ObjectType = COMCFGMGRLib.enum_COMCfgObjectType.COMCFGDN;
object value;
object value2;
// DN number
value = "112345";
query.AddFilterValue(COMCFGMGRLib._CfgFilterType.FILTER_DN_NUMBER, ref value);
// switch to which object belongs
value2 = 101;
query.AddFilterValue(COMCFGMGRLib._CfgFilterType.FILTER_SWITCH_DBID, ref value2);
// 1,0 - wait for query to finish for infinity
query.Execute(1, 0);
if ( query.Count > 0 ) {
// we found our object
// lets modify it
COMCFGMGRLib.ICfgObject objectToChange = (COMCFGMGRLib.ICfgObject)query[1];
// change fileds values
// here we change alias field
objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_name] = "New_alias";
// send update to server
objectToChange.Update();
// we no longer need this object so lets delete it
objectToChange.Erase();
}
server.Disconnect();
}
[/code]
-
bubblepaw,
:o :o :o :o :o :o :o :o :o :o
Nice!!! This will save us hundreds of hours adding and deleting new DNs. Damn, why didn't I think of it. Of course, if Wizards can do it, there must be an interface out there somewhere... I am very uneasy about having people touch configuration manager, because it creates a potential for total havoc. (imagine a disgruntled employee with a supervisor or admin access!)
This is ingenious!!!
Let me prepare a tool that would easily add DNs to config server - a proof of concept if you will!
So, I see we can add DNs... How about modifying existing one?
Best regards,
Vic
-
Victor,
Code for modifying DN's is in second example. The only problem is that not all fields can be modified - for example if You want to change number or type of DN You have to first delete it and then create it with new number or new type. There is also some more work if You want to create folders and put newly created objects in those folder or You want to create link to object like in places but I will try to cover this topic in next tutorial :).
Also when writing those samples I found that in version 7.5 there is new method for update that takes xml as parameter - I will check if this is the same xml as one generated by configuration export wizard - if so it would be much simpler to write tool for modifying dn's
BR
Paul
-
Hi, bubblepaw,
I have been looking at this for the last few days, and it seems like there is a lot of possibilities there (Active X 7.0)
I cannot find a way to create new section for application object or add some keyword:value inside that section.
I was thinking about using it to modifying someof the options for Genesys applications...
As for 7.5 - what are you using?
-
I tried it and it works, but somehow I cannot figure out how to add skill to a person.
[code] COMCFGMGRLib.COMCfgManagerClass server = new
COMCFGMGRLib.COMCfgManagerClass();
server.Connect(ServerName.Text, ServerPort.Text,
COMCFGMGRLib._CfgAppType.CFGSCE, AppName.Text, UserId.Text, UserPaswd.Text);
// here we create new empty DN object
COMCFGMGRLib.ICfgObject newSkill =
server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.CFGLINKSkillLevel);
// object name
newSkill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel] =
128;
newSkill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_level]
= 2;
newSkill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_skillDBID]
= 122;
newSkill.Create(server);
server.Disconnect();
[/code]
and in config server, it seems like it is retrieving some info from config server and ...does nothing...
Any pointers?
-
Hi Victor,
Here is sample code to modify application options. You need to add additional activex objects from ComKVList 1.0 Type Library
[code]
{
COMCFGMGRLib.COMCfgManagerClass server = new COMCFGMGRLib.COMCfgManagerClass();
server.Connect("server", "port", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "default", "password");
// first lets find object to modify/delete
COMCFGMGRLib.ICfgQuery query = server.CreateQuery();
query.ObjectType = COMCFGMGRLib.enum_COMCfgObjectType.COMCFGApplication;
object value;
// application name
value = "DEV_MS_PRI";
query.AddFilterValue(COMCFGMGRLib._CfgFilterType.FILTER_NAME, ref value);
// 1,0 - wait for query to finish for infinity
query.Execute(1, 0);
if ( query.Count > 0 ) {
// we found our object
// lets modify it
COMCFGMGRLib.ICfgObject objectToChange = (COMCFGMGRLib.ICfgObject)query[1];
// change fileds values
COMKVLISTLib.IKVList sections = ( COMKVLISTLib.IKVList )objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgApplication_options];
for ( int i = 1; i <= sections.Count; i++ ) {
Console.WriteLine("Section : {0}", sections.get_Pair(i).Key);
COMKVLISTLib.IKVList options = ( COMKVLISTLib.IKVList )sections.get_Pair(i).Value;
for ( int j = 1; j <= options.Count; j++ ) {
Console.WriteLine(" key({0}) = {1}", options.get_Pair(j).Key, options.get_Pair(j).Value);
}
if ( sections.get_Pair(i).Key == "log" ) {
// lets add some options
options.AddValue("debug", "stderr");
// lets modify some
COMKVLISTLib.IKVPair option = options.FindPair("verbose");
if ( option != null ) {
option.Value = "debug";
}
// lets delete some
options.RemovePairByKey("all");
}
}
// update all sections/options
objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgApplication_options] = sections;
// send update to server
objectToChange.Update();
}
server.Disconnect();
}
[/code]
BR
Paul
-
Hi,
Next samples covers adding skill to agent object
[code]
{
COMCFGMGRLib.COMCfgManagerClass server = new COMCFGMGRLib.COMCfgManagerClass();
server.Connect("server", "port", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "default", "password");
// first lets find agent to modify skills
COMCFGMGRLib.ICfgQuery query = server.CreateQuery();
query.ObjectType = COMCFGMGRLib.enum_COMCfgObjectType.COMCFGPerson;
object value;
// person username
value = "agent1";
query.AddFilterValue(COMCFGMGRLib._CfgFilterType.FILTER_USER_NAME, ref value);
// 1,0 - wait for query to finish for infinity
query.Execute(1, 0);
if ( query.Count > 0 ) {
// we found our person
// lets modify it
COMCFGMGRLib.ICfgObject objectToChange = (COMCFGMGRLib.ICfgObject)query[1];
// list of skills
COMCFGMGRLib.ICfgFolder skills = ( COMCFGMGRLib.ICfgFolder )objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_skillLevels];
// lets create skill assigment object
COMCFGMGRLib.ICfgObject skill = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.CFGLINKSkillLevel);
// skill level
skill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_level] = 6;
// skill id retrived with another query
skill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_skillDBID] = 101;
skill.Create(server);
skills.Add(skill);
// very important line :) - we need to assign modified list of skills
objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_skillLevels] = skills;
// send update to server
objectToChange.Update();
}
server.Disconnect();
}
}
[/code]
BR
Paul
PS
Victor mayby we can move our converstation to separate topic called "Configuration modification" ?
-
Paul,
ok, you are a freaking genuis!!!! I am looking throught the code and I am wondering: how the hell did you figure you need ( (COMCFGMGRLib.ICfgFolder ) ? Did some Russian programmer visited you in your sleep and told you about it?
Best regards,
Vic
-
Hi Victor,
Although Russia is very close to Poland where I live Russian programers didn't visit me :) - actually I spent a lot of time with VB6 - it shows object types and in the same time I was looking and logs from confserv to see what is happening when some actions are done from CME or from my program. The worst part was to find out that You need to assign already modified collection back to is property.
Component as solution to modifying configuration was shown by one of our Genesys partner in Poland - normaly I was trying to use ActiveX that comes with toolkit - so I'am not that geneuis
Br
Paul
-
Hi Paul,
Your contribution is very useful for us here. Thanks for sharing your knowledge here in this forum.
I am sure it will benefit many of us programming some app to use with Genesys.
Victor is right, you are genius :)
dbudi
-
Hi all,
I definitely don't want to decrease genius of Paul but described way of configuration's modification is very discussable from legal perspective. If you check license agreement between Genesys and Customer or Genesys and Partner (VAR) you find that such usage of provided software is not allowed by the license. So be very careful and check with your legal department twice before using that solution...
René
-
René,
I think I have to side with you. I am not sure if this is ok or not, but I would err on a side of caution and would think twice about using it inside a full-blown project. It is interesting though :P
-
Hi guys,
Do you know anyway i can get the Action Codes folder content directly from ActiveX without connecting to the DB of Genesys?
-
Nobody? Any other options maybe?
-
Hi guys
Thank you for your sample. Now I can create DN,Add Skill, Add DN Group
but I cannot create section on each DN and add key value on section. I ever
use this function
COMKVLISTLib.IKVList sections = (COMKVLISTLib.IKVList) objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgApplication_options];
for create section or key value on Apllication. But for DN I have no idea about it. Please teach me about this. ???
Best regrads,
Jiggolo
-
Hi Guys
I found solution for create new section and option value on DN object ("Annex Option"). For this code I load section data and option value from dataset then add this section into DN object.
[code] MATool.ConnectToServer(server);
COMCFGMGRLib.ICfgQuery query = server.CreateQuery();
query.ObjectType = COMCFGMGRLib.enum_COMCfgObjectType.COMCFGDN;
object value;
value = txtDN.Text.Trim();
query.AddFilterValue(_CfgFilterType.FILTER_DN_NUMBER, ref value);
query.Execute(1, 0);
if (query.Count > 0)
{
ICfgObject objectToChange = (COMCFGMGRLib.ICfgObject)query[1];
COMKVLISTLib.IKVList sections = (COMKVLISTLib.IKVList)objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_userProperties];
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
COMKVLISTLib.IKVPair p = sections.CreatePair(TKVType.KVTypeList);
p.Key = ds.Tables[0].Rows[i].ItemArray[1].ToString();
DataView dv = new DataView();
dv = ds.Tables[1].DefaultView;
dv.RowFilter = "secId='" + ds.Tables[0].Rows[i].ItemArray[0].ToString() + "'";
if (dv.Count > 0)
{
for (int k = 0; k < dv.Count; k++)
{
object pvalue;
pvalue = dv[k][2];
p.ListValue.AddValue(dv[k][1].ToString(), pvalue);
}
}
sections.AddPair(p);
}
objectToChange[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgDN_userProperties] = sections;
objectToChange.Update();
}
server.Disconnect();[/code]
If you have any suggestion. Please tell me.
Thank you.
-
After I developed many solution on CME active X I found a problem about folder creating. I cannot create any folder under parent folder . Please suggest me. :o
-
Anyone successfully get a Add Person/Agent process going? I can add a person but I am stuck on addking skills and login ID's to them. Any help would be great.
[code]
Dim server As New COMCFGMGRLib.COMCfgManager
server.Connect("MyHost", "2020", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "default", "password")
'Create Person
Dim NewEmp As COMCFGMGRLib.ICfgObject = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.COMCFGPerson)
NewEmp(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_firstName) = "Test"
NewEmp(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_lastName) = "User"
NewEmp(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_employeeID) = "1234"
NewEmp(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_userName) = "4321"
NewEmp(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_password) = "123456789"
'Define Agent Skills
Dim agSkills As COMCFGMGRLib.ICfgObject = server.CreateObject(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_skillLevels)
Dim Skill As COMCFGMGRLib.ICfgObject = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.CFGLINKSkillLevel)
Skill(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_level) = 2
Skill(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_skillDBID) = 133
Skill.Create(server)
agSkills.
'Add Skills to agent
NewEmp(COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_skillLevels) = agSkills
NewEmp.Create(server)
server.Disconnect()
MsgBox("User Added!")
[/code]
-
Ok I made it further. I can now add a agent as long as I know the DBID of the LoginID I am assiging to them. I have to figure out how to get that information now and this will be complete.
//Connect to Config Server
COMCFGMGRLib.COMCfgManager server = new COMCFGMGRLib.COMCfgManager();
server.Connect("myserver", "8888", COMCFGMGRLib._CfgAppType.CFGSCE, "default", "default", "password");
//Create New Person/Agent
COMCFGMGRLib.ICfgObject Emp = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.COMCFGPerson);
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_firstName] = "Test";
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_lastName] = "Test";
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_userName] = "1234";
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_employeeID] = "4321";
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_password] = "0123456789";
//Create Skill to Assign
COMCFGMGRLib.ICfgObject skill = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.CFGLINKSkillLevel);
skill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_level] = 2;
skill[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgSkillLevel_skillDBID] = 133;
skill.Create(server);
//Create Skills Object
COMCFGMGRLib.ICfgFolder agSkills = (COMCFGMGRLib.ICfgFolder)Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_skillLevels];
agSkills.Add(skill);
//Attach Skills to Person
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_skillLevels] = agSkills;
//Create LoginID to assign
COMCFGMGRLib.ICfgObject LoginID = server.CreateObject(COMCFGMGRLib.enum_COMCfgObjectType.CFGLINKAgentLoginInfo);
LoginID[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgAgentLogin_DBID] = 104;
LoginID.Create(server);
//Create LoginIDs Object
COMCFGMGRLib.ICfgFolder agLoginIDs = (COMCFGMGRLib.ICfgFolder)Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_agentLogins];
agLoginIDs.Add(LoginID);
//Attach LoginIDs to Person
Emp[COMCFGMGRLib.enum_CFG_PropertyID.PID_CfgPerson_agentInfo_agentLogins] = agLoginIDs;
//Add New Person
Emp.Create(server);
//Disconnect from ConfigServer
server.Disconnect();
MessageBox.Show("Employee Created!");