Example #1
0
        /// <summary>
        /// Выставление в очередь одиночного сообщения
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        void communicator_OnSubmitSm(object source, SubmitSmEventArgs e)
        {
            SmppSubmitSmResp pdu;

            //Посылаем сообщение
            if (communicator.IsBinded)
            {
                //TODO: Здесь еще правильно осуществить валидацию
                //pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RSUBMITFAIL
                if (billing == null)
                {
                    throw new InvalidOperationException("Cannot submit messages with billing connection not initialized!");
                }
                pdu = storage.StoreMessage(e.SubmitSmPdu);
                if (pdu.CommandStatus == (int)SmppCommandStatus.ESME_ROK)
                {
                    billing.MessagesStored(1);
                    LoggerService.Logger.TraceEvent(TraceEventType.Information, LoggingCatoegory.Protocol.IntValue(), string.Format("Message by client {0} stored by sumit_sm to number {1}", billing.Account.Login, e.SubmitSmPdu.DestinationAddress));
                }
            }
            else
            {
                pdu = new SmppSubmitSmResp();
                pdu.SequenceNumber = e.SubmitSmPdu.SequenceNumber;
                pdu.MessageId      = System.Guid.NewGuid().ToString().Substring(0, 10);
                pdu.CommandStatus  = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
            }
            communicator.SendPdu(pdu);
        }
Example #2
0
        /// <summary>
        /// Fires an event off based on what Pdu is sent in.
        /// </summary>
        /// <param name="response">The response to fire an event for.</param>
        private void FireEvents(Pdu response)
        {
            //понеслась...
            if (response is SmppBindResp)
            {
                SmppBindResp resp = (SmppBindResp)response;
                if (resp.CommandStatus == (uint)SmppCommandStatus.ESME_ROK)
                {
                    _isBinded = true; //Мы сопоставлены, все отлично
                }
                if (OnBindResp != null)
                {
                    OnBindResp(this, new BindRespEventArgs(resp));
                }
            }
            else if (response is SmppUnbindResp)
            {
                _isBinded = false;
                //Отсоединяемся
                asClient.Disconnect();
                if (OnUnboundResp != null)
                {
                    OnUnboundResp(this, new UnbindRespEventArgs((SmppUnbindResp)response));
                }
            }
            else if (response is SmppAlertNotification)
            {
                if (OnAlert != null)
                {
                    OnAlert(this, new AlertEventArgs((SmppAlertNotification)response));
                }
            }
            else if (response is SmppSubmitSmResp)
            {
                if (OnSubmitSmResp != null)
                {
                    OnSubmitSmResp(this,
                                   new SubmitSmRespEventArgs((SmppSubmitSmResp)response));
                }
            }
            else if (response is SmppEnquireLinkResp)
            {
                if (OnEnquireLinkResp != null)
                {
                    OnEnquireLinkResp(this, new EnquireLinkRespEventArgs((SmppEnquireLinkResp)response));
                }
            }
            else if (response is SmppSubmitSm)
            {
                if (OnSubmitSm != null)
                {
                    OnSubmitSm(this, new SubmitSmEventArgs((SmppSubmitSm)response));
                }
                else
                {
                    //Нет отбработчика, значит сами
                    SmppSubmitSmResp pdu = new SmppSubmitSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.MessageId      = System.Guid.NewGuid().ToString().Substring(0, 10);
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RSUBMITFAIL;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }

                    SendPdu(pdu);
                }
            }
            else if (response is SmppQuerySm)
            {
                if (OnQuerySm != null)
                {
                    OnQuerySm(this, new QuerySmEventArgs((SmppQuerySm)response));
                }
                else
                {
                    //Нет обработчика, отдаем пустой ответ "незнаю"
                    SmppQuerySmResp pdu = new SmppQuerySmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RQUERYFAIL;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }
                    SendPdu(pdu);
                }
            }
            else if (response is SmppGenericNack)
            {
                if (OnGenericNack != null)
                {
                    OnGenericNack(this, new GenericNackEventArgs((SmppGenericNack)response));
                }
            }
            else if (response is SmppEnquireLink)
            {
                if (OnEnquireLink != null)
                {
                    OnEnquireLink(this, new EnquireLinkEventArgs((SmppEnquireLink)response));
                }

                //Ответ, что с соединением все хорошо. Ответ взад
                SmppEnquireLinkResp pdu = new SmppEnquireLinkResp();
                pdu.SequenceNumber = response.SequenceNumber;
                pdu.CommandStatus  = (uint)SmppCommandStatus.ESME_ROK;
                SendPdu(pdu);
            }
            else if (response is SmppUnbind)
            {
                if (OnUnbind != null)
                {
                    OnUnbind(this, new UnbindEventArgs((SmppUnbind)response));
                }
                else
                {
                    //Нет обработчика, сами отвечаем
                    SmppUnbindResp pdu = new SmppUnbindResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = (uint)SmppCommandStatus.ESME_ROK;
                    SendPdu(pdu);
                }
                //Отключаемся, не сопряжены
                asClient.Disconnect();
                _isBinded = false;
            }
            else if (response is SmppBind)
            {
                SmppBind bindCommand = (SmppBind)response;
                if (_serverMode)
                {
                    this._AddressRange = bindCommand.AddressRange;
                    this._BindType     = bindCommand.BindType;
                    this._NpiType      = bindCommand.AddressNpi;
                    this._TonType      = bindCommand.AddressTon;
                    this._Version      = bindCommand.InterfaceVersion;
                    this._SystemType   = bindCommand.SystemType;
                    this._SystemId     = bindCommand.SystemId;
                    this._Password     = bindCommand.Password;
                }
                if (OnBind != null)
                {
                    BindEventArgs bindEA = new BindEventArgs(bindCommand);
                    OnBind(this, bindEA);
                    _isBinded = bindEA.IsBindSucessfull;
                }
                else
                {
                    //Если нет обработчика, то все плохо, возвращаем стандартный ответ
                    SmppBindResp pdu = new SmppBindResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RALYBND;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RBINDFAIL;
                        }
                        _isBinded = false;
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                        _isBinded         = true;
                    }
                    pdu.SystemId = "Generic";
                    SendPdu(pdu);
                }
            }
            else if (response is SmppCancelSm)
            {
                if (OnCancelSm != null)
                {
                    OnCancelSm(this, new CancelSmEventArgs((SmppCancelSm)response));
                }
                else
                {
                    //Нет обработчика - стандартный ответ "незнаю"
                    SmppCancelSmResp pdu = new SmppCancelSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RCANCELFAIL;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }
                    SendPdu(pdu);
                }
            }
            else if (response is SmppCancelSmResp)
            {
                if (OnCancelSmResp != null)
                {
                    OnCancelSmResp(this, new CancelSmRespEventArgs((SmppCancelSmResp)response));
                }
            }
            else if (response is SmppCancelSmResp)
            {
                if (OnCancelSmResp != null)
                {
                    OnCancelSmResp(this, new CancelSmRespEventArgs((SmppCancelSmResp)response));
                }
            }
            else if (response is SmppQuerySmResp)
            {
                if (OnQuerySmResp != null)
                {
                    OnQuerySmResp(this, new QuerySmRespEventArgs((SmppQuerySmResp)response));
                }
            }
            else if (response is SmppDataSm)
            {
                if (OnDataSm != null)
                {
                    OnDataSm(this, new DataSmEventArgs((SmppDataSm)response));
                }
                else
                {
                    //Нет обработчика, стандартный ответ
                    SmppDataSmResp pdu = new SmppDataSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RSUBMITFAIL;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }
                    pdu.MessageId = "Generic";

                    SendPdu(pdu);
                }
            }
            else if (response is SmppDataSmResp)
            {
                if (OnDataSmResp != null)
                {
                    OnDataSmResp(this, new DataSmRespEventArgs((SmppDataSmResp)response));
                }
            }
            else if (response is SmppDeliverSm)
            {
                if (OnDeliverSm != null)
                {
                    OnDeliverSm(this, new DeliverSmEventArgs((SmppDeliverSm)response));
                }
                else
                {
                    //Нет обработчика - стандартный ответ
                    SmppDeliverSmResp pdu = new SmppDeliverSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RDELIVERYFAILURE;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }
                    SendPdu(pdu);
                }
            }
            else if (response is SmppDeliverSmResp)
            {
                if (OnDeliverSmResp != null)
                {
                    OnDeliverSmResp(this, new DeliverSmRespEventArgs((SmppDeliverSmResp)response));
                }
            }
            else if (response is SmppReplaceSm)
            {
                if (OnReplaceSm != null)
                {
                    OnReplaceSm(this, new ReplaceSmEventArgs((SmppReplaceSm)response));
                }
                else
                {
                    //Нет обработчика - стандартный ответ
                    SmppReplaceSmResp pdu = new SmppReplaceSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RREPLACEFAIL;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }
                    SendPdu(pdu);
                }
            }
            else if (response is SmppReplaceSmResp)
            {
                if (OnReplaceSmResp != null)
                {
                    OnReplaceSmResp(this, new ReplaceSmRespEventArgs((SmppReplaceSmResp)response));
                }
            }
            else if (response is SmppSubmitMulti)
            {
                if (OnSubmitMulti != null)
                {
                    OnSubmitMulti(this, new SubmitMultiEventArgs((SmppSubmitMulti)response));
                }
                else
                {
                    //Нет обработчика - стандартный ответ
                    SmppSubmitMultiResp pdu = new SmppSubmitMultiResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    if (_serverMode)
                    {
                        if (_isBinded)
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RSUBMITFAIL;
                        }
                        else
                        {
                            pdu.CommandStatus = (uint)SmppCommandStatus.ESME_RINVBNDSTS;
                        }
                    }
                    else
                    {
                        pdu.CommandStatus = (uint)SmppCommandStatus.ESME_ROK;
                    }
                    SendPdu(pdu);
                }
            }
            else if (response is SmppSubmitMultiResp)
            {
                if (OnSubmitMultiResp != null)
                {
                    OnSubmitMultiResp(this, new SubmitMultiRespEventArgs((SmppSubmitMultiResp)response));
                }
            }
        }
