Git Product home page Git Product logo

asterisk_config_file_to_sql's Introduction

asterisk_config_file_to_sql

Script to generate SQL instruction to load Asterisk configuration from a database

This script transforms an Asterisk configuration file to SQL instruction in order to be used in a static Asterisk Realtime Architecture. See: https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration

Usage

./asterisk_config_file_to_sql.pl /etc/asterisk/modules.conf

Example

;
; Asterisk configuration file
;

[modules]
autoload=yes
; An example of loading ODBC support would be:
;preload => res_odbc.so
;preload => res_config_odbc.so
;
noload => pbx_gtkconsole.so
load => res_musiconhold.so
noload => chan_alsa.so
noload => chan_console.so

is converted into:

INSERT INTO ast_config (cat_metric, var_metric, filename, category, var_name, var_val) VALUES ('1', '1', 'modules.conf', 'modules', 'load', 'res_musiconhold.so');
INSERT INTO ast_config (cat_metric, var_metric, filename, category, var_name, var_val) VALUES ('1', '2', 'modules.conf', 'modules', 'noload', 'pbx_gtkconsole.so');
INSERT INTO ast_config (cat_metric, var_metric, filename, category, var_name, var_val) VALUES ('1', '3', 'modules.conf', 'modules', 'noload', 'chan_alsa.so');
INSERT INTO ast_config (cat_metric, var_metric, filename, category, var_name, var_val) VALUES ('1', '4', 'modules.conf', 'modules', 'noload', 'chan_console.so');
INSERT INTO ast_config (cat_metric, var_metric, filename, category, var_name, var_val) VALUES ('1', '5', 'modules.conf', 'modules', 'autoload', 'yes');

SQL table format

CREATE TABLE ast_config
(
  id serial NOT NULL,
  cat_metric int4 NOT NULL DEFAULT 0,
  var_metric int4 NOT NULL DEFAULT 0,
  filename varchar(128) NOT NULL DEFAULT ''::character varying,
  category varchar(128) NOT NULL DEFAULT 'default'::character varying,
  var_name varchar(128) NOT NULL DEFAULT ''::character varying,
  var_val varchar(128) NOT NULL DEFAULT ''::character varying,
  commented int2 NOT NULL DEFAULT 0,
  CONSTRAINT ast_config_id_pk PRIMARY KEY (id)
) 
WITHOUT OIDS;

Misc

Install Perl Asterisk config module

sudo cpan Asterisk::config

See

asterisk_config_file_to_sql's People

Contributors

gaeldb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

greg95000

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.