Asterisk, AGI, and The Dreaded 510 Invalid or unknown command

John Congdon
Jul 11, 2018 · 2 min read

Lately, I have been upgrading some Asterisk boxes for one of our clients, PhoneBurner.com. And I ran across this error and spent plenty of time Googling for it, without resolution. Here’s hoping that it helps someone else that’s in my shoes.

There were actually a few things happening here. When I initially upgraded Asterisk, everything was fine. However, I immediately upgraded PHP as well, which runs the AGI scripts. I was then pulled in other directions for a week or two, so things got a little muddled in the old memory banks.

Once I got back to work on it, I had forgotten that I tested prior to upgrading PHP. I then noticed these “510 Invalid or unknown command” error messages. After hours of searching, I called it a night, hoping to be refreshed in the morning.

I brought the issue up to someone else who happened across a blog post that only helped me accidentally. Their solution was to turn off debugging… but it got me thinking… Wait, maybe I should turn debugging on.

I did just that, and finally found the culprit. While upgrading PHP, I had turned debugging on in the database access layer and forgot to turn that off. It was writing out to STOUT, which was directly interacting with the AGI.

Bottom line… Don’t hide your errors. Don’t ignore them either. There could be output from your AGI Script that you are not aware of which is causing them. Find that, fix it, and you’ll be good to go.

I enjoy getting back into other areas of DevOps. While I love coding in PHP, it’s also nice to change things up and do things a little differently.

DiegoDev Group

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store