farhadi / node-smpp

SMPP client and server implementation in node.js
MIT License
417 stars 177 forks source link

Delivery response in SMPP - Node JS #215

Closed ShanthiniMM closed 1 year ago

ShanthiniMM commented 2 years ago

I am doing a project in SMPP in Node JS. I have successfully sent SMS using SMPP but I am receiving responses of previously sent SMS reports in deliver_sm, not the currently sent SMS response. How can I solve this?

code

    session.submit_sm(
      {
        source_addr: source_addr,
        source_addr_ton: source_addr_ton,
        dest_addr_npi: dest_addr_npi,
        dest_addr_ton: dest_addr_ton,
        destination_addr: mobile_no,
      },
      function (submit_pdu) {
        console.log(submit_pdu);
        session.on("deliver_sm", function (deliver_pdu) {
          console.log(deliver_pdu.short_message);
        });
      }
    );

response

     PDU {
     command_length: 53,
      command_id: 2147483652,
      command_status: 0,
      sequence_number: 2,
      command: 'submit_sm_resp',
      message_id: '123XXXXXXXXXXXXXXXXXX'
    }

    **As I am expecting 123XXXXXXXXXXXXXXXXXX, but I am getting the below response which is sending previously.**

    {
      message: 'id:8XXXXXXXXXXXXX sub:001 dlvrd:000 submit date:220704105916 done date:220704105941 stat:REJECTD err:954 text:'
    }
    {
      message: 'id:2XXXXXXXXXXXXX sub:001 dlvrd:000 submit date:220704105546 done date:220704105611 stat:REJECTD err:637 text:'
    }
    {
      message: 'id:6xxxxxxxxxxxxxxxx sub:001 dlvrd:000 submit date:220704105533 done date:220704105541 stat:REJECTD err:637 text:'
    }
    {
      message: 'id:5XXXXXXXXXXXXXXXX sub:001 dlvrd:001 submit date:220704104257 done date:220704104302 stat:DELIVRD err:000 text:'
    }
    {
      message: 'id:9XXXXXXXXXXXXXXXXXXX sub:001 dlvrd:000 submit date:220704105753 done date:220704105811 stat:REJECTD err:954 text:'
    }
    {
      message: 'id:7XXXXXXXXXXXXXXXX sub:001 dlvrd:000 submit date:220704105651 done date:220704105711 stat:REJECTD err:954 text:'
    }

@farhadi @lahirutm

lahirutm commented 2 years ago

delivery receipts are sending from your provider once they delivered. It will take some time to receive. You are getting now is already delivered ones. Eventually you will get last one withing few seconds (or even bit later, because it needs to deliver).

ShanthiniMM commented 2 years ago

Thank you @lahirutm. How can I get the response by sending message_id. If any methods are available, kindly let me know.

guicuton commented 2 years ago

Thank you @lahirutm. How can I get the response by sending message_id. If any methods are available, kindly let me know.

If you meant to get the message response sending the message_id for your provider you need check with them the supported PDU to achieve this.

If am I not wrong the PDU for this is query_sm

juliangut commented 1 year ago

Closing due to inactivity. Last comment points in the right direction to query provider for messages