예제 #1
0
 public GoIpHangupEventArgs(string message, GoIpHangupPacket packet, string host, int port)
 {
     Message = message;
     Packet  = packet;
     Host    = host;
     Port    = port;
 }
예제 #2
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));
        }