Friday 5 May 2017

Smpp message submit failed with status ESME_RSUBMITFAIL

I am using node-smpp plugin, To send sms using the SMPP.

I can create the session successfully and I am getting success on connection.

Here is my configuration.

var smpp = require('smpp');
var session = new smpp.Session({host: '150.120.36.58', port: 2775});
var didConnect = false;

session.on('connect', function(){
  didConnect = true;

  session.bind_transceiver({
      system_id: 'my-system-id',
      password: 'my-password',
  }, function(pdu) {
    console.log('pdu status', lookupPDUStatusKey(pdu.command_status));
    // the above method is for handling errors
    if (pdu.command_status == 0) {
        console.log('Successfully bound')
    }
  });
})

function lookupPDUStatusKey(pduCommandStatus) {
  for (var k in smpp.errors) {
    if (smpp.errors[k] == pduCommandStatus) {
      return k
    }
  }
}

function connectSMPP() {
  console.log('smpp reconnecting');
  session.connect();
}

session.on('close', function(){
  console.log('smpp disconnected')
  if (didConnect) {
    connectSMPP();
  }
})

session.on('error', function(error){
  console.log('smpp error', error)
  didConnect = false;
})


function sendSMS(from, to, text) {


  from = '+' + from.toString();
  to   = '+' + to.toString();

  session.submit_sm({
      source_addr:      from,
      destination_addr: to,
      short_message:    text
  }, function(pdu) {
    console.log('sms pdu status', lookupPDUStatusKey(pdu.command_status));
      if (pdu.command_status == 0) {
          // Message successfully sent
          console.log(pdu.message_id);
      }
  });
}

sendSMS(fromNumber, toNumber, 'text')

Now, when I send the message I am getting this error,

ESME_RSUBMITFAIL with the status code 69

command_status: 69

Here is my pdu,

pdu PDU {
  command_length: 16,
  command_id: 2147483652,
  command_status: 69,
  sequence_number: 3,
  command: 'submit_sm_resp' }

Please help me regarding this problem. Thank you.



via Sravan

No comments:

Post a Comment