TelecomsXChange - SMPP Client Sample Configuration


NodJS SMPP Client sample configuration with TelecomsXChange SMPP Exchange .


Required Packages {Package.json} :


{
  "name": "smpp",
  "version": "1.0.0",
  "description": "",
  "main": "proxy.js",
  "dependencies": {
    "smpp": "^0.3.1",
    "unique-random": "^2.0.0"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}


Sample Working SMPP Client:


var smpp = require('smpp');
var session = smpp.connect('smpp://smpp01.telecomsxchange.com:2776');
session.bind_transceiver({
  system_id: '[USERNAME]',
  password: '[PASSWORD]'
}, function(pdu) {
  if (pdu.command_status == 0) {
    // Successfully bound
    session.submit_sm({
      destination_addr: '962790320000',
      source_addr: 'O2App',
      registered_delivery: 1,
      short_message: 'Verification Code is X747494'
 
    
    }, function(pdu) {
      if (pdu.command_status == 0) {
        // Message successfully sent
        console.log("message sent OK");
      } else {
        console.log("message sending failed");
      }
      console.log(pdu);
    });

    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);
               session.send(pdu.response());
          }
        });

                session.on('pdu', function(pdu) {
                        console.log("GOT PDU ", pdu)
                });



  }
});