You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-05 23:10:41 +03:00
Only do native lookup if it's supported
Also fix as bug where we were checking the wrong field to check for native/virtual support: oops.
This commit is contained in:
@@ -264,7 +264,7 @@ export default class CallHandler extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public getSupportsVirtualRooms() {
|
public getSupportsVirtualRooms() {
|
||||||
return this.supportsPstnProtocol;
|
return this.supportsSipNativeVirtual;
|
||||||
}
|
}
|
||||||
|
|
||||||
public pstnLookup(phoneNumber: string): Promise<ThirdpartyLookupResponse[]> {
|
public pstnLookup(phoneNumber: string): Promise<ThirdpartyLookupResponse[]> {
|
||||||
@@ -883,10 +883,15 @@ export default class CallHandler extends EventEmitter {
|
|||||||
|
|
||||||
// Now check to see if this is a virtual user, in which case we should find the
|
// Now check to see if this is a virtual user, in which case we should find the
|
||||||
// native user
|
// native user
|
||||||
|
let nativeUserId;
|
||||||
|
if (this.getSupportsVirtualRooms()) {
|
||||||
const nativeLookupResults = await this.sipNativeLookup(userId);
|
const nativeLookupResults = await this.sipNativeLookup(userId);
|
||||||
const lookupSuccess = nativeLookupResults.length > 0 && nativeLookupResults[0].fields.lookup_success;
|
const lookupSuccess = nativeLookupResults.length > 0 && nativeLookupResults[0].fields.lookup_success;
|
||||||
const nativeUserId = lookupSuccess ? nativeLookupResults[0].userid : userId;
|
nativeUserId = lookupSuccess ? nativeLookupResults[0].userid : userId;
|
||||||
console.log("Looked up " + number + " to " + userId + " and mapped to native user " + nativeUserId);
|
console.log("Looked up " + number + " to " + userId + " and mapped to native user " + nativeUserId);
|
||||||
|
} else {
|
||||||
|
nativeUserId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
const roomId = await ensureDMExists(MatrixClientPeg.get(), nativeUserId);
|
const roomId = await ensureDMExists(MatrixClientPeg.get(), nativeUserId);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user