โดย voip4share » 20 ธ.ค. 2009 13:25
14.8 Section [SQLConfig]
Load gatekeeper settings from a SQL database (in addition to settings read from the config file). A generic ConfigQuery can be used to read almost all setting from the database and/or one of [RasSrv::RewriteE164], [RasSrv::PermanentEndpoints], [RasSrv::Neighbors], [RasSrv::GWPrefixes] queries can be used to load particular settings. Entries read from the SQL database take precedence over settings found in the config file.
Driver=MySQL | PostgreSQL | Firebird | ODBC | SQLite
Default: N/A
SQL database driver to use. Currently, MySQL, PostgreSQL, Firebird, ODBC and SQLite drivers are implemented.
Host=DNS[:PORT] | IP[:PORT]
Default: localhost
SQL server host address. Can be in the form of DNS[:PORT] or IP[:PORT]. Like sql.mycompany.com or sql.mycompany.com:3306 or 192.168.3.100.
Database=gkconfig
Default: N/A
The database name to connect to.
Username=gnugk
The username used to connect to the database.
Password=secret
The password used to connect to the database. If the password is not specified, a database connection attempt without any password will be made. If EncryptAllPasswords is enabled, or a KeyFilled variable is defined in this section, the password is in encrypted form and should be created using the addpasswd utility.
ConfigQuery=SELECT ...
Default: N/A
Define a SQL query used to read gatekeeper settings from the database. The query is parameterized - that means parameter replacement occurs before the query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit in a string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For ConfigQuery only one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of three columns:
column at index 0 - config section name
column at index 1 - config key (option name)
column at index 2 - config value (option value)
Sample query strings:
ConfigQuery=SELECT secname, seckey, secval FROM sqlconfig WHERE gk = '%1'
ConfigQuery=SELECT 'RasSrv::RRQAuth', alias, rule FROM rrqauth WHERE gk = '%1'
RewriteE164Query=SELECT ...
Default: N/A
Define a SQL query used to retrieve rewrite rules from the database for the [RasSrv::RewriteE164] section. The query is parameterized - that means parameter replacement occurs before each query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit into string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For RewriteE164Query only one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of two columns:
column at index 0 - rewrite rule key
column at index 1 - rewrite rule value
Sample query strings:
RewriteE164Query=SELECT rkey, rvalue FROM rewriterule WHERE gk = '%1'
RewriteAliasQuery=SELECT ...
Default: N/A
Define a SQL query used to retrieve rewrite rules from the database for the [RasSrv::RewriteAlias] section. The query is parameterized - that means parameter replacement occurs before each query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit into string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For RewriteAliasQuery only one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of two columns:
column at index 0 - rewrite rule key
column at index 1 - rewrite rule value
Sample query strings:
RewriteAliasQuery=SELECT rkey, rvalue FROM assignedalias WHERE gk = '%1'
AssignedAliasQuery=SELECT ...
Default: N/A
Define a SQL query used to retrieve rewrite rules from the database for the [RasSrv::AssignedAlias] section. The query is parameterized - that means parameter replacement occurs before each query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit into string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For AssignedAliasQuery only one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of two columns:
column at index 0 - rewrite rule key
column at index 1 - rewrite rule value
Sample query strings:
AssignedAliasQuery=SELECT rkey, rvalue FROM assignedalias WHERE gk = '%1'
NeighborsQuery=SELECT ...
Default: N/A
Define a SQL query used to retrieve neighbor entries from the database for the [RasSrv::Neighbors] section. The query is parameterized - that means parameter replacement occurs before each query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit into string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For NeighborsQuery one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of six columns:
column at index 0 - neighbor name (identifier)
column at index 1 - neighbor IP address
column at index 2 - neighbor port number
column at index 3 - optional prefixes (comma separated)
column at index 4 - optional password
column at index 5 - optional dynamic IP flag
Sample query strings:
NeighborsQuery=SELECT nid, nip, nport, npfx, NULL, 0 FROM neighbor WHERE gk = '%1'
PermanentEndpointsQuery=SELECT ...
Default: N/A
Define a SQL query used to retrieve permanent endpoints from the database for the [RasSrv::PermanentEndpoints] section. The query is parameterized - that means parameter replacement occurs before each query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit into string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For PermanentEndpointsQuery only one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of four columns:
column at index 0 - permanent endpoint IP address
column at index 1 - permanent endpoint port number
column at index 2 - permanent endpoint alias
column at index 3 - optional permanent endpoint prefixes (comma separated)
Sample query strings:
PermanentEndpointsQuery=SELECT peip, 1720, pealias, NULL FROM permanentep WHERE gk = '%1'
GWPrefixesQuery=SELECT ...
Default: N/A
Define a SQL query used to retrieve gateway prefixes from the database for the [RasSrv::GWPrefixes] section. The query is parameterized - that means parameter replacement is made before each query is executed. Parameter placeholders are denoted by %1, %2, ... strings. Specify %% to embed a percent character before a digit into string (like %%1), specify %{1} to allow expansion inside complex expressions like %{1}123. For GWPrefixesQuery only one parameter is defined:
%1 - the gatekeeper identifier
It is expected that the query returns zero or more rows of data, with each row consisting of two columns:
column at index 0 - gateway alias
column at index 1 - gateway prefixes (comma separated)
Sample query strings:
GWPrefixesQuery=SELECT gwalias, gwpfx FROM gwprefix WHERE gk = '%1'