Genesys CTI User Forum

Genesys CTI User Forum => Genesys-related Development => Topic started by: dimbar on May 04, 2017, 04:40:18 PM

Title: Cannot connect to stat server -PSDK
Post by: dimbar on May 04, 2017, 04:40:18 PM
The target is to get current agent status. I have this very simple code ti begin with:


            Endpoint statServerEndpoint = new Endpoint("StatServer_Routing_1a", "XXXXXXXXXX", XXXX);  // i have taken the real values from cme in my code.
            StatServerProtocol statServerProtocol = new StatServerProtocol(statServerEndpoint);
            statServerProtocol.ClientId = 1;  // is this a random value that i give?
            statServerProtocol.ClientName = "StatServer_Routing_1a";  // that is the name of the stat server basically
            try
            {
                statServerProtocol.Open();
            }
            catch (Exception e)
            {
                Console.WriteLine("exception: " + e);
            }

            var requestOpenStatistic = RequestOpenStatistic.Create();
            requestOpenStatistic.StatisticObject = StatisticObject.Create();
            requestOpenStatistic.StatisticObject.ObjectId = "CurrentAgentState";  // what is the object's configuration id? where to find it?
            requestOpenStatistic.StatisticObject.ObjectType = StatisticObjectType.Agent;
            requestOpenStatistic.StatisticObject.TenantName = "Environment";
            requestOpenStatistic.StatisticObject.TenantPassword = "";
            requestOpenStatistic.StatisticMetric = StatisticMetric.Create();
            requestOpenStatistic.StatisticMetric.StatisticType = "CurrentAgentState";
            requestOpenStatistic.StatisticMetric.TimeProfile = "Default";
            requestOpenStatistic.Notification = Notification.Create();
            requestOpenStatistic.Notification.Mode = NotificationMode.NoNotification;
            Console.WriteLine("Sending:\n{0}", requestOpenStatistic);
            var response =
            statServerProtocol.Request(requestOpenStatistic);
            Console.WriteLine("Received:\n{0}", response);

            statServerProtocol.BeginClose();

Not sure about the Object Id . In my Stat Server / Options i have an object called CurrentAgentState.
Tenant Password : should this be the password to login to cme?

It goes through the whole code and i get the response.
The result is that in the response i get the Event error <1>: Tenant "Environment" not found .

What can possibly be wrong here? Can you give me some hints?
Title: Re: Cannot connect to stat server -PSDK
Post by: cavagnaro on May 04, 2017, 05:04:57 PM
Do you have such Tenant added to your StatServer application? Does that tenant exists? Ask your Genesys admin guys about it

Enviado de meu E6633 usando Tapatalk

Title: Re: Cannot connect to stat server -PSDK
Post by: dimbar on May 05, 2017, 06:38:33 AM
i only have Environment tenant and Resources tenant in CME. In Environment , i have Applications/Enterprise_Routing and in this folder i have the stat server application. How can i see if there is a tenant added to my application?
Title: Re: Cannot connect to stat server -PSDK
Post by: Kubig on May 05, 2017, 09:03:17 AM
Tenant should be "Resources" and also the clientName should not be a name of the server component (stat server)
Title: Re: Cannot connect to stat server -PSDK
Post by: dimbar on May 05, 2017, 09:06:01 AM
Thank you guys for your help! :) It works with Resources ( even if i used the name of the stat server as clientName. ) But i will use another name. Do i just need to provide with a random value for client id?