TUTORIAL Viewing Call Stats: Packet Loss, MOS, Buffers and more

Joined
Apr 8, 2015
Messages
40
Reaction score
13
Having recently converted from an OBi202 I find that the (only) feature I'm missing is their call statistics page. I'm using Incredible PBX 11 on a Beaglebone Black and am still new to this platform so its entirely possible that this feature exists and I just don't know where to look for it.

Specifically, there are two things that I'd like to be able to see.
  1. A call statistics page for any active calls that included things like the active outbound trunk, # of packets transmitted, # of packets dropped, # of packets interpolated, jitter buffer info, MOS Score, etc. For reference, here is the equivalent page on my OBI: http://take.ms/vbWTf
  2. Outgoing call trunk performance history including total # of packets (ever) sent through each trunk, total dropped packets, etc. For reference, here is the equivalent page on my OBI: http://take.ms/nQswo
Does anything equivalent exit within IncrediblePBX/FreePBX/Asterisk?


The CDR -> CEL Call log looks promising (at least for seeing outgoing/incoming trunk usage info) but it doesn't appear to work on any platform other than the PogoPlug (related thread and discussion here: http://pbxinaflash.com/community/in...sing-incredible-pbx-11-on-ubuntu-14-04.16994/) - It also doesn't offer any call quality statistics.
 

SkykingOH

Guru
Joined
Dec 12, 2008
Messages
35
Reaction score
16
What are you looking for statistics from remote phones connected to a central server or statistics from remote fxo gateways? Both would be possible. Statistics from a SIP provider would require the carrier to exchange performance data.
 
Joined
Apr 8, 2015
Messages
40
Reaction score
13
Hi SkykingOH - Thanks for the response! I am still pretty new to VOIP so it might help if I explain my setup before I get any terminology wrong :)

My setup is:
Comcast ISP -> Asus Router -> IncrediblePBX running on a BeagleBone Black. Connected to the very same router is my Yealink t46G.

I realize that this setup is probably overkill for what I use it for, however I spend ~4 hours per day on the phone since I work from home and like playing with technology.

My t46G has an RTP statistics panel that isn't all that interesting. Since the phone and PBX server are on the same network (they literally sit 10 feet apart) I consistently see very quick round trip packet times and suffer 0% packet loss even after a 2 hour long call.

