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 @@ -803,7 +803,7 @@ export default class ConferenceCall extends RcModule {
}

@proxify
async mergeSession({ sessionId, onReadyToMerge }) {
async mergeSession({ sessionId, sessionIdToMergeWith, onReadyToMerge }) {
const session = find(
x => x.id === sessionId,
this._webphone.sessions
Expand All @@ -812,7 +812,7 @@ export default class ConferenceCall extends RcModule {
const isSessionOnhold = session.isOnHold;

const sessionToMergeWith = find(
x => x.id === this.mergingPair.fromSessionId,
x => x.id === (sessionIdToMergeWith || this.mergingPair.fromSessionId),
this._webphone.sessions
);

Expand Down
9 changes: 6 additions & 3 deletions packages/ringcentral-widgets-demo/dev-server/Phone.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export default class BasePhone extends RcModule {
return;
}
if (session.id === fromSessionIdOfCallsOnhold) {
routerInteraction.push('/calls/active');
routerInteraction.replace('/calls/active');
return;
}
}
Expand Down Expand Up @@ -267,8 +267,11 @@ export default class BasePhone extends RcModule {
routerInteraction.push('/calls/active');
return;
}
if (conferenceCall.isMerging) {
routerInteraction.push('/calls/active/');
const confId = conferenceCall.conferences && Object.keys(conferenceCall.conferences)[0];

if (conferenceCall.isMerging && confId) {
const sessionId = conferenceCall.conferences[confId].sessionId;
routerInteraction.push(`/calls/active/${sessionId}`);
return;
}
routerInteraction.goBack();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export default function App({
)}
/>
<Route
path="/conferenceCall/dialer/:fromNumber"
path="/conferenceCall/dialer/:fromNumber/:fromSessionId"
component={routerProps => (
<ConferenceCallDialerPage
params={routerProps.params}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('RCI-1071: simplified call control page #3', () => {
callCtrlPage.props().onAdd(conferenceSessionId);
await timeout(500);
wrapper.update();
expect(phone.routerInteraction.currentPath).toEqual(`/conferenceCall/dialer/${conferenceSession.fromNumber}`);
expect(phone.routerInteraction.currentPath).toEqual(`/conferenceCall/dialer/${conferenceSession.fromNumber}/${conferenceSession.id}`);
call({
phoneNumber: contactA.phoneNumbers[0].phoneNumber,
});
Expand Down Expand Up @@ -274,7 +274,7 @@ describe('RCI-1710156: Call control add call flow', () => {
addCircleButton.simulate('click');
wrapper.update();
const fromNumber = phone.webphone.activeSession.fromNumber;
expect(phone.routerInteraction.currentPath).toEqual(`/conferenceCall/dialer/${fromNumber}`);
expect(phone.routerInteraction.currentPath).toEqual(`/conferenceCall/dialer/${fromNumber}/${phone.webphone.activeSession.id}`);
expect(wrapper.find(FromField)).toHaveLength(0);
expect(wrapper.find(BackHeader)).toHaveLength(1);
expect(wrapper.find(BackButton).find('.backLabel').text()).toEqual('Active Call');
Expand Down
15 changes: 5 additions & 10 deletions packages/ringcentral-widgets/containers/CallCtrlPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ function mapToProps(_, {
isOnConference = conferenceCall.isConferenceSession(currentSession.id);
const conferenceData = Object.values(conferenceCall.conferences)[0];

isMerging = conferenceCall.isMerging && !!(
Object
.values(conferenceCall.mergingPair)
.find(id => id === currentSession.id)
|| (isOnConference)
);
isMerging = conferenceCall.isMerging;

if (conferenceData && isWebRTC) {
conferenceCallId = conferenceData.conference.id;
Expand Down Expand Up @@ -203,9 +198,6 @@ function mapToFunctions(_, {
if (!session || webphone.isCallRecording({ session })) {
return;
}
if (conferenceCall) {
conferenceCall.setMergeParty({ fromSessionId: sessionId });
}
const outBoundOnholdCalls = filter(
call => call.direction === callDirections.outbound,
callMonitor.activeOnHoldCalls
Expand All @@ -214,8 +206,11 @@ function mapToFunctions(_, {
// goto 'calls on hold' page
routerInteraction.push(`/conferenceCall/callsOnhold/${session.fromNumber}/${session.id}`);
} else {
if (conferenceCall) {
conferenceCall.setMergeParty({ fromSessionId: sessionId });
}
// goto dialer directly
routerInteraction.push(`/conferenceCall/dialer/${session.fromNumber}`);
routerInteraction.push(`/conferenceCall/dialer/${session.fromNumber}/${sessionId}`);
}
},
onBeforeMerge(sessionId) {
Expand Down
16 changes: 14 additions & 2 deletions packages/ringcentral-widgets/containers/CallsOnholdPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ function mapToFunctions(_, {
getAvatarUrl,
...props
}) {
const { fromSessionId } = params;

const baseProps = mapToBaseFunctions(_, {
params,
phone,
Expand All @@ -86,9 +88,19 @@ function mapToFunctions(_, {
async onMerge(sessionId) {
await conferenceCall.mergeSession({
sessionId,
sessionIdToMergeWith: fromSessionId,
onReadyToMerge() {
routerInteraction.goBack();
const confId = conferenceCall.conferences && Object.keys(conferenceCall.conferences)[0];

if (confId) {
const sessionId = conferenceCall.conferences[confId].sessionId;

routerInteraction.push(`/calls/active/${sessionId}`);
} else {
routerInteraction.goBack();
}
},

});
},
onBackButtonClick() {
Expand All @@ -99,7 +111,7 @@ function mapToFunctions(_, {
phone.routerInteraction.go(-2);
},
onAdd() {
routerInteraction.push(`/conferenceCall/dialer/${params.fromNumber}`);
routerInteraction.push(`/conferenceCall/dialer/${params.fromNumber}/${params.fromSessionId}`);
},
getAvatarUrl,
isConferenceSession: (...args) => conferenceCall.isConferenceSession(...args),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ function mapToProps(_, {
function mapToFunctions(_, {
params,
phone,
phone: {
conferenceCall
},
onBack,
...props
}) {
Expand All @@ -67,6 +70,19 @@ function mapToFunctions(_, {
...baseProps,
onBack,
onCallButtonClick() {
// set mergingPair if has
const { fromSessionId } = params;
if (
fromSessionId &&
conferenceCall &&
conferenceCall.mergingPair &&
!conferenceCall.mergingPair.fromSessionId
) {
conferenceCall.setMergeParty({
fromSessionId
});
}

phone.dialerUI.onCallButtonClick({
fromNumber: params.fromNumber,
});
Expand Down