Skip to content

Commit 80b3f66

Browse files
Merge pull request #283 from Azure-Samples/dmceachernmsft/active-call-transfer-api-check
add check for API to not impact previous releases for active call transfer
2 parents 9314822 + 91a7e16 commit 80b3f66

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

Project/src/MakeCall/MakeCall.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,22 @@ export default class MakeCall extends React.Component {
157157
await this.callClient.createCallAgent(tokenCredential, { displayName: userDetails.displayName });
158158
window.callAgent = this.callAgent;
159159

160-
this.callAgent.on('activeCallsUpdated', (args) => {
161-
console.log(`activeCallsUpdated, activeCalls=${args.activeCallDetails}`);
162-
this.setState({activeCallDetails: args.activeCallDetails});
163-
});
160+
try {
161+
this.callAgent.on('activeCallsUpdated', (args) => {
162+
console.log(`activeCallsUpdated, activeCalls=${args.activeCallDetails}`);
163+
this.setState({activeCallDetails: args.activeCallDetails});
164+
});
164165

165-
this.callAgent.on('noActiveCalls', () => {
166-
console.log('noActiveCalls event received - user no longer in a call');
167-
this.setState({activeCallDetails: undefined});
168-
});
166+
this.callAgent.on('noActiveCalls', () => {
167+
console.log('noActiveCalls event received - user no longer in a call');
168+
this.setState({activeCallDetails: undefined});
169+
});
170+
const activeCalls = await this.callAgent.getActiveCallDetails();
171+
this.setState({ activeCallDetails: activeCalls.callId ? activeCalls : undefined });
172+
} catch (e) {
173+
console.log('active call transfer not configured for this release version');
174+
}
175+
169176

170177

171178
this.callAgent.on('callsUpdated', e => {
@@ -235,9 +242,7 @@ export default class MakeCall extends React.Component {
235242
this.setState({ loggedIn: true });
236243
this.logInComponentRef.current.setCallAgent(this.callAgent);
237244
this.logInComponentRef.current.setCallClient(this.callClient);
238-
this.autoJoinMeetingByMeetingLink();
239-
const activeCalls = await this.callAgent.getActiveCallDetails();
240-
this.setState({ activeCallDetails: activeCalls.callId ? activeCalls : undefined });
245+
this.autoJoinMeetingByMeetingLink();
241246
} catch (e) {
242247
console.error(e);
243248
}

0 commit comments

Comments
 (0)