Git Product home page Git Product logo

Comments (7)

luishdez avatar luishdez commented on July 19, 2024

+1 Yep some docs about receiving delivery reports will be nice.

var session = smpp.connect('smpp0.provider.com', 8000);

session.bind_transceiver({
  system_id: 'xxxx',
  password: 'xxxxx'
}, function(pdu) {
  if (pdu.command_status == 0) {

    /**
     * This submit one SMS and set always sent Derlivery Report with DR 1
     */
    session.submit_sm({
      registered_delivery: 1,
      destination_addr: '+34676300300',
      source_addr: 'SENDERXX',
      short_message: 'Hello Buddy'
    }, function(pdu) {
      if (pdu.command_status == 0) {
        console.log('id: %s', pdu.message_id);
      }
    });

    /**
     * Add event listener for DR or SMS Reception. This will listen to receive
     * messages. It will be executed once for each received message
     *
     * This event can be used to receive regular SMS as well. The difference
     * between SMS and DLRs is that DLRs have (pdu.esm_class == 4)
     */
    session.on('deliver_sm', function(pdu) {
      console.log(pdu)
      if (pdu.esm_class == 4) {
        var shortMessage = pdu.short_message;
        console.log('Received DR: %s', shortMessage.trim());
        session.send(pdu.response());
      }
    });
  }
});

from node-smpp.

mamoste avatar mamoste commented on July 19, 2024

thank you, great!

from node-smpp.

mamoste avatar mamoste commented on July 19, 2024

So what do I need to send SMS to multiple numbers?

from node-smpp.

luishdez avatar luishdez commented on July 19, 2024

You have to submit_sm for each SM

    session.submit_sm({
      registered_delivery: 1,
      destination_addr: '+34676300300',
      source_addr: 'SENDERXX',
      short_message: 'Hello Buddy'
    }, function(pdu) {
      if (pdu.command_status == 0) {
        console.log('id: %s', pdu.message_id);
      }

from node-smpp.

farhadi avatar farhadi commented on July 19, 2024

Thanks @luishdez for the sample code!

from node-smpp.

Ciao121 avatar Ciao121 commented on July 19, 2024

@luishdez what does
if (pdu.esm_class == 4)
means?

from node-smpp.

luishdez avatar luishdez commented on July 19, 2024

It's defined in the protocol manual https://smpp.org/SMPP_v5.pdf

from node-smpp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.