Asterisk™: The Definitive Guide. In this chapter we are going to explore integrating some. Asterisk features and functions into a database. There are several databases. Linux, but we have chosen to limit our discussion to the two. Postgre. SQL and My. SQL. We will also explain how to configure Linux to. Microsoft SQL database via ODBC; however, configuration of the. Windows/Microsoft portion is beyond the scope of this book. Regardless of which database you use, this. ODBC connector, so as long as you have some familiarity with getting your. An interesting article to setup a full-featured Elastix 5 PBX and 3 CX unified communication server on Linux. 2017-04-05: Distribution Release: CentOS 6.9: Johnny Hughes has announced the release of CentOS 6.9, a Red Hat-sponsored Linux distribution built from the source code. What are your thoughts on CentOS? Please include a few pros and a few cons, along with your overall impression of the operating system. Version. This book is intended to be gentle toward those new to Asterisk, but we assume that you’re familiar with basic Linux administration, networking, and other IT. ODBC- ready, you shouldn’t have any problems with this. Integrating Asterisk with databases is one of. The power of the database will enable you to use dynamically changing data. Asterisk systems or integrating with web- based services. Our favorite. dialplan function, which we will cover later in. While not all Asterisk deployments will require. Installing and Configuring Postgre. SQL and My. SQLIn the following sections we will show how to install and. Postgre. SQL and My. SQL on both Cent. OS and Ubuntu.[1. It is recommended that you only install one database at a. Pick the database you are most. Installing Postgre. SQL for Cent. OSThe following command can be used to install the. Postgre. SQL server and its dependencies from the console: $ sudo yum install - y postgresql- server. Install 3 Package(s). Upgrade 0 Package(s). Total download size: 6. M. Is this ok [y/N]: y. Then start the database, which will take a. Now. head to the section called “Configuring Postgre. SQL” for. instructions on how to perform the initial configuration. Installing Postgre. SQL for Ubuntu. To install Postgre. SQL on Ubuntu, run the following. You will be prompted to also install any additional packages. Press Enter to accept the list of dependencies, at. Postgre. SQL will be. After this operation, 1. MB of additional disk space will be used. Do you want to continue [Y/n]? Now. head to the section called “Configuring Postgre. SQL” for. instructions on how to perform the initial configuration. Installing My. SQL for Cent. OSTo install My. SQL on Cent. OS, run the following command. You. will be prompted to install several dependencies. Press Enter to accept, and the My. SQL server and. dependency packages will be installed: $sudo yum install mysql- server. Install 5 Package(s). Upgrade 0 Package(s). Total download size: 2. M. Is this ok [y/N]: y. Then start the My. SQL database by running: $sudo service mysqld start. Now head to the section called “Configuring My. SQL” to perform the initial. Installing My. SQL for Ubuntu. To install My. SQL on Ubuntu, run the following command. You. will be prompted to install several dependencies. Press Enter to accept, and the My. SQL server and its. Need to get 2. 4. MB of archives. After this operation, 6. MB of additional disk space will be used. Do you want to continue [Y/n]? During. the installation, you will be placed into a configuration wizard to help. You will be. prompted to enter a new password for the root user. Type in a strong password and press Enter. You will then be asked to confirm the. Type your strong password again, followed by Enter. You will then be returned to the. The My. SQL service will. Now head to the section called “Configuring My. SQL” to perform the initial. Next, create a user called asterisk. You can switch. to the postgres user by using the following. Note. At the time of this writing, Postgre. SQL. version 8. 1. Cent. OS, and 8. 4. Ubuntu. Then run the following commands to create. PEnter name of user to add: asterisk. Enter password for new user: Enter it again: Shall the new role be a superuser? Shall the new user be allowed to create databases? Shall the new user be allowed to create more new users? CREATE ROLENow, edit the pg_hba. Postgre. SQL server over the TCP/IP socket. On Cent. OS, this file will be located at /var/lib/pgsql/data/pg_hba. On Ubuntu. you will find it at /etc/postgresql/8. At the end of the file, replace everything. TYPE DATABASE USER CIDR- ADDRESS METHODwith the following: # TYPE DATABASE USER CIDR- ADDRESS METHOD. Now you can create the database that we. Call the database asterisk and set the owner to your. CREATE DATABASEYou can set the password for the. ALTER USER asterisk WITH PASSWORD 'password'". Exit from the. postgres user: $exit. Then restart the Postgre. SQL server. On. Cent. OS: $sudo service postgresql restart. Note. You need to restart the Postgre. SQL. service because you made changes to pg_hba. On Ubuntu: $sudo /etc/init. Note. On Ubuntu 1. You can verify your connection to the Postgre. SQL server via. TCP/IP, like so: $psql - h 1. U asterisk. Password for user asterisk. Welcome to psql 8. Postgre. SQL interactive terminal. Type: \copyright for distribution terms. SQL commands. \? for help with psql commands. You’re. now ready to move on to the section called “Installing and Configuring ODBC”. With the My. SQL database now running, you should secure. Conveniently, there is a script you can execute that. The script is pretty straightforward, and after. Execute the following script: $sudo /usr/bin/mysql_secure_installation. Then connect to the database console so you. Enter password: After. You can now create your. CREATE USER command. The % is a wildcard indicating the. IDENTIFIED BY the password. Note the trailing semicolon: mysql> CREATE USER 'asterisk'@'%' IDENTIFIED BY 'some_secret_password'. Query OK, 0 rows affected (0. Let’s also. create the initial database you’ll use throughout this chapter: mysql> CREATE DATABASE asterisk; Query OK, 1 rows affected (0. Now. that you’ve created your user and database, you need to assign. GRANT ALL PRIVILEGES ON asterisk.* TO 'asterisk'@'%'; Query OK, 0 rows affected (0. Finally. exit from the console and verify that your permissions are correct by. Bye. # mysql - u asterisk - p asterisk. Enter password: mysql> You’re now ready to move on. Installing and Configuring ODBC”. Installing and Configuring ODBCThe ODBC connector is a database abstraction layer that. Asterisk to communicate with a wide range of. Asterisk wants to support. This saves a lot. There is a slight performance. Asterisk and. the database, but this can be mitigated with proper design and is well. Asterisk system. Before you install the connector in Asterisk. ODBC into Linux itself. To install the ODBC drivers, use one of the. On Cent. OS: $sudo yum install unix. ODBC unix. ODBC- devel libtool- ltdl libtool- ltdl- devel. Note. If you’re using a 6. Asterisk links. against the wrong libraries. On Ubuntu: $sudo apt- get install unix. ODBC unix. ODBC- dev. You’ll also need to install the. ODBC development package, because Asterisk uses. ODBC modules we will be using throughout this. Warning. The unix. ODBC drivers. shipped with distributions are often a few versions behind the. If you have stability. ODBC, you may need to. Just be sure to remove the. ODBC drivers via your package manager first. By default, Cent. OS will install the drivers. Postgre. SQL databases via ODBC. To install the drivers. My. SQL, execute the following command: $sudo yum install mysql- connector- odbc. To install the Postgre. SQL ODBC connector on. Ubuntu: $sudo apt- get install odbc- postgresql. Or. to install the My. SQL ODBC connector on Ubuntu: $sudo apt- get install libmyodbc. Configuring ODBC for Postgre. SQLConfiguration for the Postgre. SQL ODBC driver is done in. On Cent. OS the default file already contains. Postgre. SQL, so just verify that the data. The file will look like the following: [Postgre. SQL]. Description = ODBC for Postgre. SQL. Driver = /usr/lib/libodbcpsql. Setup = /usr/lib/libodbcpsql. S. so. File. Usage = 1. On Ubuntu, the /etc/odbcinst. Add the. following to the odbcinst. Postgre. SQL]. Description = ODBC for Postgre. SQL. Driver = /usr/lib/odbc/psqlodbca. Setup = /usr/lib/odbc/libodbcpsql. S. so. File. Usage = 1. Note. On 6. 4- bit systems, you will need to. In either case, you can use cat >. Just use Ctrl+D to save the file once you’re done. Verify that the system is able to see the. It should return the label name. Postgre. SQL if all is well: $odbcinst - q - d. Postgre. SQL]Next, configure the /etc/odbc. Asterisk will use to reference this configuration. If. at any point in the future you need to change the database to something. Asterisk to continue to point to the same. Description = Postgre. SQL connection to 'asterisk' database. Driver = Postgre. SQL. Database = asterisk. Servername = localhost. User. Name = asterisk. Password = welcome. Port = 5. 43. Protocol = 8. Read. Only = No.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
October 2017
Categories |