Example #1
0
        private void ReceiveNormalPacketCallback(PyDataType ar)
        {
            PyPacket packet = ar;
            Client   client = null;

            if (this.ClientManager.Contains(packet.UserID))
            {
                client = this.ClientManager.Get(packet.UserID);
            }

            switch (packet.Type)
            {
            case PyPacket.PacketType.CALL_REQ:
                this.HandleCallReq(packet, client);
                break;

            case PyPacket.PacketType.SESSIONCHANGENOTIFICATION:
                this.HandleSessionChangeNotification(packet, client);
                break;

            case PyPacket.PacketType.PING_REQ:
                this.HandlePingReq(packet, client);
                break;

            case PyPacket.PacketType.CALL_RSP:
                this.HandleCallRes(packet, client);
                break;

            case PyPacket.PacketType.NOTIFICATION:
                this.HandleNotification(packet, client);
                break;
            }

            // send any notification that might be pending
            client?.SendPendingNotifications();
        }