new function to get rtmedia media type from extension
reformat code
throw exception in try catch block