refactor code of webrtc module