zabsalahid / serialport-gsm

SerialPort-GSM is a simplified plugin for communicating with gsm modems. (Primarily for sms) (Focused in PDU mode)
MIT License
88 stars 46 forks source link

Wrong phone number when using sendSMS function #129

Closed vumail159951 closed 11 months ago

vumail159951 commented 1 year ago

Example send SMS:

// no bug code
const smsPdu = require('node-sms-pdu');

const number = '999'; // Telephone number (in this case, national number)
const message = 'Hello'; // Text

const pdu_list = smsPdu.generateSubmit(number, message);
console.log(pdu_list[0].hex);
// this return 000100038199F9000005C8329BFD06 {phone: "999"}

// bug code
const pdu = require('node-pdu');
let submit = pdu.Submit();

submit.setAddress(number);
submit.setData(message);

let parts = submit.getParts();
console.log(parts[0].toString());
// this return 000100039199F9000005C8329BFD06, {phone: "+999"}

using the old node-pdu, the function return error: CMS ERROR +8 Please review and use node-sms-pdu https://github.com/tiagfernandes/serialport-gsm

KillerJulian commented 1 year ago

I gues it's a bug from node-pdu and you should create the issue there too. I should also fix the bug in my version of node-pdu.

I believe that the project owner will not decide to switch to another library, as node-pdu offers more possibilities.

vumail159951 commented 1 year ago

Thank you, I will edit the node-pdu to work around when waiting for the fix

KillerJulian commented 1 year ago

Hi, it was not a bug. The SCA type should be set manually. I have added a new feature with commit https://github.com/jackkum/node-pdu/pull/25/commits/14972ead2fb8dc05b99777c0f568629234a41669 that will set the SCA type be automatically for the address. Alternatively, I have added a function in my TypeScript rewrite that allows you to send your own submits (with cutom SCA types).

Currently, you have no possibility to correct the "error" with this library

KillerJulian commented 1 year ago

@vumail159951 your issue will be fixed if the owner of this library update the node-pdu version to 2.0.0 or better he want merge my pull request