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.
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.
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?
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
Changing password
{
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();
}
Finding some object
{ 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();
}
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
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!
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
Here are some more examples to mess with configuration server.
adding new object
{
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();
}
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
{
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();
}
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?
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
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…
{
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();
}
}
BR
Paul
PS
Victor mayby we can move our converstation to separate topic called “Configuration modification” ?
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?
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
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
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…
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