Why are MES scores not logged by default? (Announcement: Added MES scores to CDR module)

Tired of hearing a user complain about bad audio and not knowing if they’re kooky, and if they’re not kooky, where the issue came from? Worry no more, with the new CDR + MES! I don’t know if this is not done normally because it wasn’t thought of, but I’ve added it to a branch of the CDR plugin. GitHub - tomck/cdr: Experimental native Asterisk MES collection for FreePBX CDR Reports (FreePBX 17); source for review and lab evaluation. · GitHub

VIbe’d with Sol 6.1, checked by Claude Opus 5.5. This does run a background PHP collector and requires pm2, which shouldn’t be an issue. Haven’t submitted upstream yet because I want to have more testing/feedback.

Usefull indeed.

Nice! I have a block in my extensions_custom.conf that adds stats to the CDR Userfield. While it doesn’t use those stats to calculate and display a Mean Opinion Score, if there are user trouble reports as to call quality I can pop into the CDR’s and quickly do the math.

[macro-hangupcall-custom]
; start of QoS reporting
exten => s,1,NoOp(Start QoS)
exten => s,n,NoOp(Local Stream ID: ${CHANNEL(rtcp,local_ssrc)})
exten => s,n,NoOp(Remote Stream ID: ${CHANNEL(rtcp,remote_ssrc)})
exten => s,n,NoOp(Packets Sent: ${CHANNEL(rtcp,txcount)})
exten => s,n,NoOp(Packets Received: ${CHANNEL(rtcp,rxcount)})
exten => s,n,NoOp(Local RX Packet Loss Max: ${CHANNEL(rtcp,local_maxrxploss)})
exten => s,n,NoOp(Local RX Packet Loss Min: ${CHANNEL(rtcp,local_minrxploss)})
exten => s,n,NoOp(Local RX Packet Loss: ${CHANNEL(rtcp,rxploss)})
exten => s,n,NoOp(Local RX Packet Loss Norm Dev: ${CHANNEL(rtcp,local_normdevrxploss)})
exten => s,n,NoOp(Local RX Packet Loss Std Dev: ${CHANNEL(rtcp,local_stdevrxploss)})
exten => s,n,NoOp(Local TX Packet Loss: ${CHANNEL(rtcp,txploss)})
exten => s,n,NoOp(Remote RX Packet Loss Max: ${CHANNEL(rtcp,remote_maxrxploss)})
exten => s,n,NoOp(Remote RX Packet Loss Min: ${CHANNEL(rtcp,remote_minrxploss)})
exten => s,n,NoOp(Remote RX Packet Loss Norm Deviation: ${CHANNEL(rtcp,remote_normdevrxploss)})
exten => s,n,NoOp(Remote RX Packet Loss Std Deviation: ${CHANNEL(rtcp,remote_stdevrxploss)})
exten => s,n,NoOp(Round Trip Time: ${CHANNEL(rtcp,rtt)})
exten => s,n,NoOp(Round Trip Time Max: ${CHANNEL(rtcp,maxrtt)})
exten => s,n,NoOp(Round Trip Time Min: ${CHANNEL(rtcp,minrtt)})
exten => s,n,NoOp(Round Trip Time Norm Dev: ${CHANNEL(rtcp,normdevrtt)})
exten => s,n,NoOp(Round Trip Time Std Dev: ${CHANNEL(rtcp,stdevrtt)})
exten => s,n,NoOp(Local RX Jitter: ${CHANNEL(rtcp,rxjitter)})
exten => s,n,NoOp(Local TX Jitter: ${CHANNEL(rtcp,txjitter)})
exten => s,n,NoOp(Local Jitter Max: ${CHANNEL(rtcp,local_maxjitter)})
exten => s,n,NoOp(Local Jitter Min: ${CHANNEL(rtcp,local_minjitter)})
exten => s,n,NoOp(Local Jitter Norm Dev: ${CHANNEL(rtcp,local_normdevjitter)})
exten => s,n,NoOp(Local Jitter Std Dev: ${CHANNEL(rtcp,local_stdevjitter)})
exten => s,n,NoOp(Remote Jitter Max: ${CHANNEL(rtcp,remote_maxjitter)})
exten => s,n,NoOp(Remote Jitter Min: ${CHANNEL(rtcp,remote_minjitter)})
exten => s,n,NoOp(Remote Jitter Norm Dev: ${CHANNEL(rtcp,remote_normdevjitter)})
exten => s,n,NoOp(Remote Jitter Std Dev: ${CHANNEL(rtcp,remote_stdevjitter)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Stream ID: ${CHANNEL(rtcp,local_ssrc)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote Stream ID: ${CHANNEL(rtcp,remote_ssrc)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Packets Sent: ${CHANNEL(rtcp,txcount)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Packets Received: ${CHANNEL(rtcp,rxcount)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Packet Loss Max: ${CHANNEL(rtcp,local_maxrxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Packet Loss Min: ${CHANNEL(rtcp,local_minrxploss)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Packet Loss: ${CHANNEL(rtcp,rxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Packet Loss Norm Dev: ${CHANNEL(rtcp,local_normdevrxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Packet Loss Std Dev: ${CHANNEL(rtcp,local_stdevrxploss)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local TX Packet Loss: ${CHANNEL(rtcp,txploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote RX Packet Loss Max: ${CHANNEL(rtcp,remote_maxrxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote RX Packet Loss Min: ${CHANNEL(rtcp,remote_minrxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote RX Packet Loss Norm Deviation: ${CHANNEL(rtcp,remote_normdevrxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote RX Packet Loss Std Deviation: ${CHANNEL(rtcp,remote_stdevrxploss)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Round Trip Time: ${CHANNEL(rtcp,rtt)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Round Trip Time Max: ${CHANNEL(rtcp,maxrtt)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Round Trip TIme Min: ${CHANNEL(rtcp,minrtt)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Round Trip Time Norm Dev: ${CHANNEL(rtcp,normdevrtt)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Round Trip Time Std Dev: ${CHANNEL(rtcp,stdevrtt)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Jitter: ${CHANNEL(rtcp,rxjitter)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local TX Jitter: ${CHANNEL(rtcp,txjitter)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Max: ${CHANNEL(rtcp,local_maxjitter)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Min: ${CHANNEL(rtcp,local_minjitter)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Norm Dev: ${CHANNEL(rtcp,local_normdevjitter)})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Std Dev: ${CHANNEL(rtcp,local_stdevjitter)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote Jitter Max: ${CHANNEL(rtcp,remote_maxjitter)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote Jitter Min: ${CHANNEL(rtcp,remote_minjitter)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote Jitter Norm Dev: ${CHANNEL(rtcp,remote_normdevjitter)})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Remote Jitter Std Dev: ${CHANNEL(rtcp,remote_stdevjitter)})
exten => s,n(continue),NoOp(End of QoS)

Could you share what the results of that looks like?

For my thing, here is a screen shot. The stats show up for each call, which can be used to manually calculate a MOS. The calculation itself could be included in there but I don’t have the analyze these often enough to go through that exercise. :grinning_face:

And when it comes to the MOS calculation, based on researching this I put together a Ruby script to plug the call stats into when I needed to tally it up. This could very well be incorrect in terms of the calculation routine. But it was a barometer at least. Since we now use Twilio for SIP trunking, all of the metrics for external calls are there so I rarely use this.

#	Scale explanation
#	-------------------
#	Maximum for G.711 codec		4.4
# 	Very satisfied			4.3-5.0
#	Satisfied				4.0-4.3
#	Some users satisfied			3.6-4.0
#	Many users dissatisfied		3.1-3.6
#	Nearly all users dissatisfied	2.6-3.1
#	Not recommended			1.0-2.6

# These stats are captured in the Asterisk Userfield CDR Reports
AverageLatency = 24.906	# in whole milliseconds
Jitter = 12.438			# in whole milliseconds
TxPacketLoss = 1.0		# in packet counts
RxPacketLoss = 1693.0		# in packet counts
TxPackets = 55477.0		# in packet counts
RxPackets = 53801.0		# in packet counts

# Now calculate everything based on formulas listed here --> https://www.pingman.com/kb/article/how-is-mos-calculated-in-pingplotter-pro-50.html
PacketLoss = ((TxPacketLoss + RxPacketLoss) / (TxPackets + RxPackets)) * 100

EffectiveLatency = (AverageLatency + Jitter * 2 + 10)

if EffectiveLatency < 160 then
	R = 93.2 - (EffectiveLatency / 40)
	else
	R = 93.2 - (EffectiveLatency / 120) / 10
end

RAdj = R - (PacketLoss * 2.5)

MOS = 1 + (0.035) * RAdj + (0.000007) * RAdj * (RAdj - 60) * (100 - RAdj)

print "Mean Opinion Score of the call is: " + MOS.to_s + ".\r"
if MOS < 2.6 then print "Call quality is: not recommended.\r\n" end
if MOS < 3.1 and MOS >= 2.6 then print "Call quality is: nearly all users dissatisfied.\r\n" end
if MOS < 3.6 and MOS >= 3.1 then print "Call quality is: many users dissatisfied.\r\n" end
if MOS < 4.0 and MOS >= 3.6 then print "Call quality is: some users satisfied.\r\n" end
if MOS < 4.3 and MOS >= 4.0 then print "Call quality is: satisfied.\r\n" end
if MOS < 5.0 and MOS >= 4.3 then print "Call quality is: very satisfied.\r\n" end