mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fix siprec to remap sdp base on participant label (#587)
* fix siprec to remap sdp base on participant label * fix
This commit is contained in:
@@ -97,8 +97,12 @@ const parseSiprecPayload = (req, logger) => {
|
|||||||
obj[`${prefix}participantstreamassoc`].forEach((ps) => {
|
obj[`${prefix}participantstreamassoc`].forEach((ps) => {
|
||||||
const part = participants[ps.$.participant_id];
|
const part = participants[ps.$.participant_id];
|
||||||
if (part) {
|
if (part) {
|
||||||
part.send = ps[`${prefix}send`][0];
|
if (ps.hasOwnProperty(`${prefix}send`)) {
|
||||||
part.recv = ps[`${prefix}recv`][0];
|
part.send = ps[`${prefix}send`][0];
|
||||||
|
}
|
||||||
|
if (ps.hasOwnProperty(`${prefix}recv`)) {
|
||||||
|
part.recv = ps[`${prefix}recv`][0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -109,9 +113,9 @@ const parseSiprecPayload = (req, logger) => {
|
|||||||
obj[`${prefix}stream`].forEach((s) => {
|
obj[`${prefix}stream`].forEach((s) => {
|
||||||
const streamId = s.$.stream_id;
|
const streamId = s.$.stream_id;
|
||||||
let sender;
|
let sender;
|
||||||
for (const [k, v] of Object.entries(participants)) {
|
for (const v of Object.values(participants)) {
|
||||||
if (v.send === streamId) {
|
if (v.send === streamId) {
|
||||||
sender = k;
|
sender = v;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,9 +125,15 @@ const parseSiprecPayload = (req, logger) => {
|
|||||||
|
|
||||||
sender.label = s[`${prefix}label`][0];
|
sender.label = s[`${prefix}label`][0];
|
||||||
|
|
||||||
if (-1 !== ['1', 'a_leg', 'inbound'].indexOf(sender.label)) {
|
if (-1 !== ['1', 'a_leg', 'inbound', '10'].indexOf(sender.label)) {
|
||||||
opts.caller.aor = sender.aor ;
|
opts.caller.aor = sender.aor;
|
||||||
if (sender.name) opts.caller.name = sender.name;
|
if (sender.name) opts.caller.name = sender.name;
|
||||||
|
// Remap the sdp stream base on sender label
|
||||||
|
if (!opts.sdp1.includes(`a=label:${sender.label}`)) {
|
||||||
|
const tmp = opts.sdp1;
|
||||||
|
opts.sdp1 = opts.sdp2;
|
||||||
|
opts.sdp2 = tmp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
opts.callee.aor = sender.aor ;
|
opts.callee.aor = sender.aor ;
|
||||||
|
|||||||
Reference in New Issue
Block a user