Author Topic: Get ConnID  (Read 4439 times)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Get ConnID
« on: July 31, 2013, 01:00:55 PM »
Hi guys,
Testing  the PSDK for a project and getting stuck on capturing ConnID... :/

Here I open a connection to the TServer and declare a function to capture the Events.

[Code]
        private void btnConnect_Click(object sender, EventArgs e)
        {
           
            TServerEndPoint = new Endpoint("TServer", txtServer.Text, int.Parse(txtPort.Text));

            tServerProtocol = new TServerProtocol(TServerEndPoint);

            tServerProtocol.Received += OnTServerMessageReceived;

            try
            {
                tServerProtocol.Open();

            }
            catch (Exception ex)
            {
                writeToLogArea(ex.Message);
            }


        }
[/Code]


On the Function I do a simple switch:
[CODe]
private void OnTServerMessageReceived(object sender, EventArgs e)
        {
            MessageEventArgs args = (MessageEventArgs)e;
                System.Diagnostics.Debug.WriteLine( args.Message);
           
                writeToLogArea(args.Message.ToString()); //This works by writing output to a log file

                switch (args.Message.Id)
                {
                    case EventDialing.MessageId:
                        ConnectionId vConnID = ((EventDialing)sender).ConnID;
                       
                        break;
[/CODE]

But here it says it can't convert the TServerProtocol to a EventDialing object...so how can I capture the ConnID or do the proper cast?

Thanks!

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Get ConnID
« Reply #1 on: July 31, 2013, 01:14:48 PM »
Use IInteractionVoice interface or low-level Enterprise interaction, which provides data such as queue, etc.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Get ConnID
« Reply #2 on: July 31, 2013, 01:19:05 PM »
Just found the answer hehe, I think that not sleeping and being tire make stuff more difficult ;)

[code]
case EventDialing.MessageId:
IMessage message1 = ((MessageEventArgs)e).Message;
var myDN = ((EventRegistered)message1).ThisDN;
break;
[/code]

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Get ConnID
« Reply #3 on: July 31, 2013, 01:19:33 PM »
[quote author=Kubig link=topic=7925.msg34708#msg34708 date=1375276488]
Use IInteractionVoice interface or low-level Enterprise interaction, which provides data such as queue, etc.
[/quote]

In english? ;)

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2752
  • Karma: 44
Re: Get ConnID
« Reply #4 on: July 31, 2013, 01:40:57 PM »
I am sorry, I forgot that you are not using IWS :-)
So, you can get connectionID from each Event from T-Server, map the response from T-Server to IMessage type and afterward convert to specific Event. It is same scenario as for others requests within GenesysPSDK