Exemplo n.º 1
0
        private void CellList(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Cell list event");

            GoIpCellListPacket packet = new GoIpCellListPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp Cell list event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("CELLS", packet.receiveid.ToString(), "Cell list event authentication error!"), host, port);
                OnCellListChanged?.Invoke(this, new GoIpCellListEvenetArgs("GoIp Cell list event authentication error!", packet.celllist, host, port));
                return;
            }

            _logger.LogInformation("Received GoIp Cell list event. ReceiveId: {0} Cell list: {1}", packet.receiveid, packet.celllist);

            Send(ACKPacketFactory.ACK("CELLS", packet.receiveid.ToString(), ""), host, port);
            OnCellListChanged?.Invoke(this, new GoIpCellListEvenetArgs("OK", packet.celllist, host, 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));
        }
Exemplo n.º 3
0
        private void DeliverReport(string data, string host, int port)
        {
            _logger.LogDebug("Start SMS delivery report");

            GoIpSmsDeliveryReportPacket packet = new GoIpSmsDeliveryReportPacket(data);

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

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

            _logger.LogInformation("Received SMS delivery report OK. ReceiveId: {0} Send number: {1} SMS no: {2}", packet.receiveid, packet.send_num, packet.sms_no);

            Send(ACKPacketFactory.ACK("DELIVER", packet.receiveid.ToString(), ""), host, port);
            OnDeliveryReport?.Invoke(this, new GoIpDeliveryReportEventArgs("OK", packet, host, port));
        }
Exemplo n.º 4
0
        private void State(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp State");

            GoIpStatePacket packet = new GoIpStatePacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp state report authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("STATE", packet.receiveid.ToString(), "State authentication error!"), host, port);
                OnStateChange?.Invoke(this, new GoIpStateEventArgs("GoIp state authentication error!", packet, host, port));
                return;
            }

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

            _logger.LogInformation("Received GoIp state. ReceiveId: {0} : Gsm state: {1}", packet.receiveid, packet.gsm_remain_state);

            Send(ACKPacketFactory.ACK("STATE", packet.receiveid.ToString(), ""), host, port);
            OnStateChange?.Invoke(this, new GoIpStateEventArgs("OK", packet, host, port));
        }
Exemplo n.º 5
0
        private void RecordData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Record event");

            GoIpRecordPacket packet = new GoIpRecordPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp record event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("RECORD", packet.receiveid.ToString(), "Record event authentication error!"), host, port);
                OnRecord?.Invoke(this, new GoIpRecordEventArgs("GoIp record event authentication error!", packet, host, port));
                return;
            }

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

            _logger.LogInformation("Received GoIp record event. ReceiveId: {0} Send num: {1} Direction: {2}", packet.receiveid, packet.send_num, packet.direction);

            Send(ACKPacketFactory.ACK("RECORD", packet.receiveid.ToString(), ""), host, port);
            OnRecord?.Invoke(this, new GoIpRecordEventArgs("OK", packet, host, port));
        }
Exemplo n.º 6
0
        private void HangupData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Hangup event");

            GoIpHangupPacket packet = new GoIpHangupPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp Hangup event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("HANGUP", packet.receiveid.ToString(), "Hangup event authentication error!"), host, port);
                OnHangup?.Invoke(this, new GoIpHangupEventArgs("GoIp Hangup event authentication error!", packet, host, port));
                return;
            }

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

            _logger.LogInformation("Received GoIp Hangup event. ReceiveId: {0} Number: {1} Cause: {2}", packet.receiveid, packet.num, packet.cause);

            Send(ACKPacketFactory.ACK("REMAIN", packet.receiveid.ToString(), ""), host, port);
            OnHangup?.Invoke(this, new GoIpHangupEventArgs("OK", packet, host, port));
        }
Exemplo n.º 7
0
        private void ExpiryData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Expiry event");

            GoIpExpiryPacket packet = new GoIpExpiryPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp Expiry event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("EXPIRY", packet.receiveid.ToString(), "Expiry event authentication error!"), host, port);
                OnExpiry?.Invoke(this, new GoIpExpiryEventArgs("GoIp Expiry event authentication error!", packet, host, port));
                return;
            }

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

            _logger.LogInformation("Received GoIp Expiry event. ReceiveId: {0} Expiry: {1}", packet.receiveid, packet.exp);

            Send(ACKPacketFactory.ACK("EXPIRY", packet.receiveid.ToString(), ""), host, port);
            OnExpiry?.Invoke(this, new GoIpExpiryEventArgs("OK", packet, host, port));
        }