Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.client = Voximplant.getInstance();
// Connection to the Voximplant Cloud is stayed alive on reloading of the app's
// JavaScript code. Calling "disconnect" API here makes the SDK and app states
// synchronized.
PushManager.init();
(async() => {
try {
this.client.disconnect();
} catch (e) {
}
})();
this.client.on(Voximplant.ClientEvents.ConnectionClosed, this._connectionClosed);
}
constructor() {
this.client = Voximplant.getInstance();
// Connection to the Voximplant Cloud is stayed alive on reloading of the app's
// JavaScript code. Calling "disconnect" API here makes the SDK and app states
// synchronized.
PushManager.init();
(async() => {
try {
this.client.disconnect();
} catch (e) {
}
})();
this.client.on(Voximplant.ClientEvents.ConnectionClosed, this._connectionClosed);
}
cancelCall() {
console.log("Cancel call");
VoxImplant.SDK.disconnectCall(currentCallId);
}
"&api_key=" +
api_key +
"&user_id=" +
user_id +
"&application_id=all"
);
const jsonB = await responseB.json();
const result = JSON.stringify(jsonB.result);
console.log(result);
const accnameValue = "testing";
const appnameValue = "testing";
const passwordValue = password;
//login the user to get deviceeventemitter
VoxImplant.SDK.login(
usernameValue +
"@" +
appnameValue +
"." +
accnameValue +
".voximplant.com",
passwordValue
);
this.setState({ loading: false });
this.props.navigation.navigate("Boiler");
}
TouchableOpacity,
Platform,
DeviceEventEmitter,
Image
} from 'react-native';
import { Keypad } from './Keypad';
import { CallButton } from './CallButton';
import { IncomingCallForm } from './IncomingCallForm';
import VoxImplant from "react-native-voximplant";
import loginManager from './LoginManager';
var currentCallId,
uaInstance,
number = '',
settings_video = false,
camera = VoxImplant.SDK.CameraType.CameraTypeFront;
DeviceEventEmitter.addListener(
VoxImplant.SDK.Events.CallRinging,
(callRinging) => {
console.log('Call ringing. Call id = ' + callRinging.callId);
if (uaInstance !== undefined) {
uaInstance.setState({callState: "Ringing"});
}
}
);
DeviceEventEmitter.addListener(
VoxImplant.SDK.Events.CallConnected,
(callConnected) => {
console.log('Call connected. Call id = ' + callConnected.callId);
if (uaInstance !== undefined) {
async VoxImplant() {
const accnameValue = "testing";
const appnameValue = "testing";
const email = await AsyncStorage.getItem("email");
const usernameValue = email.replace(/@[^@]+$/, "");
const passwordValue = await AsyncStorage.getItem("password");
console.log(email);
//console.log(passwordValue);
VoxImplant.SDK.login(
usernameValue +
"@" +
appnameValue +
"." +
accnameValue +
".voximplant.com",
passwordValue
);
console.log("SDK Login done");
}
makeCall(event) {
console.log("calling " + number);
VoxImplant.SDK.createCall(
number,
settings_video,
null,
function(callId) {
currentCallId = callId;
if (settings_p2p)
VoxImplant.SDK.startCall(callId, { "X-DirectCall": "true" });
else VoxImplant.SDK.startCall(callId);
this.setState(
update(this.state, {
$merge: {
status: "calling"
}
})
);
}.bind(this)
startOutgoingCallViaCallKit(isVideo, number) {
this.callKitManager.startOutgoingCall(isVideo, number, this.call.callId);
this.call.on(Voximplant.CallEvents.Connected, this._callConnected);
this.call.on(Voximplant.CallEvents.Disconnected, this._callDisconnected);
}
_incomingCall = (event) => {
if (this.call !== null) {
console.log(`CallManager: incomingCall: already have a call, rejecting new call, current call id: ${this.call.callId}`);
event.call.decline();
return;
}
this.addCall(event.call);
this.call.on(Voximplant.CallEvents.Disconnected, this._callDisconnected);
if (Platform.OS === 'ios') {
if (this.currentAppState === 'active') {
console.log('CallManager: _incomingCall: report incoming call to CallKit');
this.callKitManager.showIncomingCall(event.video, event.call.getEndpoints()[0].displayName, event.call.callId);
} else {
console.log('CallManager: _incomingCall: application is in the background, incoming call is already reported in AppDelegate');
this.callKitManager.callId = event.call.callId;
this.callKitManager.withVideo = event.video;
}
} else {
this._showIncomingScreenOrNotification(event);
}
};
_onRNCallKeepDidActivateAudioSession = () => {
console.log('CallKitManager: _onRNCallKeepDidActivateAudioSession');
Voximplant.Hardware.AudioDeviceManager.getInstance().callKitStartAudio();
};