drachtio / drachtio-siprec-recording-server

SIPREC recording server based on drachtio and rtpengine
MIT License
81 stars 31 forks source link

Error: expected multipart SIPREC body #51

Open thieplehuu opened 2 years ago

thieplehuu commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

tommyNy commented 2 years ago

@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$