Note that the definition of dBOv is quite vague in most places - is it peak since wave, peak square wave, etc.? This code is based on the well defined wording in RFC3389:
"For example, in the case of a u-law system, the reference would be a square wave with values +/-8031, and this square wave represents 0dBov. This translates into 6.18dBm0".