Asterisk Realtime Authentication Rejections

We run Asterisk Realtime with thousands of SIP peers registering all the time. On the odd occasion, for reasons we can’t explain, Asterisk will reject the CORRECT authentication from some peers.

At first, we thought it was to do with the SIP peers, but we’re seeing it on different hardware - the problem is Asterisk. We’ve changed the sip_peers mysql table from myisam to InnoDB (for row-level locking instead of table-level locking) but that doesn’t seem to have helped. There must be another reason why Asterisk is choosing to send an Auth Rejection to SIP peers.

We noticed this behaviour early on when we were using 1.2 with realtime. We’ve been running 1.4 on realtime for well over a year and we’re still seeing the same problem (During this time we have changed the servers several times too).

It isn’t such a huge problem on most SIP endpoints - they’ll simply retry, but SOME will give up and wait for a reboot - the device is assuming that its auth details are actually incorrect!.

Has anyone else experienced this? And more importantly: does anyone know how to fix this?. I was going to log this as a bug, but I haven’t been able to catch it in the act. It just happens at a random time. If you’re waiting for it to happen, it can take anywhere from a few hours to a month to re-surface.