Mysql DB for asterisk

I have a asterisk box. I have successfully setup mysql database for asterisk realtime. I wanted to know if there is a bash,shell script that I could use to disconnect or temporarily block the incoming and outgoing of a specific sip phone or extension? How will am I going to do that? Do I have to put some flags on the extensions table of my database? Please help what tool can I use to temporarily disallow or disconnect a service from an extensions in the database. Please advised, I’m already working on this for about a month. Thanks.

Best regards,


I also use realtime, and a quick glance at my database and this is the first thing that would seem to work.

In the sip_buddies (or whatever you use) database find the phone you want to block and set “disallow” to “all” and set “allow” empty. You may have to reload asterisk depending if you have rtcaching turned on or not

That should make it so asterisk and the phone cannot agree on any codecs and disallow the call.

There may be a simper, more effective way, but to me it seems like that should work.


i use a little AGI that puts a flag in a MySQL table for the device, and another AGI that queries it whenever there’s an outgoing call.

it’s probably “cheaper” to do it with ASTDB, but i like AGI and my script does a few other things too so it’s easier to bundle it all in the same call.