Commit 761e213ec49c3114dc3f3c634e3bcb94882f86a6

Authored by Adhidarma Hadiwinoto
1 parent 0a21f5dfb2
Exists in master

USSD pakai parser delimiter

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -316,14 +316,16 @@ async function sendSMS(destination, msg) {
316 316 */
317 317 function executeUSSD(code, includeCUSD2) {
318 318 return new Promise(async (resolve) => {
319   - const parserMain = new ParserRegex({ regex: REGEX_WAIT_FOR_OK_OR_ERROR });
  319 + const parserMain = new ParserReadline({ delimiter: '\r\n' });
  320 + // const parserMain = new ParserRegex({ regex: REGEX_WAIT_FOR_OK_OR_ERROR });
320 321 parserMain.on('data', (data) => {
321 322 port.unpipe(parserMain);
322 323 mutex.releaseLockWaitForSubCommand();
323 324 resolve(data);
324 325 });
325 326  
326   - const parserCUSD2 = new ParserRegex({ regex: REGEX_WAIT_FOR_OK_OR_ERROR });
  327 + const parserCUSD2 = new ParserReadline({ delimiter: '\r\n' });
  328 + // const parserCUSD2 = new ParserRegex({ regex: REGEX_WAIT_FOR_OK_OR_ERROR });
327 329 parserCUSD2.on('data', () => {
328 330 port.unpipe(parserCUSD2);
329 331 mutex.releaseLockWaitForSubCommand();