Example #3
0
        /// <summary>
        /// Gets a single PDU based on the response bytes.
        /// </summary>
        /// <param name="response">The SMSC response.</param>
        /// <returns>The PDU corresponding to the bytes.</returns>
        private Pdu GetPDU(byte[] response)
        {
            Pdu.CommandIdType commandID = Pdu.DecodeCommandId(response);
            Pdu packet;

            switch (commandID)
            {
            case Pdu.CommandIdType.alert_notification:
                packet = new SmppAlertNotification(response);
                break;

            case Pdu.CommandIdType.bind_receiver_resp:
            case Pdu.CommandIdType.bind_transceiver_resp:
            case Pdu.CommandIdType.bind_transmitter_resp:
                packet = new SmppBindResp(response);
                break;

            case Pdu.CommandIdType.cancel_sm_resp:
                packet = new SmppCancelSmResp(response);
                break;

            case Pdu.CommandIdType.data_sm_resp:
                packet = new SmppDataSmResp(response);
                break;

            case Pdu.CommandIdType.deliver_sm:
                packet = new SmppDeliverSm(response);
                break;

            case Pdu.CommandIdType.enquire_link_resp:
                packet = new SmppEnquireLinkResp(response);
                break;

            case Pdu.CommandIdType.outbind:
                packet = new SmppOutbind(response);
                break;

            case Pdu.CommandIdType.query_sm_resp:
                packet = new SmppQuerySmResp(response);
                break;

            case Pdu.CommandIdType.replace_sm_resp:
                packet = new SmppReplaceSmResp(response);
                break;

            case Pdu.CommandIdType.submit_multi_resp:
                packet = new SmppSubmitMultiResp(response);
                break;

            case Pdu.CommandIdType.submit_sm_resp:
                packet = new SmppSubmitSmResp(response);
                break;

            case Pdu.CommandIdType.unbind_resp:
                packet = new SmppUnbindResp(response);
                break;

            default:
                packet = null;
                break;
            }

            return(packet);
        }
