I’ve recently noticed interesting Asterisk behavior but was not able to dig into it deep enough.
We are using Asterisk 13.26.0. Dialplan on our system contains following priority:
Set(CDR(userfield)=${some_variable})
Call processing goes through this dialplan application just fine when I will stop MySQL server. But if I will lock cdr table from writing, calls will stuck here untill DB server will be started again or Asterisk will receive CANCEL.
I tried enabling as much logging on MySQL server as I could but could not find any activity from Asterisk during execution of mentioned line. So I was hoping that someone will know if this is correct behavior and how someone could see that Asterisk is checking cdr table lock status.
CDR handling, and updates to variables, all occur in the same thread. That means if that thread is blocked in some way (for example posting a CDR) then the rest will be blocked. There is a batching mechanism available[1] which can be enabled to defer posting of CDRs to another thread.
Thank you for your reply! Asterisk works exactly the way you described.
I was not noticing that this happens to second and every next call after table was locket. Asterisk is waiting when it can write CDR for first call after table lock.