Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ export function matchWephoneSessionWithAcitveCall(sessions, callItem) {
return undefined;
}
const matches = sessions.filter((session) => {
// Strategy 1: use `P-Rc-Api-Ids` header of a webRTC session to match with `telephonySessionId`
// and `partyId` of a call data from presence api.
if (session.partyData && callItem.telephonySessionId) {
const { sessionId } = session.partyData;
if (sessionId === callItem.telephonySessionId) {
return true;
}
return false;
}

// Strategy 2: use `call-id` header of a webRTC session to match with
// `id` of a call data from presence api.
// This approach is unstable since the `id` of a call data from presence api can change before
// the call being accepted.
if (session.callId === callItem.id) {
return true;
}
Expand All @@ -24,6 +38,7 @@ export function matchWephoneSessionWithAcitveCall(sessions, callItem) {
}

/**
* Strategy 3:
* Hack: for conference call, the `to` field is Conference,
* and the callItem's id won't change. According to `sip.js/src/session.js`
* the `InviteClientContext`'s id will always begin with callItem's id.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ export function extractHeadersData(session, headers) {
* "partyId": String,
* "sessionId": String
* }
*
* INFO: partyId is ID of the participant in current Session. Mostly it represents User on the call,
* it could be active participant (talking right now) or already disconnected User,
* e.g. who made a transfer to another person.
* To identify the User who owns the party you need to find owner.extensionId within party.
*/
const data = headers['P-Rc-Api-Ids'][0].raw
.split(';')
Expand Down