FreePBX | Register | Issues | Wiki | Portal | Support

Logging jitter stats per-call

(Thepossum) #1

I have a fairly new freepbx 14 installation, the phones are on a remote network from the hosted pbx. Generally things are running swimmingly, although we’ve recently just enabled g729 in order to save on bandwidth.

There are some intermittent network issues with the internet provider, causing occasional call quality issues. All the boring stuff yup, a bit of extra packet loss and jitter that we can’t predict or prevent.
So we need to somehow visualize the per-call quality, in some sort of automated manner.

From the asterisk CLI, I can manually “pjsip show channelstats” and see live info on current active calls. Or I can script a “asterisk -rx ‘pjsip show channelstats’” to see everything at a periodic interval.

But what would be much more helpful would be for asterisk to log the per-call stats at the end of each call.

My google fu repeatedly brings up a command “rtcp set stats on”, but … nothing changes in the logs. How can I see the produced jitter data so that I can start to visualize it?

(Dave Burgess) #2

Logging QoS statistics is where we talked about this last time;

(Thepossum) #3

This has already been done; but I cannot see any differences in /var/log/asterisk/full afterwards. What am I to be looking for?

(Dave Burgess) #4

@dicko - do you remember what the extra step was to get this to log to /var/log/asterisk/full ?

(Thepossum) #5

Also, having entered into the CLI once, is it persistent across server reboots? Or would it have to be re-entered manually? Or perhaps there is a toggle in the gui to permanently enable it?

(Dave Burgess) #6

Yes. It is not likely to be persistent.


Well, setting

rtcp set debug on

would normally include its issue into /var/log/asterisk/full if the verbosity is at least 3

Starting it up with asterisk is probably better done in your freepbx.service file (which itself starts and stops asterisk)

or /etc/init.d/asterisk if you are a bit behind the times :slight_smile:

(Thepossum) #8

Having turned on the “rtcp set debug on” in the CLI I’m not seeing any references to “jitter”, neither in my console (currently running via “asterisk -rvvvvvv”), nor any references in /var/log/asterisk.

As of yet I’m still only seeing any such references to packet loss/jitter via a manual “pjsip show channelstats”. I’m almost afraid to give up and script that, because what googling I could do says that others who’d done so, it started to fail to connect after some time (the ‘asterisk -rx’ that is); also this slowly fills up the log files with ‘Remote UNIX connection’ entries.

Since “chkconfig --list” lists this for asterisk:

asterisk 0:off 1:off 2:off 3:off 4:off 5:off 6:off

I have to assume the newest freepbx uses systemd by default now. The contents of /usr/lib/systemd/system/freepbx.service doesn’t have all that much to edit, nothing looking like what you’re suggesting:

Description=FreePBX VoIP Server

ExecStart=/usr/sbin/fwconsole start
ExecStop=/usr/sbin/fwconsole stop


The “fwconsole” would be a php script, and whichever little bit of that that starts the asterisk binary is a mystery. But in any case, “asterisk” is running with these parameters according to “ps ax”:

/usr/sbin/asterisk -f -U asterisk -G asterisk -vvvg -c


ExecStart=/usr/sbin/fwconsole start&&sleep 1&&rasterisk -x 'rtcp set debug on'

(Thepossum) #10

So I have yet to see any logged stats for jitter + packet loss, neither in the /var/log/asterisk nor on the CLI.

I’m just about to concede defeat and whip up an infinitely-looping shell script.

(Jared Busch) #11

it works fine for me on a default FreePBX 14 install.

(Thepossum) #12

Which is great and all, but produces entirely unparseable per-call data. Unlike the info pulled from “pjsip show channelstats”, which has very clean data.

(Dave Burgess) #13

Sounds like you need a feature request or to dive into the code.

If you want the data to be easily parsable, perhaps we need a new options instead of just “RTCP SET DEBUG ON|OFF”. Perhaps add “DATA” and have the lines dropped into the log as a CSV entry (or colons, or whatever).

Donated code is always preferred.

(Thepossum) #14

It’s hardly a new question, and that there’s so many third-party “packet sniffing” solutions to make a mountain of the jitter guesswork speaks volumes. And that the core asterisk already knows all the stats for every channel all along? Priorities I guess.

(Dave Burgess) #15

While it’s not a new request, it’s one that is hampered by two limiting factors:

  1. Most people don’t need the stats.
  2. Once you have the stats and get everything working, you don’t need it any more.

Because of that, most people just write a ‘sed’ or ‘perl’ script that drags through the ‘full’ file grabbing the stats they are looking for. There are plenty of “third-party” solutions (like you said) so there’s not a lot of pressure to include it in the base FreePBX system.

Now, having said that - adding a feature that takes the code that writes the logfile lines and changing them to write a single, easily digestible log line could be a fun project. If I needed that, it’s the course I’d take, but I don’t need that right now.

So, once again, if you want this added, you have two paths:

  1. Submit a Feature Request that converts the output to a new format, or
  2. Look at the code in the file that produces the current debug output and change it yourself, then submit the changes to the FreePBX folks.

Telling us the system doesn’t do what you want over and over isn’t going to make people suddenly want to write your code.

(system) closed #16

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.