At first I'm sorry for the previous similar issue I closed it by mistake please someone who can delete it.
I have tested this code for two devices, but it works without any problems for one device, and for the other it only sends an SMS once, and gives a timeout error for the second time.
var serialportgsm = require('serialport-gsm');
var modem = serialportgsm.Modem();
var options = {
baudRate: 115200,
dataBits: 8,
stopBits: 1,
parity: 'none',
rtscts: false,
xon: false,
xoff: false,
xany: false,
autoDeleteOnReceive: true,
enableConcatenation: true,
incomingCallIndication: true,
incomingSMSIndication: true,
pin: '',
customInitCommand: '',
logger: console
};
modem.open(com, options, function (err, result) {
if (err) {
console.log("error in open modem", err);
}
if (result) {
console.log("modem open", result);
}
});
modem.on('open', function () {
modem.initializeModem(function (msg, err) {
if (err) {
console.log('Error Initializing Modem - ', err);
} else {
console.log('InitModemResponse: ', JSON.stringify(msg));
modem.setModemMode(function () {
var i = 0;
modem.sendSMS(Mobile, Message, false, function (result) {
i++;
if(i == 2){
modem.close(function () {
console.log('modem closed')
});
}
});
}, 'PDU');
}
})
});
I also tried not to close the modem after sending the first message, but it still failed to send for the second time on the same device.
Both devices are from the same company and the same model, only their versions are different.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
At first I'm sorry for the previous similar issue I closed it by mistake please someone who can delete it.
I have tested this code for two devices, but it works without any problems for one device, and for the other it only sends an SMS once, and gives a timeout error for the second time.
I also tried not to close the modem after sending the first message, but it still failed to send for the second time on the same device.
Both devices are from the same company and the same model, only their versions are different.
Can someone help me ? thanks.