login | register
Sat 17 of May, 2008 [00:57 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Juan Ortega, Thu 15 of May, 2008 [10:33 UTC]: Hi everybody, I'm Juan, an ITCom student, and I need to know what basic elements I need to create a VoIP network. Can anybody helpme, please?,Thank you very much
  • gineta, Wed 14 of May, 2008 [03:58 UTC]: any here not fine the configuration of firewall juniper -screem for VOIP asterisk????
  • Anoop Prabhakaran, Tue 13 of May, 2008 [12:16 UTC]: I am developing Asterisk IVR, Whenever i make a internation call to the IVR system, the DTMF is not getting detected properly, this happens only for the first time, second call onwards system works fine. why this is happening
  • joe, Mon 12 of May, 2008 [04:27 UTC]: Is there an opensource browser based softphone, or a system like Busta where everything is not manages through their website?
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
Server Stats
  • Execution time: 0.34s
  • Memory usage: 2.23MB
  • Database queries: 29
  • GZIP: Disabled
  • Server load: 0.30

Asterisk RealTime Static

Asterisk RealTime Static

NOTE: You can only store a static config OR a RealTime config. You cannot, for example, store sip.conf and use sipfriends via RealTime.

NOTE: If you store sip.conf in the RealTime database, you need to rename/remove the text file otherwise the text file will superceed RealTime.

Extconfig.conf Setup

Add the following line, swapping your own personal values if you wish:


sip.conf => mysql,asterisk,ast_config


You can change mysql to odbc if you want to use odbc.
You can change asterisk to be the name of your database.
You can change ast_config to be the name of the table we will create below.

NOTE: You can bind multiple filenames to the same table, but any tables using RealTime static need to use the format below, not the format shown on the respective non-static RealTime page for that file. The files will be filtered by the `filename` field.

Database Table

NOTE: You can use any table name you wish, just make sure the table name matches what you have the family name bound to.

#
# Table structure for table `ast_config`
#

CREATE TABLE `ast_config` (
 `id` int(11) NOT NULL auto_increment,
 `cat_metric` int(11) NOT NULL default '0',
 `var_metric` int(11) NOT NULL default '0',
 `commented` int(11) NOT NULL default '0',
 `filename` varchar(128) NOT NULL default '',
 `category` varchar(128) NOT NULL default 'default',
 `var_name` varchar(128) NOT NULL default '',
 `var_val` varchar(128) NOT NULL default '',
 PRIMARY KEY  (`id`),
 KEY `filename_comment` (`filename`,`commented`)
) TYPE=MyISAM;



NOTE: The index created on the columns 'filename' and 'commented' is because RealTime does its SELECT query using those 2 columns everytime. That column id must also be unique.

The easiest way to get existing *.conf files into the database is by using bwk's perl script.

http://www.krisk.org/asterisk/ast2sql.pl

It actually doesn't remove inline comments, and Asterisk can be confused by them. Please remove them before you use the script.


Examples

To enable realtime static on your extensions file...let's say it looked like this:
[general]
static=yes

[globals]
CONSOLE=Console/dsp ; Console interface for demo

[default]
exten=_.,1,SetVar(extension=${EXTEN})
exten=_.,2,Macro(dial_agi_ver.1.0.0,${EXTEN},${channel})
exten=h,1,Goto(done,${extension},1)
and let's say you're using the table as defined above with an odbc defined as asterisk in your res_odbc.conf, you could use these insert statments to
INSERT INTO `ast_config` (`cat_metric` , `var_metric` , `filename` , `category` , `var_name` , `var_val` ) VALUES ('0','0','extensions.conf', 'general', 'static', 'yes');
INSERT INTO `ast_config` (`cat_metric` , `var_metric` , `filename` , `category` , `var_name` , `var_val` ) VALUES ('1','0','extensions.conf', 'globals', 'Console/dsp', 'yes');
INSERT INTO `ast_config` (`cat_metric` , `var_metric` , `filename` , `category` , `var_name` , `var_val` ) VALUES ('2','0','extensions.conf', 'default', 'exten', '_.,1,SetVar(extension=${EXTEN})');
INSERT INTO `ast_config` (`cat_metric` , `var_metric` , `filename` , `category` , `var_name` , `var_val` ) VALUES ('2','1','extensions.conf', 'default', 'exten', '_.,2,Macro(dial_agi_ver.1.0.0,${EXTEN},${channel})');
INSERT INTO `ast_config` (`cat_metric` , `var_metric` , `filename` , `category` , `var_name` , `var_val` ) VALUES ('2','2','extensions.conf', 'default', 'exten', 'h,1,Goto(done,${extension},1)');
and add this line to your extconfig.conf:
extensions.conf => odbc,asterisk,ast_config


Note: The table structure for realtime static[sic] is much different than the structure for other realtime tables. You must use the structure above for ALL config files using static. Commented records (where commented != 0) are ignored (or should be, honestly I haven't checked). Someone please who knows what the metric stuff is for please update this example. Thanks - Flobi.

Testing


Throw some data into the above table and issue an 'asterisk reload'. This should get the *.conf info you bound out from database. The /var/log/asterisk/debug should give info on any problems.

Cheers,
Matthew



See Also

Created by utdrmac, Last modification by Emanuele Deserti on Mon 27 of Nov, 2006 [16:49 UTC]

Comments Filter

Multiple tables

by Emanuele Deserti on Monday 27 of November, 2006 [17:02:55 UTC]
You can also use different tables for each configuration file:

File: extconfig.conf

extensions.conf => mysql,databasename,extensions_conf
iax.conf => mysql,databasename,iax_conf
sip.conf => mysql,databasename,sip_conf
voicemail.conf => mysql,databasename,voicemail_conf

And then use the same SQL to create multiple tables:

CREATE TABLE `sip_conf` (
`id` int(11) NOT NULL auto_increment,
`cat_metric` int(11) NOT NULL default '0',
`var_metric` int(11) NOT NULL default '0',
`commented` int(11) NOT NULL default '0',
`filename` varchar(128) NOT NULL default 'sip.conf', 
`category` varchar(128) NOT NULL default 'default',
`var_name` varchar(128) NOT NULL default '',
`var_val` varchar(128) NOT NULL default '',
PRIMARY KEY  (`id`),
KEY `filename_comment` (`filename`,`commented`)
) TYPE=MyISAM;

CREATE TABLE `iax_conf` (
`id` int(11) NOT NULL auto_increment, 
`cat_metric` int(11) NOT NULL default '0', 
`var_metric` int(11) NOT NULL default '0', 
`commented` int(11) NOT NULL default '0', 
`filename` varchar(128) NOT NULL default 'iax.conf', 
`category` varchar(128) NOT NULL default 'default', 
`var_name` varchar(128) NOT NULL default '', 
`var_val` varchar(128) NOT NULL default '', 
PRIMARY KEY  (`id`), 
KEY `filename_comment` (`filename`,`commented`) 
) TYPE=MyISAM;

...and similar for extensions.conf and voicemail.conf

Re: Explanation of metric

by waba on Saturday 22 of July, 2006 [12:54:56 UTC]
I've had a look at the * source code and behaviour on this topic. My conclusions (all this is per-filename, the rows are independent if their filename differs):

- If you are ever going to use var_metric, then do set cat_metric to something different per category. It's like what Jens explained, but the numbers don't have to follow any order (eg, 42, 1 and 999 are all fine)

- You can use var_metric to force the ordering of variables within a category (useful for example with sip.conf allow/disallow). In this case, variables with a lower metric will be evaluated first. So to get "disallow=all" then "allow=alaw", you can give 0 to disallow and 1 to allow.

- If you have some sets of variables for the same category, but with different cat_metric, then the set with the highest metric will entirely overwrite the other ones ("joe|secret|42" cat_metric=0, "joe|type|friend" cat_metric=1 -> there is no joe|secret).

Explanation of metric

by Jens on Thursday 06 of April, 2006 [00:11:55 UTC]
By looking at the source @ http://www.krisk.org/asterisk/ast2sql.pl it is clear that metric can be explained as follows:

cat_metric: each [category] in a config will have its own value, 0 for the first, 1 for the second and so on
var_metric: each variable inside each [category] will have its own value same a cat_metric.

in the example below:
CONSOLE in [globals] will have cat_metric=1 and var_metric=0

[general]
static=yes

[globals]
CONSOLE=Console/dsp ; Console interface for demo

[default]
exten=_.,1,SetVar(extension=${EXTEN})
exten=_.,2,Macro(dial_agi_ver.1.0.0,${EXTEN},${channel})
exten=h,1,Goto(done,${extension},1)

Static and realtime + the metrics

by Paul Sherwood on Monday 06 of February, 2006 [13:21:52 UTC]
Hi I am experimenting loading zapata.conf from realtime/MySQL.

I have had some luck, infact it has worked, I too could do with knowing what the metric stuff is, the comment out does work by the way.

The problem I am having is with the groups, they atill come under the channels section, but they do not as such have their own section, I am figuring that by adding a metric one can associate the various groups? This is quite hard to explain without a sample. But if the first group had a metric of 1 then all the relevant options (context, channel, callerid)in that group should share the same metric, and then group 2 will have a metric of 2 and so on and on??? This is 100% guess work.

I did get this working, then broke it again without making proper config notes/backup.....

Any help would be much appreciated, now have a very nice config. Multiple servers centrally configured. Works a treat excepting zapata.conf, will soon be post a blow by blow how to from the install to the config. Have spent much time figuring all this out and tuning it..... Too many install guides make assumptions that this or that is done and working, they are not that helpful.....

You can definately use static and realtime with the switch statement.






Re: I believe you can use a static and realtime config

by rob314 on Friday 13 of May, 2005 [16:44:34 UTC]
Can you document how you have the static configs for extensions.conf setup? Table structure and an example of the data would be really helpful.

I am running into the same problem where I have multiple contexts that I combine into one. In the past I would just build a context and then issue "include" statements to pull them all together. I can still do that in extensions.conf by building individual contexts with the "switch => Realtime/...." and then building my larger contexts with includes in the flat file but that kinda defeats the purpose of me using RealTime.

My goal is to be able to build my larger contexts using includes in my DB so that I can form my front end around a DB entirely — which I would obviously make available here when I have it completed.

Any input would be greatly appreciated!

bad link

by gmillerd on Wednesday 27 of April, 2005 [10:03:54 UTC]
Anyone have a source for this 'http://asterisk.bkw.org/load.txt'?
Edit

I believe you can use a static and realtime config

by Anonymous on Monday 13 of December, 2004 [02:57:49 UTC]
I store extensions.conf in the static config (since you have to contexts to put the switch => statements in), and also use it for realtime extensions with no problems.

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver