Skip to content

Commit

Permalink
bugfix #43: allow for participantstreamassoc with no send or recv chi…
Browse files Browse the repository at this point in the history
…ld elements
  • Loading branch information
davehorton committed Jun 29, 2021
1 parent 4502316 commit b0fb381
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/payload-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ module.exports = function parseSiprecPayload(opts) {
if (`${prefix}participantstreamassoc` in obj) {
obj[`${prefix}participantstreamassoc`].forEach((ps) => {
const part = participants[ps.$.participant_id];
if (part) {
if (part && Array.isArray(ps[`${prefix}send`])) {
part.send = ps[`${prefix}send`][0];
//part.recv = ps[`${prefix}recv`][0];
}
Expand Down
67 changes: 67 additions & 0 deletions test/data/inactive-sdp-offer.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@

--uniqueBoundary
Content-Type: application/sdp
Content-Disposition: session;handling=required

v=0
o=CiscoSystemsSIP-GW-UserAgent 5179 6446 IN IP4 192.168.1.2
s=SIP Call
c=IN IP4 192.168.1.2
t=0 0
m=audio 19254 RTP/AVP 0 101 19
c=IN IP4 192.168.1.2
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:19 CN/8000
a=ptime:20
a=inactive
a=label:1
m=audio 19236 RTP/AVP 0 101 19
c=IN IP4 192.168.1.2
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=rtpmap:19 CN/8000
a=ptime:20
a=inactive
a=label:2

--uniqueBoundary
Content-Type: application/rs-metadata+xml
Content-Disposition: recording-session

<?xml version="1.0" encoding="UTF-8"?>
<recording xmlns="urn:ietf:params:xml:ns:recording:1">
<datamode>complete</datamode>
<session session_id="GZBIusaXEeuxxK1dFIaIyA==">
<sipSessionID>f845891467cf5c2189987435807bd432;remote=1aa1123b8825c906d03681ba23102629</sipSessionID>
<start-time>2021-06-07T07:16:23.618Z</start-time>
</session>
<participant participant_id="GZBIusaXEeuxxa1dFIaIyA==">
<nameID aor="sip:[email protected]">
</nameID>
</participant>
<participantsessionassoc participant_id="GZBIusaXEeuxxa1dFIaIyA==" session_id="GZBIusaXEeuxxK1dFIaIyA==">
<associate-time>2021-06-07T07:16:23.618Z</associate-time>
</participantsessionassoc>
<stream stream_id="GbZGg8aXEeuxy61dFIaIyA==" session_id="GZBIusaXEeuxxK1dFIaIyA==">
<label>1</label>
</stream>
<participant participant_id="GZBIusaXEeuxxq1dFIaIyA==">
<nameID aor="sip:[email protected]">
</nameID>
</participant>
<participantsessionassoc participant_id="GZBIusaXEeuxxq1dFIaIyA==" session_id="GZBIusaXEeuxxK1dFIaIyA==">
<associate-time>2021-06-07T07:16:23.618Z</associate-time>
</participantsessionassoc>
<stream stream_id="GbZGg8aXEeuxzK1dFIaIyA==" session_id="GZBIusaXEeuxxK1dFIaIyA==">
<label>2</label>
</stream>
<participantstreamassoc participant_id="GZBIusaXEeuxxa1dFIaIyA==">
</participantstreamassoc>
<participantstreamassoc participant_id="GZBIusaXEeuxxq1dFIaIyA==">
</participantstreamassoc>
</recording>

--uniqueBoundary--
5 changes: 3 additions & 2 deletions test/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function parseAndVerifyPayload(filename, delimiter, t) {
t.error(err);
});
}

test('parser: Broadworks SIPREC payload', (t) => {
parseAndVerifyPayload('broadworks-offer-2.txt', '--foobar', t) ;
}) ;
Expand All @@ -58,7 +57,6 @@ test('parser: Promcomm SIPREC payload', (t) => {
test('parser: Sonus SIPREC payload', (t) => {
parseAndVerifyPayload('sonus-siprec-offer.txt', '--sonus-content-delim', t) ;
}) ;

test('parser: Cisco SIPREC payload', (t) => {
parseAndVerifyPayload('cisco-siprec-offer.txt', '--uniqueBoundary', t) ;
}) ;
Expand All @@ -71,6 +69,9 @@ test('parser: Connectel SIPREC payload (2)', (t) => {
test('parser: Connectel SIPREC payload (3)', (t) => {
parseAndVerifyPayload('connectel-offer3.txt', '--OSS-unique-boundary-42', t) ;
}) ;
test('parser: inactive sdp', (t) => {
parseAndVerifyPayload('inactive-sdp-offer.txt', '--uniqueBoundary', t) ;
}) ;
test('combiner: sample1)', (t) => {
combineAndVerifyPayloads('sample-sdps.txt', '__split_here__', t) ;
}) ;
Expand Down

0 comments on commit b0fb381

Please sign in to comment.