protected override async Task DoNetworkMessageReceived(SmsServerSession session, NetworkMessage message) { if (!session.IsAuthenticated && !(message is SgipMessageBind)) { await session.StopAsync(); return; } if (message is SgipMessageBind) { await this.DoReceiveBind(session, message as SgipMessageBind); } else if (message is SgipMessageUnbind) { await this.DoReceiveUnbind(session, message as SgipMessageUnbind); } else if (message is SgipMessageReport) { await this.DoReceiveReport(session, message as SgipMessageReport); } else if (message is SgipMessageDeliver) { await this.DoReceiveDeliver(session, message as SgipMessageDeliver); } }
protected override async Task DoNetworkMessageReceived(SmsServerSession session, NetworkMessage message) { if (this._isSimulated) { await base.DoNetworkMessageReceived(session, message); return; } if (message is CmppMessageConnect) { var m = message as CmppMessageConnect; var isAuthenticated = this.IsAuthenticated(m); if (isAuthenticated) { var r = new CmppMessageConnectResponse(); r.SequenceId = m.SequenceId; r.Version = 0x30; r.AuthenticatorISMG = new byte[16]; r.Status = 0; session.UserId = m.SourceAddress; await session.SendAsync(r); this.OnSessionConnected(session); } else { var tmp = session.StopAsync(); } } else if (message is CmppMessageSubmit) { var m = message as CmppMessageSubmit; var r = new CmppMessageSubmitResponse(); r.SequenceId = m.SequenceId; r.MessasgeId = this.GetMessageId(); r.Result = 0; this.SubmitQueue.Enqueue(new CmppSmsServerSubmitContext() { Submit = m, MessageId = r.MessasgeId, UserId = session.UserId }); await session.SendAsync(r); } else if (message is CmppMessageActiveTest) { var m = message as CmppMessageActiveTest; var r = new CmppMessageActiveTestResponse(); r.SequenceId = m.SequenceId; await session.SendAsync(r); } }