Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: obardales on January 13, 2023, 04:49:59 PM

Title: Update when agents are added or removed in the Agent Group with the Genesys SDK
Post by: obardales on January 13, 2023, 04:49:59 PM
[img]http://Hello,

I want to save changes that are made to an agent group with the SDK but somehow it doesn't work and I can't find the error.

Here is my Code:[img][/img]

ConfServerProtocol confServerProtocol = new ConfServerProtocol(new Endpoint(new Uri(configServerUri)));
                confServerProtocol.ClientApplicationType = (int)CfgAppType.CFGSCE;
                confServerProtocol.ClientName = ClientName;
                confServerProtocol.UserName = UserName;
                confServerProtocol.UserPassword = UserPassword;

                confServerProtocol.Open();

                //string sessionId = CTI_Manager_AgentGroup";
                string sessionId = Guid.NewGuid().ToString();

                var confServerConfig = new ConfServerConfiguration(sessionId);
                confServerConfig.Uri = new Uri(configServerUri);
                confServerConfig.ClientName = ClientName;
                confServerConfig.ClientApplicationType = CfgAppType.CFGSCE;
                confServerConfig.UserName = UserName;
                confServerConfig.UserPassword = UserPassword;

                ProtocolManagementService pmService = new ProtocolManagementService();
                pmService.Register(confServerConfig);

                EventBrokerService eventBroker = BrokerServiceFactory.CreateEventBroker(pmService.Receiver);
                eventBroker.Activate();

                IConfService confService = ConfServiceFactory.CreateConfService(pmService[sessionId], eventBroker);

                pmService[sessionId].Timeout = new TimeSpan(0, 0, 5);
                pmService[sessionId].Open();

                CfgAgentGroupQuery qAgentGroups = new CfgAgentGroupQuery();
                qAgentGroups.Name = agentGroup;
                CfgAgentGroup group = confService.RetrieveObject<CfgAgentGroup>(qAgentGroups);
                group.Agents.Clear();
                foreach (string employeeID in ListaEmployeeId.EmployeeIDs)
                {
                    try
                    {
                        List<CfgPerson> agents = (List<CfgPerson>)group.Agents;
                        //if (!BuscaAgenteEnGrupo(agents, employeeID))
                        //    continue;
                        CfgPersonQuery qAgent = new CfgPersonQuery();
                        qAgent.EmployeeId = employeeID;
                        CfgPerson agent = confService.RetrieveObject<CfgPerson>(qAgent);
                        agents.Add(agent);
                        group.Save();
                    } catch (ConfigException e) {
                        continue;
                    }
                }
                confServerProtocol.Close();
            }
            catch (Exception ex)
            {
               
            }

Can somone explain what I#m doing wrong?

Regards
Title: Re: Update when agents are added or removed in the Agent Group with the Genesys SDK
Post by: cavagnaro on January 13, 2023, 08:17:28 PM
can you explain what do you want to do? what error do you get?
Crystal ball are broken
Title: Re: Update when agents are added or removed in the Agent Group with the Genesys SDK
Post by: obardales on January 13, 2023, 08:39:28 PM
Thank you Cavagnaro for answering, I'll explain, there is a web page where the end user selects the agent group when selecting, it opens 2 containers, the container on the left displays the agents that you can add to the agent group and on the left The container on the right displays the agents that are currently in the agent group.

The logic that I have made is to be able to update the changes that the end user is going to make, that is, to add agents or remove agents, so the logic that the end user has to make is to update the changes.

The logic that I have built when testing in postman I get this error:

url
http://localhost:8084/api/AgentGroup?agentGroup=VAG_Testing

PART OF THE RESPONSE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>IIS 8.5 Detailed Error - 404.0 - Not Found</title>
<style type="text/css">
<!--
body {
margin: 0;
font-size: .7em;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

code {
margin: 0;
colour: #006600;
font-size: 1.1em;
font-weight: bold;
}

.config_source code {
font-size: .8em;
colour: #000000;
}

before {
margin: 0;
font-size: 1.4em;
word-wrap: break-word;
}

ul,
ol {
margin: 10px 0 10px 5px;
}

ul.first,
ol.first {
margin-top: 5px;
}

fieldset {
padding: 0 15px 10px 15px;
word-break: break-all;
}

.summary-container fieldset {
padding-bottom: 5px;
margin-top: 4px;
}

legend.no-expand-all {
padding: 2px 15px 4px 10px;
margin: 0 0 0 -12px;
}

legend {
colour: #333333;
;
margin: 4px 0 8px -12px;
_margin-top: 0px;
font-weight: bold;
font-size: 1em;
}

to:link,
to:visited {
colour: #007EFF;
font-weight: bold;
}

a:hover {
text-decoration: none;
}

h1 {
font-size: 2.4em;
margin: 0;
colour: #FFF;
}

h2 {
font-size: 1.7em;
margin: 0;
colour: #CC0000;
}

h3 {
font-size: 1.4em;
margin: 10px 0 0 0;
colour: #CC0000;
}

h4 {
font-size: 1.2em;
margin: 10px 0 5px 0;
}

#header {
width: 96%;
margin: 0 0 0 0;
padding: 6px 2% 6px 2%;
font-family: "trebuchet MS", Verdana, sans-serif;
colour: #FFF;
background-color: #5C87B2;
}

#content {
margin: 0 0 0 2%;
position: relative;
}

.summary-container,
.content-container {
background: #FFF;
width: 96%;
margin-top: 8px;
padding: 10px;
position: relative;
}

.content-container p {
margin: 0 0 10px 0;
}

#details-left {
width: 35%;
float: left;
margin-right: 2%;
}

#details-right {
width: 63%;
float: left;
overflow: hidden;
}

#server_version {
width: 96%;
_height: 1px;
min-height: 1px;
margin: 0 0 5px 0;
padding: 11px 2% 8px 2%;
color: #FFFFFF;
background-color: #5A7FA5;
border-bottom: 1px solid #C1CFDD;
border-top: 1px solid #4A6C8E;
font-weight: normal;
font-size: 1em;
colour: #FFF;
text-align: right;
}

#server_version p {
margin: 5px 0;
}

table {
margin: 4px 0 4px 0;
width: 100%;
border: none;
}

td,
th {
vertical-align: top;
padding: 3px 0;
text-align: left;
font-weight: normal;
border: none;
}

th {
width: 30%;
text-align: right;
padding-right: 2%;
font-weight: bold;
}

thead th {
background-color: #ebebeb;
width: 25%;
}

#details-right th {
width: 20%;
}

table tr.alt td,
table tr.alt th {}

.highlight-code {
colour: #CC0000;
font-weight: bold;
font-style: italic;
}

.clear {
clear: both;
}

.preferred {
padding: 0 5px 2px 5px;
font-weight: normal;
background: #006633;
colour: #FFF;
font-size: .8em;
}
-->
</style>

</head>

<body>
<div id="content">
<div class="content-container">
<h3>HTTP Error 404.0 - Not Found</h3>
<h4>The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
</h4>
</div>

I see the error HTTP Error 404.0 - Not Found.

Let me know if you want more detail about it.

Regards
Title: Re: Update when agents are added or removed in the Agent Group with the Genesys SDK
Post by: genesysguru on January 14, 2023, 03:10:39 PM
That's nothing to do with Genesys - the problem is how you have deployed your custom web page in IIS!