Author Topic: Having problem on receiving event from Outbound Server?  (Read 3018 times)

Offline blanco

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Having problem on receiving event from Outbound Server?
« on: March 18, 2016, 09:44:41 AM »
Hi all,
I am not receiving any event from OB server and don't know why. Warnings says that EventBrokerService is deprecated and protocol.Received event is enough to catch the events. I do exactly what they say but couldn't receive any of them. Do u know why? I am using 8.5 PSDK on .NET

OutboundServerProtocol mOCSProtocol = new OutboundServerProtocol(new Endpoint(new Uri(mOCServerURI)));
            mOCSProtocol.Received += mmm;
            mOCSProtocol.UserName = mUserName;
            mOCSProtocol.UserPassword = mUserPassword;
            mOCSProtocol.Open(TimeSpan.FromSeconds(5));


private void mmm(object sender, EventArgs e)
        {
           
                var args = e as MessageEventArgs;
                if ((args != null) && (args.Message != null))
                {
                  //common processing...
                }
           
        }

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7639
  • Karma: 56330
Re: Having problem on receiving event from Outbound Server?
« Reply #1 on: March 18, 2016, 02:24:27 PM »
So yeah, posting many times same question will definitively help you. Keep going.

Offline hsujdik

  • Hero Member
  • *****
  • Posts: 541
  • Karma: 30
Re: Having problem on receiving event from Outbound Server?
« Reply #2 on: March 18, 2016, 02:49:44 PM »
To OB I dont if works the same as other protocols because I havent used it yet, but usually you have to set an event handler before opening the protocol

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 126
  • Karma: 13
Re: Having problem on receiving event from Outbound Server?
« Reply #3 on: March 18, 2016, 02:53:05 PM »
To get Campaign Events it looks like you have to Register for the Campaign after you have opened the connection:

[code]public OutboundServer()
        {
            OutboundServerProtocol mOCSProtocol = new OutboundServerProtocol(new Endpoint(new Uri("tcp://demosrv:6127")));
            mOCSProtocol.Received += OnOCSMessageReceived;
            mOCSProtocol.SetConnectionInvoker(DefaultInvoker.InvokerSingleton);
            mOCSProtocol.UserName = "demo";
            mOCSProtocol.UserPassword = "";
            mOCSProtocol.Open(TimeSpan.FromSeconds(5));
            //Register Campaign Campaign DBID, Agent Group DBID, Campaign Group DBID, RequestProperties.
            RequestRegisterCampaign req = RequestRegisterCampaign.Create(101, 130, 101, null);
            mOCSProtocol.Send(req);

        }

        private void OnOCSMessageReceived(object sender, EventArgs e)
        {
            var args = e as MessageEventArgs;
            if ((args != null) && (args.Message != null))
            {
                Console.WriteLine("Message Type: " + args.Message.GetType());
                if (args.Message is EventCampaignRegistered)
                {
                    EventCampaignRegistered ecr = args.Message as EventCampaignRegistered;
                    Console.WriteLine("Campaign Registered: " + ecr);
                }
                else if (args.Message is EventCampaignStatus)
                {
                    EventCampaignStatus ecs = args.Message as EventCampaignStatus;
                    Console.WriteLine("Campaign Status: " + ecs);
                }
            }
        }[/code]

Offline blanco

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Re: Having problem on receiving event from Outbound Server?
« Reply #4 on: March 21, 2016, 06:32:15 AM »
thanks @PeteHoyle registering campaign solved my problem  ;)