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

Failure to retrieve phone number. #121

Open choleaoum opened 1 year ago

choleaoum commented 1 year ago

I'm using an EC25 GSM module and the GetOwnNumber function is not working correctly because it's expecting a name field wrapped in quotations. I am unsure if it matters but I do have PDU mode enabled in the modem.

The following error is being thrown,

TypeError: Cannot read properties of null (reading '1') at item.logic (\node_modules\serialport-gsm\lib\functions\modem.js:1210:54)

Line 1210: name: /"(.*?)"/g.exec(splitResult[0])[1],

The following variable splitResultreturns [ '+CNUM: ', '"15621231234"', '129' ]

Apollon77 commented 1 year ago

Please provide a "Logger" and provide a debug log. The question is which data are coming back that can not be parsed to know how to handle that case

Apollon77 commented 1 year ago

Additionally Please try out from my current fork branch. I adjusted the logic there to handle your case without a crash ... but would be still interesting whats the data level.

Please use npm i Apollon77/serialport-gsm#sendfix to install the version from my branch and give feedback.

choleaoum commented 1 year ago

Additionally Please try out from my current fork branch. I adjusted the logic there to handle your case without a crash ... but would be still interesting whats the data level.

Please use npm i Apollon77/serialport-gsm#sendfix to install the version from my branch and give feedback.

Thank you, I will test the branch and provide feedback.

Apollon77 commented 1 year ago

@choleaoum Hi, did you had any chance to check it?