Hello @rahul_webnexus2020,
Can you please share your code snippet of the onCallEnded() and what action are you performing on call end (if any)?
Warm Regards,
CometChat Pro
Mayur Bhandari
import React, {Component} from ‘react’;
import {View} from ‘react-native’;
import {CometChat} from ‘@cometchat-pro/react-native-chat’;
const listnerID = ‘MAIN_CALLING_SCREEN_CALL_LISTENER’;
import {connect} from ‘react-redux’;
class Index extends Component {
constructor(props) {
super(props);
try {
const self = this;
const callListener = new CometChat.OngoingCallListener({
onUserJoined: () => {},
onUserLeft: () => {
self.gotoChat();
},
onCallEnded: () => {
self.gotoChat();
},
onError: () => {
self.gotoChat();
},
});
this.addCallListner();
this.sessionId = this.getParams(‘sessionId’, ‘sessionid’);
this.callSettings = new CometChat.CallSettingsBuilder()
.setSessionID(this.sessionId)
.enableDefaultLayout(true)
.setCallEventListener(callListener)
.build();
} catch (e) {
console.log(e, ‘error’);
}
}
getParams = (type, defaultvalue) => {
let {params = {}} = this.props.route ?? {};
let _data = params ?? {};
return _data[type] ?? defaultvalue;
};
addCallListner = () => {
try {
CometChat.addCallListener(
listnerID,
new CometChat.CallListener({
onIncomingCallReceived(call) {
var sessionID = call?.getSessionId();
var status = CometChat.CALL_STATUS.BUSY;
CometChat.rejectCall(sessionID, status).then(
(rejectedCall) => {
console.log(‘Incoming Call rejected’, rejectedCall);
},
(error) => {
console.log(‘Call rejection failed with error:’, error);
},
);
},
}),
);
} catch (e) {
console.log(e, ‘error’);
}
};
componentWillUnmount() {
CometChat.removeCallListener(listnerID);
}
gotoChat = () => {
this.props.navigation.goBack();
};
render() {
return (
<View style={{height: ‘100%’, width: ‘100%’}}>
<CometChat.CallingComponent callsettings={this.callSettings} />
);
}
}
const mapStateToProps = (state) => {
const {userInfo} = state.LoginReducer;
const {dark} = state.modeReducer;
const {settings} = state.settingReducer;
const {language} = state.languageReducer;
return {
userInfo,
dark,
language,
settings,
};
};
export default connect(mapStateToProps, {})(Index);
Please look at this code.
Unhandled JS Exception: TypeError: null is not an object (evaluating ‘this.room.myroomjid’), stack: @443:468074 @: @390:500 value@55:1280 value@37:3685 @37:841 value@37:2939 value@37:813 value@: ( “4 libc++abi.dylib 0x00007fff2024ec47 _ZSt11__terminatePFvvE + 8”, “5 libc++abi.dylib 0x00007fff2024ebe9 _ZSt9terminatev + 41”, “6 libdispatch.dylib 0x00007fff2010651c _dispatch_client_callout + 28”, “7 libdispatch.dylib 0x00007fff2010c3f9 _dispatch_lane_serial_drain + 715”, “8 libdispatch.dylib 0x00007fff2010cf74 _dispatch_lane_invoke + 403” )
now this message is showing and application get crashed.
Hello @rahul_webnexus2020,
We are sorry for the delay in the response. Please log in to the CometChat Dashboard and connect with us via the support system available from the CometChat dashboard.
Warm Regards,
CometChat Pro
Mayur Bhandari