예제 #1
0
        public override Task OnDisconnected(bool stopCalled)
        {
            Log.Debug("OnDisconnected");

            var user = Context.Request.Environment["server.User"] as GenericPrincipal;

            if (user == null)
            {
                AuthorizeHubAttribute.Authorize(Context.Request);
            }

            if (string.IsNullOrEmpty(Context.Request.Headers["voipConnection"]))
            {
                AddAgentOfflineInspector();
                try
                {
                    Groups.Remove(Context.ConnectionId, DictionaryKey);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            }

            return(base.OnDisconnected(stopCalled));
        }
예제 #2
0
 public override Task OnConnected()
 {
     try
     {
         var user = Context.Request.Environment["server.User"] as GenericPrincipal;
         if (user == null)
         {
             AuthorizeHubAttribute.Authorize(Context.Request);
         }
         ConnectUser();
     }
     catch
     {
     }
     return(base.OnConnected());
 }
예제 #3
0
 public override Task OnConnected()
 {
     try
     {
         var user = Context.Request.Environment["server.User"] as GenericPrincipal;
         if (user == null)
         {
             AuthorizeHubAttribute.Authorize(Context.Request);
         }
         ConnectUser();
     }
     catch (Exception ex)
     {
         log.Error("Error CountersHub OnConnected", ex);
     }
     return(base.OnConnected());
 }
예제 #4
0
        public override Task OnDisconnected(bool stopCalled)
        {
            try
            {
                var user = Context.Request.Environment["server.User"] as GenericPrincipal;
                if (user == null)
                {
                    AuthorizeHubAttribute.Authorize(Context.Request);
                }
                DisconnectUser();
            }
            catch (Exception)
            {
            }

            return(base.OnDisconnected(stopCalled));
        }
예제 #5
0
        public override Task OnDisconnected(bool stopCalled)
        {
            Log.Debug("OnDisconnected:" + Context.ConnectionId);

            var user = Context.Request.Environment["server.User"] as GenericPrincipal;

            if (user == null)
            {
                AuthorizeHubAttribute.Authorize(Context.Request);
            }

            if (string.IsNullOrEmpty(Context.Request.Headers["voipConnection"]))
            {
                if (user != null)
                {
                    var userAccount = user.Identity as IUserAccount;
                    if (userAccount != null)
                    {
                        bool result;
                        var  connectionCount = Connections.Remove(userAccount.Tenant, userAccount.ID.ToString(), Context.ConnectionId, out result);
                        if (connectionCount == 0)
                        {
                            Status(AgentStatus.Offline);
                        }
                    }
                }
                try
                {
                    Groups.Remove(Context.ConnectionId, DictionaryKey);
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            }

            return(base.OnDisconnected(stopCalled));
        }