Peer Connection for video call works fine the first time, but the second time it sends 2 offers and 2 answers, the third time 3 offers and 3 answers

I am using react-native-webrtc to build a video chat app in android. I wrote the code on two screens: one for the caller and 2 for the receiver. When I first try the video call it works fine. I close the call and try to call again : I get failed to set remote/local answer and if I look into the signaling server logs I can see that 2 offers are send and 2 answers. If I close the call and try again 3 offers are sent and 3 answers.

If I reinitialize the app the first time it works fine again. Then the trouble repeats itself.

Do you have any ideas ?


this is because the connection doesn’t end the first time, so when u open it the second time, it becomes 2, then 3 e.t.c. you need to properly disconnect the call when u hang up the first time, so the second time., it can start afresh