Logging QoS statistics

I want to be able to look back at an individual call for
dropped packed% and jitter.
seems to work pretty well, so I have placed the command

asterisk -rx “sip show channelstats” in a bash command file
in a loop with a 5 second pause.


asterisk -rx "sip show channelstats"
asterisk -rx “sip show channelstats” >> logfile.txt
sleep 5

(First command shows to the console, the next logs it)

After a while I get

asterisk.c No more connections allowed
After this, all phones lost connection and the machine was for all practical purposed dead. I rebooted and it came back up fine.

Asterisk (Ver.
FreePBX Distro
PBX Firmware: 2.210.62-5
PBX Service Pack:

At the time of the failure, no calls were being processed.

I am sure there is a better way to do this anyway.
Has anyone done this?


for what it’s worth

rtcp set debug on

oops, too noisy for you!

rtcp set stats on


watch -n 5 --differences “rasterisk -x ‘sip show channelstats’”

instead of your bash script.

The watch command is much better. I was using -rx instead of -x, I wonder if that was what was using up my connections and causing the error.

I am not seeing any data from the rtcp set stats on.

Gonna keep reading up on the rtcp command. thanks for your quick response!

I did this in the CLI and it did not appear to do anything. Shouldn’t the log show something on the console at the conclusion of a call?


Remember RTCP-XR data comes from the phone. Make sure you have it turned on!

I am getting what appears to be relevant data here.
Actually, my only problem is when I run
asterisk -rx "sip show channelstats"
it runs for a few hours then I get
asterisk.c No more connections allowed.

I got a suggestion about using the watch command instead, but I am not sure the respondent was trying to solve the connection resource problem. I think they were trying to give me a more aesthetic output to the screen.

Is this failure to recover connections a know issue in this version? Is there a work around?


rtcp events can be logged to Asterisk full then parsed out. That would be much easier than real time.

If desiring real time I would use media proxy or something designed to do what you want.

My comments are based on Asterisk 1.8 support. Asterisk 11 may have improved RTCP-XR handling.

Here is the info on the data structures, with a little coding you could do pseudo MOS in the CDR.


VoIP info also has useful data:


True, I will work on implementing some form of media proxy.
I guess the frustrating part of this is, for the moment is that, sip show channelstats
shows me exactly what I am looking for in a really simple form.
Do you know if there is a known problem with 1.8 when using asterisk -x in a loop from bash? Is there a reason it is using up connections?


asterisk -x will start a new instance of Asterisk.

The proper way to do this is to issue the command via Asterisk manager interface.

I also sent you how to access the data via CDR.

asterisk -rx ‘command’ runs the argument in command with output to local terminal then terminates back to shell.

I actually posted

rasterisk -x

this is to start a remote connection to asterisk and eXecute a command, rasterisk in general is both easier to tab complete and uses less resources than asterisk -r with or without the x

I thought it was a typo. It was pretty late…:slight_smile:

I will give that a try and see how it goes. Thanks for the clarification.

Hey SkykingOH, would you be so kind as to send me the the info on how to send the call data to CDR as well?
I’ve been looking for a way to store that info in the CDR.