Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: Tobe on March 06, 2017, 09:25:33 AM

Title: SolutionControlServerProtocol Open connection with C#
Post by: Tobe on March 06, 2017, 09:25:33 AM
HI,

I'm new to genesys and have struggles with SolutionControlServerProtocol. So far i wasn't able to find anything except for this: [url=http://www.sggu.com/smf/index.php?topic=2698]http://www.sggu.com/smf/index.php?topic=2698[/url]

My Goal:
So my goal is to connect to Solution Control Server and get a few informations like; what is the current "Status", which "Mode" is it running, etc.

What I have:
So far i have tried a few different things, the most successful two are the following:
Best solution (so far):
                string server = "tco://sisccpxxxx01:9201";
                TimeSpan timeout = new TimeSpan(0, 0, 0, 0, 3000);
                SolutionControlServerProtocol scsp = new SolutionControlServerProtocol(new Endpoint(new Uri(server)));
                scsp.ClientName = "SomeName_Main";
                scsp.ClientType = Genesyslab.Platform.Management.Protocols.SolutionControlServer.ControlObjectType.Solution;
                scsp.Open(timeout);

I get the following error:
                Genesyslab.Platform.Commons.Protocols.ProtocolException: Exception occured duing channel opening ---> System.Net.Sockets.Socket.Exception: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte 10.238.xxx.xxx:9201  TRANSLATET (There is no connection because the target computer refused the connection).
I'm guessing the problem is that I don't give a id (scsp.ClientId), sadly I don't now what the id is and where i get it from. Can you help me out?

2nd solution (Like post I linked):
                TimeSpan timeout = new TimeSpan(0, 0, 0, 0, 3000);
                Endpoint endpoint = new Endpoint(name, host, port);
                SolutionControlServerProtocol scsp = new SolutionControlServerProtocol(endpoint);
                scsp.Open(timeout);

I get the following error:
                Genesyslab.Platform.Commons.Protocols.ProtocolException: Exception occured duing channel opening ---> System.Net.Sockets.Socket.Exception: Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte 10.238.xxx.xxx:9201  TRANSLATET (There is no connection because the target computer refused the connection).
Same error as above.

What am I missing? Thank you for any help!

Version: 8.1.1.1211.00

Regards
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: PeteHoyle on March 06, 2017, 02:31:42 PM
One possible reason could be that you have a spelling mistake on your server string..

[code]string server = "tco://sisccpxxxx01:9201";[/code]

It should be 'tcp://' not 'tco://'.

Other things it could be:
Is the SCS Port opened on your firewall.
Can the host name be resolved to an IP Address?
Do you have the correct port number?

For me this code works:

            [code]try
            {
                string server = "tcp://demosrv:7003";
                SolutionControlServerProtocol protocol = new SolutionControlServerProtocol(new Endpoint(new Uri(server)));
                protocol.Open();
                RequestGetApplicationInfo req = RequestGetApplicationInfo.Create();
                req.ControlObjectId = 117;
                IMessage res = protocol.Request(req);
                if(res is EventInfo)
                {
                    EventInfo info = res as EventInfo;
                    Console.WriteLine("Status: " + info.ControlStatus);//6 = Running
                }
                Console.WriteLine(res);
            }
            catch(Exception ex)
            {
                Console.WriteLine("Error :", ex);
            }[/code]
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Tobe on March 09, 2017, 08:43:40 AM
Hi,

First of all sorry for my late response, was busy the past few days. Then I'm thankful for your response!

I've tried what you send me and it looks better, yet still doesn't work. The problem I get is still at [i]protocol.Open();[/i], but now I get a different error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

So it looks better but I'm still missing something, do you know what?


                string server = "tcp://sisctestsrv01:9201";
                SolutionControlServerProtocol protocol = new SolutionControlServerProtocol(new Endpoint(new Uri(server)));
                protocol.Open();
                RequestGetApplicationInfo req = RequestGetApplicationInfo.Create();
                req.ControlObjectId = 117;
                IMessage res = protocol.Request(req);
                if (res is EventInfo)
                {
                    EventInfo info = res as EventInfo;
                    Console.WriteLine("Status: " + info.ControlStatus);
                }


Regards
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Kubig on March 09, 2017, 10:07:59 AM
Are you sure about the SCS port (9201)?
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Tobe on March 09, 2017, 11:45:15 AM
[quote author=Kubig link=topic=10189.msg46274#msg46274 date=1489054079]
Are you sure about the SCS port (9201)?
[/quote]

Yes I'm pretty sure, tried it with 2020 which got me same error. Got the information through SCI, is there an other way how i could find out which port I should use?
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Kubig on March 09, 2017, 11:57:21 AM
Please,share screenshot of SCS server setting tab.
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Tobe on March 09, 2017, 12:25:15 PM
[url=http://prnt.sc/ehttsa]http://prnt.sc/ehttsa[/url]
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: cavagnaro on March 09, 2017, 12:46:49 PM
You testing on Lan or over a Vpn or something similar? If you ping the server do you have a steady connection or packets dropping and high latency?

Enviado de meu E6633 usando Tapatalk

Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Tobe on March 09, 2017, 12:58:46 PM
[quote author=cavagnaro link=topic=10189.msg46281#msg46281 date=1489063609]
You testing on Lan or over a Vpn or something similar? If you ping the server do you have a steady connection or packets dropping and high latency?
[/quote]

Lan with steady connection..
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: cavagnaro on March 09, 2017, 12:59:26 PM
Can you telnet that port from your Pc?
Telnet server port

Enviado de meu E6633 usando Tapatalk

Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: PeteHoyle on March 09, 2017, 02:10:31 PM
The screenshot you have sent shows that Application Name 'Pulse' of type 'DataSourcer' is using port 9201. That will be why you can't connect using the SolutionControlServerProtocol.

Do you know what the port number for your Solution Control Server is ? That would be an application of type 'Solution Control Server'
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: cavagnaro on March 09, 2017, 02:16:20 PM
[quote author=PeteHoyle link=topic=10189.msg46291#msg46291 date=1489068631]
The screenshot you have sent shows that Application Name 'Pulse' of type 'DataSourcer' is using port 9201. That will be why you can't connect using the SolutionControlServerProtocol.

Do you know what the port number for your Solution Control Server is ? That would be an application of type 'Solution Control Server'
[/quote]

:-X :-X lmao
Title: Re: SolutionControlServerProtocol Open connection with C#
Post by: Tobe on March 09, 2017, 02:32:40 PM
Oh I'm actually dumb. *facepalm*
I'm trying to get the informations from a application [u]on[/u] a SCS, not the SCS itself. That explains alot, have to do this differently.

Thanks for you help guys and sorry that i wasted your time...  :-[