node.jssubmitsmpp

SMPP send Message received different result in PDU - Confuse In Results


Implemented In Nodejs using node-smpp library and Selenium SMPPSim Simulator

const smpp = require('smpp');
const session = new smpp.Session({host: 'localhost', port: 1234});

session.on('connect', () => {
    isConnected = true;
    session.bind_transceiver({
        system_id: "SYSTEMID",
        password: "PASSWORD",
    }, (pdu) => {
        if (pdu.command_status == 0) {
            console.log('smpp connected !')
        }
    })
})


//**all pdu listener**
session.on('pdu', (pdu)=>{
    console.log(pdu)
})


function sendMessage(from, to, text){

    from = `+${from}`
    to = `+${to}`

    session.submit_sm({
        source_addr:      from,
        destination_addr: to,
        short_message:    text
    }, function(pdu) {
        console.log(pdu)
        if (pdu.command_status == 0) {
            console.log(pdu.message_id);
        }
    });
}

sendMessage("1111", "2222", "Hello World!")

Output when sendMessage() method call:

PDU {
  command_length: 18,
  command_id: 2147483652,
  command_status: 0,
  sequence_number: 2,
  command: 'submit_sm_resp',
  message_id: '3' }

Here i'm using SMPPSim MO Injection Form Output: when message sent selenium simulator:

PDU {
  command_length: 63,
  command_id: 5,
  command_status: 0,
  sequence_number: 8,
  command: 'deliver_sm',
  service_type: '',
  source_addr_ton: 1,
  source_addr_npi: 1,
  source_addr: '111111',
  dest_addr_ton: 1,
  dest_addr_npi: 1,
  destination_addr: '222222',
  esm_class: 0,
  protocol_id: 0,
  priority_flag: 0,
  schedule_delivery_time: '',
  validity_period: '',
  registered_delivery: 0,
  replace_if_present_flag: 0,
  data_coding: 0,
  sm_default_msg_id: 0,
  short_message: { message: 'Hello from SMPPSim' } }

confused between both result, if message sent using sendMessage() method then why its returning only submit_sm_resp, is it because of local machine ?? or something else ?? need help to understaning this behaviour.


Solution

  • I am not familiar with node-smpp or Selenium SMPPSim Simulator but they still use the SMPP protocol.

    Your first output, from "sendMessage()", is the submit_sm_resp which is expected when one calls submit_sm.

    However the second response you provided seems to be uncommon. As per the SMPP protocol found here I don't see any response types that natively return all the fields you have listed.

    It might be possible that Selenium sends some of the parameters as TLV (Tagged Length Value) parameters or they just return you some extended data set built up on their side. Their documentation or source code might shed more light, if available.

    On a side note, don't expect consistency of the SMPP protocol by 3rd party providers (ESMEs) or Short Message Service Center (SMSC). Even when I directly integrated into 4 cell service providers there were small discrepancies between them that required bespoke development.