What I am interested in seeing is active and historical call stats between my PBX server and the VOIP Servers that I use (GoogleVoice, VoipMS, Circlenet) - My old OBI device did show active calls stats (from between the OBI and VOIP server as seen here: http://take.ms/vbWTf) however it does not appear that the PBX server tracks this?
 

synack

Guru
Joined
Dec 31, 2013
Messages
227
Reaction score
56
"asterisk -rx 'sip show channelstats'" will give you per call stats during an ongoing call.
eg:
Code:
Peer            Call ID      Duration Recv: Pack  Lost      (    %) Jitter Send: Pack  Lost      (    %) Jitter
74.216.x.x    2325327a1a2  00:00:06 0000000059  0000000000 ( 0.00%) 0.0000 0000000058  0000000000 ( 0.00%) 0.0001

Is that what you mean?
 
Joined
Apr 8, 2015
Messages
40
Reaction score
13
Thats EXACTLY what I mean :punk:

I am traveling this week so I won't be able to play with this for a few days however I think that this will work well. Thanks!
 

rossiv

Guru
Joined
Oct 26, 2008
Messages
2,624
Reaction score
139
"asterisk -rx 'sip show channelstats'" will give you per call stats during an ongoing call.
eg:
Code:
Peer            Call ID      Duration Recv: Pack  Lost      (    %) Jitter Send: Pack  Lost      (    %) Jitter
74.216.x.x    2325327a1a2  00:00:06 0000000059  0000000000 ( 0.00%) 0.0000 0000000058  0000000000 ( 0.00%) 0.0001

Is that what you mean?

That is a VERY useful thing to know. files away in memory bank for later use
 

krzykat

Telecom Strategist
Joined
Aug 2, 2008
Messages
3,145
Reaction score
1,235
"asterisk -rx 'sip show channelstats'" will give you per call stats during an ongoing call.
eg:
Code:
Peer            Call ID      Duration Recv: Pack  Lost      (    %) Jitter Send: Pack  Lost      (    %) Jitter
74.216.x.x    2325327a1a2  00:00:06 0000000059  0000000000 ( 0.00%) 0.0000 0000000058  0000000000 ( 0.00%) 0.0001

Is that what you mean?


Anyone know how to store this information somewhere in the CDR for later lookup? If someone complains about a certain call - will never happen DURING the call, it would be nice to look up the CDR and see what happened.
 

synack

Guru
Joined
Dec 31, 2013
Messages
227
Reaction score
56
OK so what I have so far is basically implementing the above link. This is definately ALPHA code. Don't run in production until you have done copious testing.
I have commented out the lines that insert the data into the CDR database (into existing field userfield that is reportable by freepbx cdr reports), feel free to uncomment them if you want the CDR updated. It would like to change that later, as I don't like the whole QoS thing in one long text field. But I don't have time today to do that.

1) append to extensions_custom.conf
Code:
[macro-hangupcall-custom]
; start of QoS reporting
exten => s,1,NoOp(--QoS stats RTPAUDIOQOS: ${RTPAUDIOQOS})
exten => s,n,NoOp(--QoS stats RTPAUDIOQOSBRIDGED: ${RTPAUDIOQOSBRIDGED})
exten => s,n,NoOp(-- QoS stats RTPAUDIOQOSJITTER: ${RTPAUDIOQOSJITTER})
exten => s,n,NoOp(-- QoS stats RTPAUDIOQOSLOSS: ${RTPAUDIOQOSLOSS})
exten => s,n,NoOp(-- QoS stats RTPAUDIOQOSRTT: ${RTPAUDIOQOSRTT})
exten => s,n,NoOp(-- QoS stats RTPAUDIOQOSJITTERBRIDGED: ${RTPAUDIOQOSJITTERBRIDGED})
exten => s,n,NoOp(-- QoS stats RTPAUDIOQOSLOSSBRIDGED: ${RTPAUDIOQOSLOSSBRIDGED})
exten => s,n,NoOp(-- QoS stats RTPAUDIOQOSRTTBRIDGED: ${RTPAUDIOQOSRTTBRIDGED})
exten => s,n,NoOp(-- BRIDGED packet loss: ${CUT(RTPAUDIOQOSLOSSBRIDGED,\;,1):5} lost of ${CUT(RTPAUDIOQOSLOSSBRIDGED,\;,2):9} in total --)
; - The jitter we measured ourselves - we might also be interested in the maximum jitter
exten => s,n,Set(JITTER_RX_LOCAL_AVG=${CUT(RTPAUDIOQOSJITTER,\;,3):12})
exten => s,n,Set(JITTER_RX_REMOTE_AVG=${CUT(RTPAUDIOQOSJITTERBRIDGED,\;,3):12})
exten => s,n,Set(RTT_LOCAL_AVG=${CUT(RTPAUDIOQOSRTT,\;,3):7})
exten => s,n,Set(RTT_REMOTE_AVG=${CUT(RTPAUDIOQOSRTTBRIDGED,\;,3):7})
exten => s,n,GotoIf($["${HANGUPCAUSE}" != "16"]?continue) ; only store the data if this was a normal call
exten => s,n,Set(LOST_LOCAL_TOT=${MATH(${CUT(RTPAUDIOQOSLOSS,\;,1):5} / ${CUT(RTPAUDIOQOSLOSS,\;,2):9},float)})
exten => s,n,Set(LOST_REMOTE_TOT=${MATH(${CUT(RTPAUDIOQOSLOSSBRIDGED,\;,1):5} / ${CUT(RTPAUDIOQOSLOSSBRIDGED,\;,2):9},float)})
exten => s,n,Set(JITTER_REP_LOCAL_AVG=${MATH(${CUT(RTPAUDIOQOSJITTER,\;,7):19} / 1000)})
exten => s,n,Set(JITTER_REP_REMOTE_AVG=${MATH(${CUT(RTPAUDIOQOSJITTERBRIDGED,\;,7):19} / 1000)})
; Uncomment 4 lines below to update CDRDB
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)}&lost_remote:${LOST_REMOTE_TOT}&lost_local:${LOST_LOCAL_TOT}&format_native=${FORMAT_NATIVE})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)}&jitter_remote:${JITTER_RX_REMOTE_AVG}&jitter_local:${JITTER_RX_LOCAL_AVG})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)}&jitter_rep_remote:${JITTER_REP_REMOTE_AVG}&jitter_rep_local:${JITTER_REP_LOCAL_AVG})
;exten => s,n,Set(CDR(userfield)=${CDR(userfield)}&rtt_remote:${RTT_REMOTE_AVG}&rtt_local:${RTT_LOCAL_AVG})
exten => s,n(continue),NoOp(End of QoS)
 
