Improve JSON media transfer retry and timeout logic