How we can hangup call in android, if someone ended the call

We are developing a solution, that accepts the calls (audio and video),
A user sends a notification to user B,
B receives a notification with a random room ID, now both users can join the room using the provided room id.
But if someone is not accepting the call or disconnect that call, We need to end the call activity in the android app. Right now there is no way to end the call programmatically. is there any solution?