Exemple #1
0
        public AxSms.Message CreateAxSms()
        {
            AxSms.Message objResult = new AxSms.Message();
            objResult.UserTag               = UserTag;
            objResult.FromAddress           = FromAddress;
            objResult.ToAddress             = ToAddress;
            objResult.Body                  = Body;
            objResult.RequestDeliveryReport = RequestDeliveryReport;
            objResult.ToAddressNPI          = ToAddressNpi;
            objResult.ToAddressTON          = ToAddressTon;
            objResult.FromAddressNPI        = FromAddressNpi;
            objResult.FromAddressTON        = FromAddressTon;
            objResult.Reference             = Reference;
            objResult.DataCoding            = DataCoding;
            objResult.BodyFormat            = BodyFormat;
            objResult.HasUdh                = HasUdh;
            objResult.SmppIsDeliveryReport  = IsDeliveryReport;
            objResult.SmppCommandStatus     = CommandStatus;
            objResult.LanguageSingleShift   = LanguageShift;
            objResult.LanguageLockingShift  = LanguageShift;

            foreach (SimTlv objTlv in Tlvs)
            {
                AxSms.Tlv objAxTlv = new AxSms.Tlv();
                objAxTlv.Tag = objTlv.Tag;
                objAxTlv.ValueAsHexString = objTlv.HexValue;
                objResult.SmppAddTlv(objAxTlv);
            }

            return(objResult);
        }
Exemple #2
0
        public SimMessage(AxSms.Message objMessage)
        {
            m_nUserTag               = objMessage.UserTag;
            m_strFromAddress         = objMessage.FromAddress;
            m_strToAddress           = objMessage.ToAddress;
            m_strBody                = objMessage.Body;
            m_bRequestDeliveryReport = objMessage.RequestDeliveryReport;
            m_nToAddressNpi          = objMessage.ToAddressNPI;
            m_nToAddressTon          = objMessage.ToAddressTON;
            m_nFromAddressNpi        = objMessage.FromAddressNPI;
            m_nFromAddressTon        = objMessage.FromAddressTON;
            m_strReference           = objMessage.Reference;
            m_nDataCoding            = objMessage.DataCoding;
            m_nBodyFormat            = objMessage.BodyFormat;
            m_bHasUdh                = objMessage.HasUdh;
            m_bIsDeliveryReport      = objMessage.SmppIsDeliveryReport;
            m_nCommandStatus         = objMessage.SmppCommandStatus;
            m_nSequenceNumber        = objMessage.SmppSequenceNumber;
            m_nTotalParts            = objMessage.TotalParts;
            m_nPartNumber            = objMessage.PartNumber;
            m_nMultipartReference    = objMessage.MultipartRef;
            m_nLanguageShift         = objMessage.LanguageSingleShift;

            AxSms.Tlv objTlv = objMessage.SmppGetFirstTlv();
            while (objMessage.LastError == 0)
            {
                m_lsTlvs.Add(new SimTlv(objTlv));
                objTlv = objMessage.SmppGetNextTlv();
            }
        }
Exemple #3
0
        SimMessage bw_CreateDlr(SimMessage objIn, int nVersion, int nStatusCode, string strStatusText, AxSms.Constants objSmsConst)
        {
            SimMessage objDlr = new SimMessage();

            // Swap adress
            objDlr.FromAddress    = objIn.ToAddress;
            objDlr.FromAddressNpi = objIn.ToAddressNpi;
            objDlr.FromAddressTon = objIn.FromAddressTon;
            objDlr.ToAddress      = "";
            objDlr.ToAddressNpi   = 0;
            objDlr.ToAddressTon   = objSmsConst.TON_ALPHANUMERIC;

            // Set session information
            objDlr.SessionId = objIn.SessionId;
            objDlr.SystemId  = objIn.SystemId;

            // Add TLV's, only for 3.4 or 5.0 clients.
            if (nVersion != objSmsConst.SMPP_VERSION_33)
            {
                objDlr.Tlvs.Clear();
                AxSms.Tlv objAxTlv = new AxSms.Tlv();

                SimTlv objTlv = new SimTlv();
                objTlv.Tag           = objSmsConst.SMPP_TLV_MESSAGE_STATE;
                objAxTlv.ValueAsInt8 = nStatusCode;

                objTlv.TlvType    = SimTlv.TlvTypes.HEX;
                objTlv.TypedValue = objAxTlv.ValueAsHexString;
                objTlv.HexValue   = objTlv.TypedValue;
                objDlr.Tlvs.Add(objTlv);

                objTlv                 = new SimTlv();
                objTlv.Tag             = objSmsConst.SMPP_TLV_RECEIPTED_MESSAGE_ID;
                objAxTlv.ValueAsString = objIn.Reference;

                objTlv.TlvType    = SimTlv.TlvTypes.HEX;
                objTlv.TypedValue = objAxTlv.ValueAsHexString;
                objTlv.HexValue   = objTlv.TypedValue;
                objDlr.Tlvs.Add(objTlv);
            }

            // NOTE: submit date and done date are the same!

            string strExcerpt       = objIn.Body.Substring(0, Math.Min(objIn.Body.Length, 60));
            int    iNumSmsDelivered = nStatusCode == objSmsConst.SMPP_MESSAGESTATE_DELIVERED ? 1: 0;
            string strBody          = string.Format("id:{0} sub:001 dlvrd:{1:D3} submit date:{2:yyMMddHHmmss} done date:{2:yyMMddHHmmss} stat:{3} err:000 text:{4}",
                                                    objIn.Reference, iNumSmsDelivered, DateTime.Now, strStatusText, strExcerpt);

            // Complete delivery report formatting
            objDlr.IsDeliveryReport = true;
            objDlr.Body             = strBody.Substring(0, Math.Min(strBody.Length, 160));

            return(objDlr);
        }