Skip to content
New issue

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

Error: expected multipart SIPREC body #51

Open
thieplehuu opened this issue Jan 19, 2022 · 3 comments
Open

Error: expected multipart SIPREC body #51

thieplehuu opened this issue Jan 19, 2022 · 3 comments

Comments

@thieplehuu
Copy link

I run test with command : npm test
and i receiver error: expected multipart SIPREC body
i was debuged and i saw error in file test/parser.js line 35
////
const segments = data.split(\n${delimiter});
const regex = /.Content-Type:\s+(.)\n.\n([\s\S.])$/;
const req = { payload: [] };

  for (let i = 1; i < segments.length; i++) {
    const arr = regex.exec(segments[i]);
    if (!arr) {
      continue;
    }
    req.payload.push({ type: arr[1], content: arr[2] });
  }

///
arr alway null
so payload null and show error.
please help me. thank a alot.

@davehorton
Copy link
Collaborator

running npm test on the main branch works successfully for me. Perhaps you checked out the files such that line endings were changed or something? Please show the output of the failing test

@thieplehuu
Copy link
Author

Capture
this is my screen log when i run test.
i use node v12.22.9

@tommyNy
Copy link

tommyNy commented Jan 26, 2022

@thieplehuu Parser works for me

test('parser: Broadworks SIPREC payload', (t) => {
parseAndVerifyPayload('broadworks-offer-2.txt', '--foobar', t) ;
}) ;

tniemczak@debian:~/drachtio-siprec-recording-server$ npm test

drachtio-siprec-recording-server@2.0.2 test
NODE_ENV=test node test/ | ./node_modules/.bin/tap-spec

parser: Broadworks SIPREC payload

✔ parsed first SDP
✔ parsed second SDP
✔ parsed caller aor
✔ parsed session id 6ce942a2-1490-4eea-9a14-61e32ca706ba
✔ parsed recording session id: 00FA0800705D4C5DCAAC41

total: 5
passing: 5
duration: 244ms

tniemczak@debian:~/drachtio-siprec-recording-server$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants