How to register users from register

From Yate Documentation
Revision as of 14:52, 5 April 2013 by Dana (Talk | contribs)

Jump to: navigation, search

Suppose that you have this scenario: you want to register users from a database using PostgreSQL.


Contents

Startup configuration file

The main Yate startup configuration is stored in the file yate.conf.

Please notice that "yate.conf" under Windows has to be named "yate-service.conf" if you are running it as a service or "yate-console.conf" while running the console version.
In other words it has to match the executable file name or the file would not be loaded and default configuration will be applied.
Note: By default in Yate all modules are loaded at startup. By setting parameter modload=no in section [default], you have to enable modules by hand to load them.
This is done in section [modules] using parameter that contains the name of the module point yate (e.g pgsqldb.yate=true for using module pgsqldb).

File "yate.conf" controls the loading of modules in Yate. In your yate.conf these modules should be enabled by hand, only if you set modload=disable:

[default]
modload=disable

[modules]
;Module used to make the connection between Yate and the PostgreSQL database.
pgsqldb.yate=true 
;Module used do authenticate, register, route users in the database.  
register.yate=true

Create database

After creating your database with the tables that you need (here is an example of a database schema), you have to tell Yate what database to use.

Configure database in Yate

Set the name of the database

The module used is register.conf and in section [default] the name of the database connection must be set:

[default]
account=Database_Name

Set the connection information of database

In PostgreSQL configuration file: pgsqldb.conf we have to set the connection data for this database in a section that will have the same name as the account settled in register.conf:

[Database_Name]
host=
database=
user=
password=
  

After "=" you have to write your connection information.


Register users

See an example of database schema to keep the users.

In register.conf in section [general] the user.register must be enabled.

[general]
user.register=yes

[user.register]
query=UPDATE users SET location='${data}',expires=CURRENT_TIMESTAMP + INTERVAL '${expires} s' WHERE username='${username}'

See also

Personal tools
Namespaces

Variants
Actions
Preface
Configuration
Administrators
Developers