[asterisk-users] Realtime Extensions -- Comments?

Matthew Crocker matthew at crocker.com
Tue Aug 22 09:03:29 MST 2006


Add a boolean field to the table then create a view based on the  
value of that field

>>> CREATE TABLE `extensions_table_data` (
>>>  `id` int(11) NOT NULL auto_increment,
	   'isActive' boolean NOT NULL default 'True',
>>>  `context` varchar(20) NOT NULL default '',
>>>  `exten` varchar(20) NOT NULL default '',
>>>  `priority` tinyint(4) NOT NULL default '0',
>>>  `app` varchar(20) NOT NULL default '',
>>>  `appdata` varchar(128) NOT NULL default '',
>>>  PRIMARY KEY  (`context`,`exten`,`priority`),
>>>  KEY `id` (`id`)
>>> ) TYPE=MyISAM;
>>>
>>> Uhm... what abouts comments? What if I wanted to temporarily
>>> deactivate a couple of extensions? Without a comment flag,
>> I'd have
>>> to completely remove those entries from the extensions table!
>>> That's not very friendly is it... Is there a better way?

Then

Create view extensions_table as SELECT  
id,context,exten,priority,app,appdata from extensions_table_data  
where IsActive = True;

Then you can just flip the IsActive bit on/off to remove extensions

--
Matthew S. Crocker
Vice President
Crocker Communications, Inc.
Internet Division
PO BOX 710
Greenfield, MA 01302-0710
http://www.crocker.com




More information about the asterisk-users mailing list