zabsalahid / serialport-gsm

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

USSD response #125

Open Mohammed34B opened 1 year ago

Mohammed34B commented 1 year ago

hi I'm trying to get an order USSD When you use this code gsmModem.sendUSSD("*200#"); gsmModem.on('onNewIncomingUSSD', (data)=>{ console.log('onNewIncomingUSSD', {data}); }); you get: {"status":"Incoming USSD","data":{"text":"틲簞캗ꤕꪰ뻩졝漗偹万뇋ꂕⰶꯑ抳ᥭ⛋臊璐ﵝ龃૴呷菆\ud94dܑ폭ヨ練韉Ȇ퍉쯴睝๺셠㫤덙Ѐ","follow":"further action required","followCode":"1"}}

Apollon77 commented 1 year ago

Please add a logger to the options and post full log

borokovic commented 1 year ago

I solved this with let text; if(splitted_newpart.length>1){ let decodable = /\"(.*?)\"/g.exec(splitted_newpart[1]) if(decodable.length>1){ //text = Helper.decode16Bit(decodable[1]); text = Helper.decode7Bit(decodable[1]); }else{ text = splitted_newpart[1] } } at ussd.js

KillerJulian commented 10 months ago

What is the value of the variable decodable?

borokovic commented 8 months ago

I just change text = Helper.decode16Bit(decodable[1]); to text = Helper.decode7Bit(decodable[1]) at ussd.js file.