glushkovds / php-smpp

WIP. Implementation SMPP v3.4 protocol. Includes sending and listening USSD.
MIT License
19 stars 11 forks source link

I implemented Submit_Multi but nothing is delivered... Experts help needed #23

Open momostafa opened 3 months ago

momostafa commented 3 months ago

Hi, I implemented Submit_Multi but nothing is delivered. Experts help needed

Thanks in advance for your time and support.

public function pack() {
        $packedData = pack(
            'a1cca' . (strlen($this->source_addr) + 1).'c',
            $this->service_type,
            $this->source_addr_ton,
            $this->source_addr_npi,
            $this->source_addr, //SMSInfo
            $this->number_of_dests);

        $dest = '';

        foreach($this->destinations as $destData) {
            $dest_data = new Address($destData, SMPP::TON_INTERNATIONAL, SMPP::NPI_E164);

            $destAdrr = $dest_data->value.chr(0); // output 447234567893\x00
            $dest_len = strlen($destAdrr);
            $spec = "cca{$dest_len}";
            $dest .= pack($spec, $dest_data->ton, $dest_data->npi, $destAdrr);
            //dd($destAdrr);
        }

        //$packedData .= pack('a'.(strlen($dest)+1), $dest);
        $packedData .= pack('a'. strlen($dest)
        , $dest);

        $packedData .= pack(
            'cc'.($this->schedule_delivery_time ? 'a16x' : 'a1') . ($this->validity_period ? 'a16x' : 'a1')
            .'cccccca'.(strlen($this->short_message)+($this->nullTerminateOctetstrings ? 1 : 0)),            
            $this->esm_class,
            $this->protocol_id,
            $this->priority_flag,
            $this->schedule_delivery_time,
            $this->validity_period,
            $this->registered_delivery,
            $this->replace_if_present_flag,
            $this->data_coding,
            $this->sm_default_msg_id,
            $this->sm_length,
            $this->short_message //Test Multi SMS
        );

        return $packedData;
    }

PDU submitted to the SMSC

pdu: 00000052000000210000000000000003000500534D53496E666F00020101343437323334353637383933000101343437323334353637383932000000300000010000000E54657374204D756C746920534D53
00000052 | 00000021 | 00000000 | 00000003 | 00 | 05 | 00 | 534D53496E666F00 | 02 | 01 | 01 | 34343732333435363738393300 | 01 | 01 | 34343732333435363738393200 | 00 | 00 | 30 | 00 | 00 | 01 | 00 | 00 | 00 | 0E | 54657374204D756C746920534D53 |   -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | --
command_length: 00000052 (82)
command_id: 00000021 (submit_multi)
command_status: 00000000 (n/a)
sequence_number: 00000003 (3)
service_type: 00 (null)
source_addr_ton: 05 (Alphanumeric)
source_addr_npi: 00 (Unknown)
source_addr: 534D53496E666F00 (SMSInfo)
num_dest_addr: 02 (2)
dest_addr_ton: 01 (International)
dest_addr_npi: 01 (ISDN (E163/E164))
dest_addr: 34343732333435363738393300 (447234567893)
dest_addr_ton: 01 (International)
dest_addr_npi: 01 (ISDN (E163/E164))
dest_addr: 34343732333435363738393200 (447234567892)
esm_class: 00 (00000000)
esm_class_gsm_feat: 00 (No specific features selected)
esm_class_message_type: 0000 ()
esm_class_message_mode: 00 ()
protocol_id: 00 (SME to SME protocol)
priority_flag: 30 (Reserved)
schedule_delivery_time: 00 (null)
validity_period: 00 (null)
registered_delivery: 01 (00000001)
registered_delivery_smsc_delivery_receipt: 01 (SMSC Delivery Receipt requested where final delivery outcome is delivery success or failure)
registered_delivery_sme_originated_acknowledgement: 00 (No recipient SME acknowledgment requested (default))
registered_delivery_intermediate_notification: 0 (No Intermediate notification requested (default))
replace_if_present_flag: 00 (Do not replace (default))
data_coding: 00 (no message class, text uncompress, SMSC Default Alphabet)
sm_default_msg_id: 00 (0)
sm_length: 0E (14)
short_message:
54657374204D756C746920534D53

T e s t M u l t i S M S
optional_param: