Getting call quality stats from FreePBX

Hi,

I’ve been working on getting call quality statistics for my FreePBX system. Following the tutorial link below, I was able to get it partially working:
https://www.voip-info.org/wiki/view/Asterisk+RTCP1

My issue is that I’m able to capture rtcp stats only for unanswered calls. For answered calls, all the values for send/receive packets, packet loss, jitter are all zero on the asterisk log file. Additionally, nothing is passed to the master.csv file.

I’ve appended the lines below on my extensions_custom.conf file:

[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()

And on extensions_override_freepbx.conf

[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()

What could be wrong with this configuration? Would really appreciate the help.

A follow up question on this. With the changes to extensions_custom.conf and extensions_override_freepbx.conf, I’m able to get QoS stats for some scenarios.
For instance, I get some stats if the destination context is “from-trunk”. For unanswered calls, the QoS fields appear but all are empty (no values). And for answered calls, I don’t get any QoS related information.

Is there anyone with experience in doing this? All I need is to capture QoS stats in the CDR log (Master.csv) files for all calls.

Thanks