0

私は EasySMPP と呼ばれる c# API を使用しています。単一の SMS を送信するのには非常に優れています。大きな SMS を送信するのにも適していますが、受信者はメッセージを個別に取得します。これは意味がありません。私が探しているのは、PDU を変更する方法です。 UDH情報を追加できること。

UHD 情報を追加するにはどうすればよいですか。API の SubmitSM メソッドは次のとおりです。

public int SubmitSM
(
byte sourceAddressTon, 
byte sourceAddressNpi, 
string sourceAddress,
byte destinationAddressTon,
byte destinationAddressNpi, 
destinationAddress, 
byte esmClass, 
byte protocolId,
byte priorityFlag, 
DateTime sheduleDeliveryTime, 
DateTime validityPeriod, 
byte registeredDelivery,
byte replaceIfPresentFlag,
byte dataCoding,
byte smDefaultMsgId,
byte[] message)

 {
 try
 {

                byte[] _destination_addr;
                byte[] _source_addr;
                byte[] _SUBMIT_SM_PDU;
                byte[] _shedule_delivery_time;
                byte[] _validity_period;
                int _sequence_number;
                int pos;
                byte _sm_length;

                _SUBMIT_SM_PDU = new byte[KernelParameters.MaxPduSize];

                ////////////////////////////////////////////////////////////////////////////////////////////////
                /// Start filling PDU                       

                Tools.CopyIntToArray(0x00000004, _SUBMIT_SM_PDU, 4);
                _sequence_number = smscArray.currentSMSC.SequenceNumber;
                Tools.CopyIntToArray(_sequence_number, _SUBMIT_SM_PDU, 12);


                pos = 16;
                _SUBMIT_SM_PDU[pos] = 0x00; //service_type
                pos += 1;
                _SUBMIT_SM_PDU[pos] = sourceAddressTon;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = sourceAddressNpi;
                pos += 1;
                _source_addr = Tools.ConvertStringToByteArray(Tools.GetString(sourceAddress, 20, ""));
                Array.Copy(_source_addr, 0, _SUBMIT_SM_PDU, pos, _source_addr.Length);
                pos += _source_addr.Length;
                _SUBMIT_SM_PDU[pos] = 0x00;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = destinationAddressTon;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = destinationAddressNpi;
                pos += 1;
                _destination_addr = Tools.ConvertStringToByteArray(Tools.GetString(destinationAddress, 20, ""));
                Array.Copy(_destination_addr, 0, _SUBMIT_SM_PDU, pos, _destination_addr.Length);
                pos += _destination_addr.Length;
                _SUBMIT_SM_PDU[pos] = 0x00;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = esmClass;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = protocolId;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = priorityFlag;
                pos += 1;
                _shedule_delivery_time = Tools.ConvertStringToByteArray(Tools.GetDateString(sheduleDeliveryTime));
                Array.Copy(_shedule_delivery_time, 0, _SUBMIT_SM_PDU, pos, _shedule_delivery_time.Length);
                pos += _shedule_delivery_time.Length;
                _SUBMIT_SM_PDU[pos] = 0x00;
                pos += 1;
                _validity_period = Tools.ConvertStringToByteArray(Tools.GetDateString(validityPeriod));
                Array.Copy(_validity_period, 0, _SUBMIT_SM_PDU, pos, _validity_period.Length);
                pos += _validity_period.Length;
                _SUBMIT_SM_PDU[pos] = 0x00;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = registeredDelivery;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = replaceIfPresentFlag;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = dataCoding;
                pos += 1;
                _SUBMIT_SM_PDU[pos] = smDefaultMsgId;
                pos += 1;

                _sm_length = message.Length > 254 ? (byte)254 : (byte)message.Length;

                _SUBMIT_SM_PDU[pos] = _sm_length;
                pos += 1;
                Array.Copy(message, 0, _SUBMIT_SM_PDU, pos, _sm_length);
                pos += _sm_length;

                Tools.CopyIntToArray(pos, _SUBMIT_SM_PDU, 0);

                Send(_SUBMIT_SM_PDU, pos);

                undeliveredMessages++;
                return _sequence_number;
            }
            catch (Exception ex)
            {
                logMessage(LogLevels.LogExceptions, "SubmitSM | " + ex.ToString());
            }
            return -1;

        }  

どうもありがとう!!!!

4

2 に答える 2