Git Product home page Git Product logo

Comments (25)

Kindlysertir avatar Kindlysertir commented on August 19, 2024 1

checkAsyncUserPass() is custom function, you can define it by yourself:

function checkAsyncUserPass(system_id, password, callback) {
    if (system_id === 'wavesmpp1' && password === 'wavesmp1') {
        callback(0); // no error
    } else {
        callback(1); // error
    }
}

Ok, thanks. But now i gat the error like :

Error: Cannot find module 'smpp'
at Function.Module._resolveFilename (module.js:476:15)
at Function.Module._load (module.js:424:25)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object. (/root/smppserver.js:1:74)
at Module._compile (module.js:577:32)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

I believe you have in mind sender value which is set as source_addr:

session.submit_sm({
destination_addr: '<phone_number>',
source_addr: '<sender/shortcode>',
short_message: '<SMS_body>'
});

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

var smpp = require('smpp');
var server = smpp.createServer(function(session) {
session.on('bind_transceiver', function(pdu) {
// we pause the session to prevent further incoming pdu events,
// untill we authorize the session with some async operation.
session.pause();
checkAsyncUserPass(pdu.system_id, pdu.password, function(err) {
if (err) {
session.send(pdu.response({
command_status: smpp.ESME_RBINDFAIL
}));
session.close();
return;
}
session.send(pdu.response());
session.resume();
});
});
});
server.listen(2775);

// Using This to create server please Hellp

Getting Error Of checkAsyncUserPass is not defined

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

It's not clear in this code snippet whether you have defined such function checkAsyncUserPass

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

i have copy this fuction from README and there was exact the same

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

This example is quite old and misleading. My suggestion is not to use checkAsyncUserPass() and do your own actions as successful bind_transceiver callback is all what you need - once it's fired up, you may send/receive messages.

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

ok Thankss And Can Transeceiver set to be multiple Connection at same time

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

Well transceiver mode is dedicated for bidirectional communication, which means the same session supports both transmitter (sending messages) & receiver (receiving messages) modes. In other words, you don't have to initiate two connections at the same time to fully support communication with SMSC.

It's enough to maintain single session with SMSC for sending multiple messages and handling received ones at the same time. But if you want to handle multiple sessions to the same SMSC make sure SMSC configuration allows you to do that. In most cases, it should be restricted to 1-2 sessions only with different TPS, etc.

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

as My Connection is always open using node server.js . But At Same TIme How Can I Send Message

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

It's given in README as an example, you need to use session.submit_sm();

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

but the sms number and message are dynamic as it would be send by android
how can i send SMS then

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

When I Get message Id that means Message has been Sent

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

Not really. It means SMSC has accepted your request to send message. Later SMSC will notify you whether SMS has been successfully sent to user or not - that's delivery report. You should handle it upon received PDU with:

session.on('deliver_sm', function(pdu) {
   // parse/handle PDU
   session.send(pdu.response());
});

PDU example of deliveyr report is:

{
    command_length: 144,
    command_id: 5,
    command_status: 0,
    sequence_number: 33576672,
    command: 'deliver_sm',
    service_type: '',
    source_addr_ton: 1,
    source_addr_npi: 1,
    source_addr: '<phone>',
    dest_addr_ton: 2,
    dest_addr_npi: 1,
    destination_addr: '<schortcode>',
    esm_class: 4,
    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:'id:37bc0c3 sub:001 dlvrd:000 submit date:1705190504 done date:1705190504 stat:DELIVRD err:000'
    }
}

Here stat:DELIVRD indicates SMS has successfully reached destination.

from node-smpp.

HemanParbhakar avatar HemanParbhakar commented on August 19, 2024

Means i have to Implement this on Reciever

from node-smpp.

MukitCSTE avatar MukitCSTE commented on August 19, 2024

How to send

SMSC --> ESME

i mean can i work like this

session.deliver_sm({
command_length: 144,
command_id: 5,
command_status: 0,
sequence_number: 33576672,
command: 'deliver_sm',
service_type: '',
source_addr_ton: 1,
source_addr_npi: 1,
source_addr: 'Custom SMPP Service',
dest_addr_ton: 2,
dest_addr_npi: 1,
destination_addr: 'Client',
esm_class: 4,
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:'id:123 sub:001 dlvrd:000 submit date:1705190504 done date:1705190504 stat:DELIVRD err:000'
}
}, function(pdu) {
if (pdu.command_status == 0) {
// Message successfully sent

			console.log('The Delivary report  is  successfully sent');
		}
	});

from node-smpp.

MukitCSTE avatar MukitCSTE commented on August 19, 2024

session.deliver_sm it's working finally . Thanks to all :)

from node-smpp.

Kindlysertir avatar Kindlysertir commented on August 19, 2024

So, how can i does cuz i have this error :

checkAsyncUserPass('wavesmpp1', 'wavesmp1', function(err) {
^

ReferenceError: checkAsyncUserPass is not defined
at Session. (/root/smppserver.js:7:9)
at emitOne (events.js:96:13)
at Session.emit (events.js:188:7)
at Session.extractPDUs (/root/node_modules/smpp/lib/smpp.js:67:8)
at emitNone (events.js:86:13)
at Socket.emit (events.js:185:7)
at emitReadable
(_stream_readable.js:432:10)
at emitReadable (_stream_readable.js:426:7)
at readableAddChunk (_stream_readable.js:187:13)
at Socket.Readable.push (_stream_readable.js:134:10)

from node-smpp.

Kindlysertir avatar Kindlysertir commented on August 19, 2024

The checkAsyncUserPass is not defined for me.
Please i need a help !

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

checkAsyncUserPass() is custom function, you can define it by yourself:

function checkAsyncUserPass(system_id, password, callback) {
    if (system_id === 'wavesmpp1' && password === 'wavesmp1') {
        callback(0); // no error
    } else {
        callback(1); // error
    }
}

from node-smpp.

ritmas avatar ritmas commented on August 19, 2024

function checkAsyncUserPass(pdu.system_id, pdu.password, function(err) {

You've defined function parameters as pdu object properties, but I assume you're passing them as variables. Double check on the code itself on how you're calling checkAsyncUserPass().

from node-smpp.

Kindlysertir avatar Kindlysertir commented on August 19, 2024

function checkAsyncUserPass(pdu.system_id, pdu.password, function(err) {

You've defined function parameters as pdu object properties, but I assume you're passing them as variables. Double check on the code itself on how you're calling checkAsyncUserPass().

The error is : Error: Cannot find module 'smpp'

Please how can i fixe it ?

from node-smpp.

Kindlysertir avatar Kindlysertir commented on August 19, 2024

I install smpp like : npm install smpp it work. Thanks !

from node-smpp.

Kindlysertir avatar Kindlysertir commented on August 19, 2024

But i can not connect to it.

from node-smpp.

juliangut avatar juliangut commented on August 19, 2024

@Kindlysertir have you required the module in the code?

var smpp = require('smpp');

from node-smpp.

juliangut avatar juliangut commented on August 19, 2024

It's been almost 3 months since last answer, I assume we can close this issue. Feel free to comment again if needed

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.