Example #4
0
        /// <summary>
        /// Fires an event off based on what Pdu is sent in.
        /// </summary>
        /// <param name="response">The response to fire an event for.</param>
        private void FireEvents(Pdu response)
        {
            //here we go...
            if (response is SmppBindResp)
            {
                if (OnBindResp != null)
                {
                    OnBindResp(this, new BindRespEventArgs((SmppBindResp)response));
                }
            }
            else if (response is SmppUnbindResp)
            {
                //disconnect
                asClient.Disconnect();
                if (OnUnboundResp != null)
                {
                    OnUnboundResp(this, new UnbindRespEventArgs((SmppUnbindResp)response));
                }
            }
            else if (response is SmppAlertNotification)
            {
                if (OnAlert != null)
                {
                    OnAlert(this, new AlertEventArgs((SmppAlertNotification)response));
                }
            }
            else if (response is SmppSubmitSmResp)
            {
                if (OnSubmitSmResp != null)
                {
                    OnSubmitSmResp(this,
                                   new SubmitSmRespEventArgs((SmppSubmitSmResp)response));
                }
            }
            else if (response is SmppEnquireLinkResp)
            {
                if (OnEnquireLinkResp != null)
                {
                    OnEnquireLinkResp(this, new EnquireLinkRespEventArgs((SmppEnquireLinkResp)response));
                }
            }
            else if (response is SmppSubmitSm)
            {
                if (OnSubmitSm != null)
                {
                    OnSubmitSm(this, new SubmitSmEventArgs((SmppSubmitSm)response));
                }
                else
                {
                    //default a response
                    SmppSubmitSmResp pdu = new SmppSubmitSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.MessageId      = System.Guid.NewGuid().ToString().Substring(0, 10);
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppQuerySm)
            {
                if (OnQuerySm != null)
                {
                    OnQuerySm(this, new QuerySmEventArgs((SmppQuerySm)response));
                }
                else
                {
                    //default a response
                    SmppQuerySmResp pdu = new SmppQuerySmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppGenericNack)
            {
                if (OnGenericNack != null)
                {
                    OnGenericNack(this, new GenericNackEventArgs((SmppGenericNack)response));
                }
            }
            else if (response is SmppEnquireLink)
            {
                if (OnEnquireLink != null)
                {
                    OnEnquireLink(this, new EnquireLinkEventArgs((SmppEnquireLink)response));
                }

                //send a response back
                SmppEnquireLinkResp pdu = new SmppEnquireLinkResp();
                pdu.SequenceNumber = response.SequenceNumber;
                pdu.CommandStatus  = 0;

                SendPdu(pdu);
            }
            else if (response is SmppUnbind)
            {
                if (OnUnbind != null)
                {
                    OnUnbind(this, new UnbindEventArgs((SmppUnbind)response));
                }
                else
                {
                    //default a response
                    SmppUnbindResp pdu = new SmppUnbindResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppBind)
            {
                if (OnBind != null)
                {
                    OnBind(this, new BindEventArgs((SmppBind)response));
                }
                else
                {
                    //default a response
                    SmppBindResp pdu = new SmppBindResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;
                    pdu.SystemId       = "Generic";

                    SendPdu(pdu);
                }
            }
            else if (response is SmppCancelSm)
            {
                if (OnCancelSm != null)
                {
                    OnCancelSm(this, new CancelSmEventArgs((SmppCancelSm)response));
                }
                else
                {
                    //default a response
                    SmppCancelSmResp pdu = new SmppCancelSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppCancelSmResp)
            {
                if (OnCancelSmResp != null)
                {
                    OnCancelSmResp(this, new CancelSmRespEventArgs((SmppCancelSmResp)response));
                }
            }
            else if (response is SmppCancelSmResp)
            {
                if (OnCancelSmResp != null)
                {
                    OnCancelSmResp(this, new CancelSmRespEventArgs((SmppCancelSmResp)response));
                }
            }
            else if (response is SmppQuerySmResp)
            {
                if (OnQuerySmResp != null)
                {
                    OnQuerySmResp(this, new QuerySmRespEventArgs((SmppQuerySmResp)response));
                }
            }
            else if (response is SmppDataSm)
            {
                if (OnDataSm != null)
                {
                    OnDataSm(this, new DataSmEventArgs((SmppDataSm)response));
                }
                else
                {
                    //default a response
                    SmppDataSmResp pdu = new SmppDataSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;
                    pdu.MessageId      = "Generic";

                    SendPdu(pdu);
                }
            }
            else if (response is SmppDataSmResp)
            {
                if (OnDataSmResp != null)
                {
                    OnDataSmResp(this, new DataSmRespEventArgs((SmppDataSmResp)response));
                }
            }
            else if (response is SmppDeliverSm)
            {
                if (OnDeliverSm != null)
                {
                    OnDeliverSm(this, new DeliverSmEventArgs((SmppDeliverSm)response));
                }
                else
                {
                    //default a response
                    SmppDeliverSmResp pdu = new SmppDeliverSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppDeliverSmResp)
            {
                if (OnDeliverSmResp != null)
                {
                    OnDeliverSmResp(this, new DeliverSmRespEventArgs((SmppDeliverSmResp)response));
                }
            }
            else if (response is SmppReplaceSm)
            {
                if (OnReplaceSm != null)
                {
                    OnReplaceSm(this, new ReplaceSmEventArgs((SmppReplaceSm)response));
                }
                else
                {
                    //default a response
                    SmppReplaceSmResp pdu = new SmppReplaceSmResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppReplaceSmResp)
            {
                if (OnReplaceSmResp != null)
                {
                    OnReplaceSmResp(this, new ReplaceSmRespEventArgs((SmppReplaceSmResp)response));
                }
            }
            else if (response is SmppSubmitMulti)
            {
                if (OnSubmitMulti != null)
                {
                    OnSubmitMulti(this, new SubmitMultiEventArgs((SmppSubmitMulti)response));
                }
                else
                {
                    //default a response
                    SmppSubmitMultiResp pdu = new SmppSubmitMultiResp();
                    pdu.SequenceNumber = response.SequenceNumber;
                    pdu.CommandStatus  = 0;

                    SendPdu(pdu);
                }
            }
            else if (response is SmppSubmitMultiResp)
            {
                if (OnSubmitMultiResp != null)
                {
                    OnSubmitMultiResp(this, new SubmitMultiRespEventArgs((SmppSubmitMultiResp)response));
                }
            }
        }
Example #5
0
 /// <summary>
 /// Sets up the SubmitSmRespEventArgs.
 /// </summary>
 /// <param name="response">The SmppSubmitSmResp.</param>
 internal SubmitSmRespEventArgs(SmppSubmitSmResp response) : base(response)
 {
     _response = response;
 }
        /// <summary>
        /// Gets a single PDU based on the response bytes.
        /// </summary>
        /// <param name="response">The SMSC response.</param>
        /// <returns>The PDU corresponding to the bytes.</returns>
        private Pdu GetPdu(byte[] response)
        {
            var commandId = Pdu.DecodeCommandId(response);

            Pdu packet;

            switch (commandId)
            {
            case CommandId.AlertNotification:
                packet = new SmppAlertNotification(response);
                break;

            case CommandId.BindReceiverResp:
            case CommandId.BindTransceiverResp:
            case CommandId.BindTransmitterResp:
                packet = new SmppBindResp(response);
                break;

            case CommandId.CancelSmResp:
                packet = new SmppCancelSmResp(response);
                break;

            case CommandId.DataSmResp:
                packet = new SmppDataSmResp(response);
                break;

            case CommandId.DeliverSm:
                packet = new SmppDeliverSm(response);
                break;

            case CommandId.EnquireLink:
                packet = new SmppEnquireLink(response);
                break;

            case CommandId.EnquireLinkResp:
                packet = new SmppEnquireLinkResp(response);
                break;

            case CommandId.Outbind:
                packet = new SmppOutbind(response);
                break;

            case CommandId.QuerySmResp:
                packet = new SmppQuerySmResp(response);
                break;

            case CommandId.ReplaceSmResp:
                packet = new SmppReplaceSmResp(response);
                break;

            case CommandId.SubmitMultiResp:
                packet = new SmppSubmitMultiResp(response);
                break;

            case CommandId.SubmitSmResp:
                packet = new SmppSubmitSmResp(response);
                break;

            case CommandId.UnbindResp:
                packet = new SmppUnbindResp(response);
                break;

            case CommandId.GenericNack:
                packet = new SmppGenericNack(response);
                break;

            default:
                packet = null;
                break;
            }

            return(packet);
        }