Before I forget this, today I had an emergency call from one of my dearest customers and friends. This conference room was having choppy sound, but strange it was, it only happened when the call came from the PSTN network (through an external profile), all local registered endpoints were okay. His scenario was the following:
- 8 GB of RAM
- 16 GB of Swap, only 2kB used
- FreeSWITCH 1.6.8
- FusionPBX 4.1 (devel branch)
For those who don't know, conference room are very handy. They allow to talk among many endpoints at the same time, it is like being in the same room.
So here it is how I fixed it.
First Finding on a Choppy Sound in FreeSWITCH Conference Room
After doing some tests, I was able to reproduce the symptom:
- Calling from PSTN and call arrives through the external profile the sound was choppy, but
- Calling from a registered point the sound was very good.
At the very beginning, it looked like a transcoding issue. Conferences always use their L16 internal codec. But taking out the codec 722 was not the solution.
After that I though it could be the recording of the conference as you read the configuration file from the LUA XML Handler of FusionPBX at app/xml_handler/resources/scripts/configuration/conference.conf.lua you will find the auto-record value is set. This means that the conference will be saved always. But sadly, that was not the solution.
Here it comes a Solution
After reading the logs again and again, I found this line:
2016-06-24 13:02:14.636618 [DEBUG] conference_loop.c:1101 Setup timer soft success interval: 20 samples: 160
This could be the reason. According to my readings, I understood that mod_conference does a sampling and the sampling was very low. But documentation only had a rate and interval parameters, not the sampling one. Reading the file from FreeSWITCH source at src/applications/mod_conference/mod_conference.c I found that samples variable was calculated by calling a macro named switch_samples_per_packet in the file src/include/switch_utils.h:
#define switch_samples_per_packet(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
So I decided to edit the conference.conf.lua file and change rate to 48000 and interval to 10. And It fixed it!
Please note these values are CPU demandant, you will need to play in your own environment to get a suitable values that work n your server.
Good Luck!blog comments powered by Disqus