Exemplo n.º 1
0
 public GoIpMessageEventArgs(string message, GoIpMessagePacket packet, string host, int port)
 {
     Message = message;
     Packet  = packet;
     Host    = host;
     Port    = port;
 }
Exemplo n.º 2
0
        private void ReceiveSms(string data, string host, int port)
        {
            _logger.LogDebug("Start SMS processing");

            GoIpMessagePacket packet = new GoIpMessagePacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("Received SMS data authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("RECEIVE", packet.receiveid.ToString(), "Authentication error!"), host, port);
                OnMessage?.Invoke(this, new GoIpMessageEventArgs("Receive SMS authentication error!", packet, host, port));
                return;
            }

            packet.password = "";  // Delete password for security reasons

            _logger.LogInformation("Received SMS OK. ReceiveId: {0} Mobile: {1} Message: {2}", packet.receiveid, packet.Srcnum, packet.Message);

            Send(ACKPacketFactory.ACK("RECEIVE", packet.receiveid.ToString(), ""), host, port);
            OnMessage?.Invoke(this, new GoIpMessageEventArgs("OK", packet, host, port));
        }