Simple Bash script to show MOS scores

Status
Not open for further replies.

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,461
393
83
I have been looking more closely at Mean Opinion Scores (MOS) (https://en.wikipedia.org/wiki/Mean_opinion_score) across my platform and put together a simple shell script to quickly show the average score over a period of time broken down by domain or just for a single domain.

Here is the script, it may be of use/help for someone, I just named it mos. As always, use/adapt at your own risk:

Code:
#!/bin/bash

#settings
export PGPASSWORD="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
db_host=127.0.0.1
db_port=5432

NUMBER_REGEX='^[0-9]+$'


if [ "$#" -lt 1 ]; then
    echo ""
    echo "Usage: mos <hours> [domain name]"
    echo ""
    echo "You must supply the number of hours to look back over as a command line argument."
    echo "You may optionally request a score for a single domain."
    echo ""
    exit 1
fi

if ! [[ $1 =~ $NUMBER_REGEX ]] ; then
   echo "Error: The first argument must be a number." >&2
   exit 1
fi

SQL="select b.domain_name, case when count(a.*) = 0 then 4 else avg(a.rtp_audio_in_mos) end as avg_mos\
from  v_xml_cdr a join v_domains b on b.domain_uuid = a.domain_uuid\
where a.rtp_audio_in_mos is not null and a.answer_stamp  > NOW() - INTERVAL '$1 hour'"

if [ "$#" -eq 2 ]; then
    SQL="${SQL} and b.domain_name = '$2'"
fi

SQL="${SQL} group by b.domain_name"

echo ""
psql --host=$db_host --port=$db_port --username=fusionpbx -c "${SQL}"

exit 0
 
Last edited:

bcmike

Active Member
Jun 7, 2018
328
55
28
53
Sorry, I know I'm digging up an old thread. When you look at Fusion CDRs what is considered a "good" MOS score? What is the range?

Thanks.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,461
393
83
@bcmike I'm not sure what is generally considered good. I always get interested in scores less than 4. There will always be the odd bad score for many reasons. I tend to look at this at three levels: The DC, The box, and then the domain.

Many poor scores on a single domain may indicate a fault with their internet connection. Poor scores on a few domains may indicate a problem affecting a single internet provider. Obviously poor scores across a whole server warrants investigation, but if more than one server is affected, I start to suspect a DC issue.
 

bcmike

Active Member
Jun 7, 2018
328
55
28
53
Thanks, I was just looking at CDRs and was wondering. I knew what MOS scores were in general but when I google I got a lot of conflicting info and not much really related to Fusion or Freeswitch. Most of my calls are 4.5 so i think I'm ok.
 

Scubadave112

Member
Jan 24, 2020
122
19
18
36
MOS is a terrible reference to identify poor end user experiences. Using it like Adrian suggested to identify trends is useful, I personally have power bi connected to my DB and it gives me a super sexy visual of all types of metrics from CDRs but deff useless when not using it in bulk. I find that my yealink DM is much more accurate and rating call quality than mos. Also CDR Statistics is so much more useful than it used to be as well… but for me I can usually match up customer complaints regarding call quality to any trends in MOS scores lower than a 4.40 and 4.0-4.4 trend is usually a network issue (usually for my isp issue never last more than an hour) but anything less than 4.0 your customer will notice and complain about so if you see trends of 4.0 or lower better figure it out real quick. I have one right now where their isp sucks and they have an LTE failover and I show them their registration IP is off their static cable and using LTE.. most likely going to lose this customer cause their to stupid to comprehend how call quality is effected by 15 computers and phones running on a single LTE card could create crappy RTP audio. Either way to really use this data I recommend watching a 1 hour powerbi video on you tube and connecting it to your Postgres. It is insane how much easier it is trouble when u can quickly apply a “contains” filter lol
 

bcmike

Active Member
Jun 7, 2018
328
55
28
53
MOS is a terrible reference to identify poor end user experiences. Using it like Adrian suggested to identify trends is useful, I personally have power bi connected to my DB and it gives me a super sexy visual of all types of metrics from CDRs but deff useless when not using it in bulk. I find that my yealink DM is much more accurate and rating call quality than mos. Also CDR Statistics is so much more useful than it used to be as well… but for me I can usually match up customer complaints regarding call quality to any trends in MOS scores lower than a 4.40 and 4.0-4.4 trend is usually a network issue (usually for my isp issue never last more than an hour) but anything less than 4.0 your customer will notice and complain about so if you see trends of 4.0 or lower better figure it out real quick. I have one right now where their isp sucks and they have an LTE failover and I show them their registration IP is off their static cable and using LTE.. most likely going to lose this customer cause their to stupid to comprehend how call quality is effected by 15 computers and phones running on a single LTE card could create crappy RTP audio. Either way to really use this data I recommend watching a 1 hour powerbi video on you tube and connecting it to your Postgres. It is insane how much easier it is trouble when u can quickly apply a “contains” filter lol
Thanks for the detailed response. Regarding your customer, I'm not sure where you are but I have a relationship with a local ISP where I can get a pretty cheap 5/1 DSL circuit ($40.00/month). So for small offices where the customer insists on using a congested Internet circuit, I install a cheap 5/1 DSL and run the phones exclusively through that. I then pad the cost into the phone seat fees.
 
Status
Not open for further replies.