exten => s,n,MacroExit()
2) append to extensions_override_freepbx.conf (this is a copy of my macro-hangupcall in extensions_additional.conf with the Macro(hangupcall-custom) inserted.
Code:
[macro-hangupcall]
exten => s,1(start),GotoIf($["${USE_CONFIRMATION}"="" | "${RINGGROUP_INDEX}"="" | "${CHANNEL}"!="${UNIQCHAN}"]?theend)
exten => s,n(delrgi),Noop(Deleting: RG/${RINGGROUP_INDEX}/${CHANNEL} ${DB_DELETE(RG/${RINGGROUP_INDEX}/${CHANNEL})})
exten => s,n(theend),ExecIf($["${ONETOUCH_RECFILE}"!="" & "${CDR(recordingfile)}"=""]?Set(CDR(recordingfile)=${ONETOUCH_RECFILE}))
exten => s,n,Macro(hangupcall-custom)
exten => s,n,Hangup
exten => s,n,MacroExit()
I've done a quick test and appears to function, but my day just got busy so I won't have a chance to test this well myself. If someone would like to test and report back if things are working or not, that would be appreciated.
The NoOps will spew a lot of QoS info to the CLI at call hangup.
 

markd89

Member
Joined
Sep 3, 2013
Messages
97
Reaction score
9
subscribed.

Can someone say what normal/acceptable values are for loss, jitter? (Subject for another thread but I am having call quality issues with my RentPBX server and looking for ideas on troubleshooting. It would be good to know what is normal/problematic)
 

markd89

Member
Joined
Sep 3, 2013
Messages
97
Reaction score
9
If I should make this it's own thread, please let me know. I am trying to nail down the cause of intermittent poor call quality. (System is on RentPBX, trunks are mostly Vitelity). Call quality issues also occur extension-extension but seemingly less frequently.

Following are the results from a phone call I just made:

pbx1*CLI> sip show channelstats
Peer Call ID Duration Recv: Pack Lost ( %) Jitter Send: Pack Lost ( %) Jitter
64.2.142.189 47fd548015d 00:07:38 0000022859 0000061782 (72.99%) 0.0000 0000022071 0000000001 ( 0.00%) 0.0001
10.0.0.8 c293887e7b7 00:07:38 0000022072 0000000000 ( 0.00%) 0.0000 0000022077 0000000000 ( 0.00%) 0.0036
2 active SIP channels

10.0.0.8 is my client.
64.2.142.189 is Vitelity.

The quality of this call seemed to be perfect, but I see lots of lost packets receiving from Vitelity. Can someone shed light on why that might be?

Thanks,
Mark
 

synack

Guru
Joined
Dec 31, 2013
Messages
227
Reaction score
56
What version of asterisk? I know older ones had issues with reporting incorrect packet loss, but it was solved at least by asterisk 11. I'm pretty sure that number is incorrect. there's no way you could have 73% packet loss and still have a call, never mind it be clear. What really tells me there is a calculation issue is that both legs of the call had *about* 22,000 packets and the total lost was 61K on the one leg. Some of the values are received via RCTP from the remote end, maybe Vitelity reporting incorrect packet loss? I have honestly never seen that before.
 

markd89

Member
Joined
Sep 3, 2013
Messages
97
Reaction score
9
Asterisk 1.8.13.0 PBX in a Flash Purple.

Is there are straightforward upgrade path where I don't have a high chance of breaking the system? :)
 

atsak

Guru
Joined
Sep 7, 2009
Messages
2,381
Reaction score
436
I'm thinking more about this and really like this idea of recording call stats somehow - I guess you'd have to insert them in the CDR with abbreviations? How handy would it be though if an end user complained of quality problems and you could say well all the parameters are OK so it must be the handset or something else . . .
 
Joined
Apr 8, 2015
Messages
40
Reaction score
13
I'm thinking more about this and really like this idea of recording call stats somehow - I guess you'd have to insert them in the CDR with abbreviations? How handy would it be though if an end user complained of quality problems and you could say well all the parameters are OK so it must be the handset or something else . . .

This would be a killer feature.

With multiple users (and call routes, etc) there are many contributing factors to quality problems.

Having a call stat log for each call (maybe over a configurable time range) would be a huge timesaver!
 

synack

Guru
Joined
Dec 31, 2013
Messages
227
Reaction score
56
I need to work on this some more, looks like the variables I snarfed from voip-info (link up above) are not populated correctly. Maybe due to variations in asterisk versions. Some research is required, but not today. I also think that since i'm using IAX2 as my trunk, i'm missing other values like RTT on the bridge side. My setup above does provide some information into the CDR, but not a complete quality picture.
 

synack

Guru
Joined
Dec 31, 2013
Messages
227
Reaction score
56
If you want to make it quick and dirty without calculations, you could simply change the above macro to:
Code:
[macro-hangupcall-custom]
; start of QoS reporting
exten => s,1,NoOp(--QoS stats RTPAUDIOQOS: ${RTPAUDIOQOS})
exten => s,n,NoOp(--QoS stats RTPAUDIOQOSBRIDGED: ${RTPAUDIOQOSBRIDGED})
exten => s,n,Set(CDR(userfield)=${CDR(userfield)}${RTPAUDIOQOS}${RTPAUDIOBRIDGED}
exten => s,n(continue),NoOp(End of QoS)
 
exten => s,n,MacroExit()
Which would just dump the call's QoS information directly into the CDR. (using the builtin unused CDR field userfield)
 

krzykat

Telecom Strategist
Joined
Aug 2, 2008
Messages
3,145
Reaction score
1,235
What's the point of storing the ssrc=xxxxx, themssrc=xxxx ? The other info is GREAT to have stored. Then maybe also add Jitter Min/Max/Avg ??
This is a GREAT add-on that everyone should want.
 

synack

Guru
Joined
Dec 31, 2013
Messages
227
Reaction score
56
What's the point of storing the ssrc=xxxxx, themssrc=xxxx ?

Likely no point.
Quick and dirty is just that, dump whatever QoS values SIP tracks into the CDR database.
I'll see about cleaning it up today as my day looks slow so far.
 

Members online

No members online now.

Forum statistics

Threads
25,779
Messages
167,505
Members
19,199
Latest member
leocipriano
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top