Genesys CTI User Forum > Genesys-related Development
Problems connecting to Statserver usind java SDK
arecher:
Hi,
I have another questions. I've asked the Genesys´s Administratior regarding this problem and he said the connection with Stat Server<-> application is dropping because I have to autenticate it (with login/password) before connecting to Stat Server. According the adminitrator, I have to connect with Configuration Server with a login/password and after this, request the statistics with the Stat Server.
So, is it possible to do this? Do you know if Configuration Server has any specific function to enable requests to Stat Server. The main ideia is to enable application requests via Configuration Server to Stat Server.
If it´s possible, do you know if I have to use this function: ConfServiceFactory.CreateConfService()?
Here is the code that I´m using:
package pack;
import java.net.URISyntaxException;
import com.genesyslab.platform.commons.protocol.Endpoint;
import com.genesyslab.platform.commons.protocol.ProtocolException;
import com.genesyslab.platform.commons.protocol.RegistrationException;
import com.genesyslab.platform.configuration.protocol.ConfServerProtocol;
import com.genesyslab.platform.configuration.protocol.types.CfgAppType;
import com.genesyslab.platform.reporting.protocol.StatServerProtocol;
import com.genesyslab.platform.reporting.protocol.statserver.Notification;
import com.genesyslab.platform.reporting.protocol.statserver.NotificationMode;
import com.genesyslab.platform.reporting.protocol.statserver.StatisticMetric;
import com.genesyslab.platform.reporting.protocol.statserver.StatisticObject;
import com.genesyslab.platform.reporting.protocol.statserver.StatisticObjectType;
import com.genesyslab.platform.reporting.protocol.statserver.requests.RequestCloseStatistic;
import com.genesyslab.platform.reporting.protocol.statserver.requests.RequestOpenStatistic;
public class StatSample {
/**
* @param args
* @throws InterruptedException
* @throws IllegalStateException
* @throws ProtocolException
* @throws RegistrationException
* @throws URISyntaxException
*/
public static void main(String[] args) throws RegistrationException, ProtocolException, IllegalStateException, InterruptedException, URISyntaxException {
Endpoint cfgServerEndpoint = new Endpoint("cfg_proxy", "XX.XX.XX.XX", 2020);
ConfServerProtocol protocol = new ConfServerProtocol(cfgServerEndpoint);
protocol.setClientName("cfg_proxy");
protocol.setClientApplicationType(CfgAppType.CFGSCE.asInteger());
protocol.setUserName("XXX");
protocol.setUserPassword("XXX");
protocol.open();
StatServerProtocol statServerProtocol = new StatServerProtocol(new Endpoint("statserver_lab", "SCTTXXX", 3100));
statServerProtocol.setClientName("StatApp");
statServerProtocol.setClientId(1);
statServerProtocol.open();
RequestOpenStatistic req = RequestOpenStatistic.create();
StatisticObject object = StatisticObject.create();
object.setObjectId("Analyst001");
object.setObjectType(StatisticObjectType.Agent);
object.setTenantName("Resources");
object.setTenantPassword("");
StatisticMetric metric = StatisticMetric.create();
metric.setStatisticType("TotalLoginTime");
Notification notification = Notification.create();
notification.setMode(NotificationMode.Periodical);
notification.setFrequency(5);
req.setStatisticObject(object);
req.setStatisticMetric(metric);
req.setNotification(notification);
req.setReferenceId(2);
System.out.println(statServerProtocol.request(req));
for (int i=0; i < 4; ++i) {
System.out.println(statServerProtocol.receive(-1));
}
System.out.println(statServerProtocol.request(RequestCloseStatistic.create(2)));
statServerProtocol.close();
protocol.close();
}
}
cavagnaro:
Not true, you can connect directly to the SS without any authentication.
arecher:
But the Administrator is saying to me that the SS is configured to respond requests only if I first autenticate in configuration server. Do you know if is it true?
Kubig:
No login/passwd authorization is not necessary, but the clientname use within the code must exists within Genesys configuration
arecher:
Ok, thanks for quick answer.
Navigation
[0] Message Index
[*] Previous page
Go to full version