We see that after hanging up hundreds of calls that Asterisk is having a hard time writing to the CDR Database and has a hard time processing any calls afterwards until it is done writing to CDR.
Looking in the asterisk console odbc show all it seems that VitalPBX is configured to use only one connection. So we followed this guide and increased to 5 connections. However, Asterisk still keeps only one connection.
I logged into another popular GUI for Asterisk, and I see that it constantly uses 2 connections and when processing lots of data it increases the connections.
What is preventing it from increasing the connections?
I even created 2000 concurrent channels (1k calls) but it still only used 1 connection, resulting Asterisk is not being able to accept new calls until it was finished writing to CDR.
OK. It seems that the CDR logic inside of Asterisk was done very poorly and is not designed for high usage, thus, if the CDR DB connection is congested then Asterisk will “hang”.
It seems like the temporary solution is to enable batch mode.
However, the correct solution would be a post processing handler.
Yes, because here’s how batch mode works.
You set a buffer size, lets say 100. And then you set a time, let’s set 300 (5 minutes)
The CDR gets stored in the buffer, if the buffer reached 100, it will write the data from the buffer to MySQL. Otherwise, it will write the data every 5 minutes to MySQL. So whichever happens first.
So… if Asterisk was restarted unexpectedly, all the data that was stored in the buffer will be lost. Obviously.
I personally think, that it is rather to potentially lose up to 5 minutes CDR than having a dysfunctional system. Meaning, if you have unexpected crashes, you should investigate it!!!
IMO, losing a bit of CDR when a unexpected shutdown happens is totally acceptable.
However, if you do a normal reboot, then enabling scheduleronly=no should prevent loosing the data in the buffer.
With that being said:
See the last posts in the thread I linked how to properly handle storing CDR data with high volume of traffic.