We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
At first, thanks for your Asterisk's AMI Client library. BTW, I couldn't get an expected result with;
Action: Command Command: core show settings
due to multiple 'Output'.
My temporal workarround is;
diff --git a/lib/rawToObject.js b/lib/rawToObject.js index 2e21fe6..a5bbc67 100644 --- a/lib/rawToObject.js +++ b/lib/rawToObject.js @@ -72,7 +72,10 @@ function rowReducer(resultObj, row){ let pair = row.split(ROW_SPLITTER); if(pair.length > 1){ - resultObj[pair[0].trim()] = pair.slice(1).join(ROW_SPLITTER).trim(); + if (resultObj[pair[0].trim()]) + resultObj[pair[0].trim()] += "\n" + pair.slice(1).join(ROW_SPLITTER).trim(); + else + resultObj[pair[0].trim()] = pair.slice(1).join(ROW_SPLITTER).trim(); } return resultObj; } diff --git a/test/utilsTest.js b/test/utilsTest.js index fb7e305..62856fc 100644 --- a/test/utilsTest.js +++ b/test/utilsTest.js @@ -128,6 +128,22 @@ describe('Event utils test', () => { }); }); + it('with a response includes mutiline \'Output\'s', () => { + let commandStr = [ + 'Response: Success', + 'Message: Command output follows', + 'Output: Version: 14.3.0', + 'Output: Build Options: LOADABLE_MODULES, BUILD_NATIVE, OPTIONAL_API', + 'Output: Maximum calls: Not set' + ].join(CRLF) + CRLF.repeat(2); + + assert.deepEqual(eventUtil.toObject(commandStr), { + Response: 'Success', + Message: 'Command output follows', + Output: 'Version: 14.3.0\nBuild Options: LOADABLE_MODULES, BUILD_NATIVE, OPTIONAL_API\nMaximum calls: Not set' + }); + }); + it('without event\'s raw string', () => { assert.deepEqual(eventUtil.toObject(), {}); });
The text was updated successfully, but these errors were encountered:
No branches or pull requests
At first, thanks for your Asterisk's AMI Client library.
BTW, I couldn't get an expected result with;
due to multiple 'Output'.
My temporal workarround is;
The text was updated successfully, but these errors were encountered: