How to make scripted calls from Postgre SQL
This article is a detailed guide on how to make scripted calls from Postgre SQL. You are required to have Ozeki Phone System installed to implement this solution. We are going to create a database and set up all neccessary configurations in Ozeki Phone System, then use this system to make a test call to a mobile device. We hope you will find this article helpful and informative. Now let's get started!
What is Postgre SQL?
PostgreSQL is a powerful, open source object-relational database system with over 30 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance. PostgreSQL is used as the primary data store or data warehouse for many web, mobile, geospatial, and analytics applications. PostgreSQL can store structured and unstructured data in a single product.
What is a scripted call?
A call script, a written script entailing correct wording and logic, assists an agent in handling a contact. Call scripts can be easily integrated with telephone and IVR systems in order to provide the agent useful information about the customer and tailor each interaction accordingly.
What is Ozeki Phone System?
Ozeki Phone System is software for Windows that transforms a computer into a communication server. Ozeki Phone System lets you build applications like PBX, VoIP gateway, IVR and ACD. It can be used for voice calls, video calls, SMS messaging and new-, revolutionary channels like real time communication through webbrowsers and mobile phones.
How to make scripted calls from Postgre SQL (video tutorial)
In this video tutorial you will leatn how to make scripted calls from Postgre SQL. For this process you need to install Postgre SQL and Ozeki Phone System. In this example, we are going to create a databas and make a call with this database using Ozeki Phone system. Follow along the steps presented in this video to implement this solution successfully.
// ******************************************* // Create the database // ******************************************* CREATE ROLE ozekiuser WITH LOGIN SUPERUSER CREATEDB CREATEROLE INHERIT NOREPLICATION CONNECTION LIMIT -1 PASSWORD 'ozekipass'; CREATE DATABASE ozekidb WITH OWNER = ozekiuser ENCODING = 'UTF8' CONNECTION LIMIT = -1; // ******************************************* // Create the database table layout // ******************************************* CREATE TABLE ozekicallsin ( id serial, sender varchar(255), receiver varchar(255), msg text, senttime varchar(100), receivedtime varchar(100), operator varchar(100), msgtype varchar(160), reference varchar(100) ); CREATE TABLE ozekicallsout ( id serial, sender varchar(255), receiver varchar(255), msg text, callid varchar(255), startime varchar(40), endtime varchar(40), status varchar(40), talkduration varchar(40), ringduration varchar(40), operator varchar(100), errormsg varchar(1024) ); CREATE TABLE ozekicallscripts ( id serial, msg text, phonenumber varchar(40) ); // ******************************************* // How to make a call: example 1 // The script is in the ozekicallsout table // ******************************************* INSERT INTO ozekicallsout (status,receiver,msg) VALUES ('send','101',' <?xml version="1.0"?> <Response> <Request> <OnAnswered> <Speak Party="caller">You will get dtmf keys 123.</Speak> <SendDTMF Party="caller" Keys="123"></SendDTMF> <Hangup/> </OnAnswered> </Request> </Response> ') // ******************************************* // How to make a call: example 2 // The script is in a file on drive C // ******************************************* INSERT INTO ozekicallsout (status,receiver,msg) VALUES ('send','101','C:\ozml\script.ozml') // ******************************************* // How to make a call: example 3 // The script is in the ozekicallscripts table // ******************************************* INSERT INTO ozekicallscripts (id,msg) VALUES ('1',' <?xml version="1.0"?> <Response> <Request> <OnAnswered> <Speak Party="caller">You are using call script 1. Thank you for calling. </Speak> <Hangup/> </OnAnswered> </Request> </Response> ') INSERT INTO ozekicallsout (status,receiver,msg) VALUES ('send','101','1')
Download PostgreSQL installer
The first step in setting up this solution, is to download the PostgreSQL installer. Visit the official website here. Click on the download link for Windows 64-bit (Figure 1). This will start downloading the PostgreSQL installer to your browser's default download directory.
Install database
Run the installer you have previously downloaded. Click Next on the welcome screen to proceed (Figure 2).
Define admin password
On this screen you will be asked to define the admin password. Enter your desired password into both of the textboxes (Figure 3). Click to Next continue.
Installation process
Wait for the installation process to complete (Figure 4).
Installation finished
When the installation process is completed, click on Finish (Figure 5).
Create ozekiuser
Now that you have installed Postgre SQL, it's time to create a database user. This is done in pgAdmin. The entire code for the project can be found above. Paste the code shown in Figure 6 into the text editor. Run the code to create the database user.
Create database
Paste the code shown in Figure 7 into the text editor. Run the code to create the database.
Create ozekicallsin table
Paste the code shown in Figure 8 into the text editor. Run the code to create a table for incoming calls.
Create ozekicallsout table
Paste the code shown in Figure 9 into the text editor. Run the code to create a table for outgoing calls.
Create ozekicallsscripts table
Paste the code shown in Figure 10 into the text editor. Run the code to create a table for call scripts.
Create new serevice extension
The database is now properly set up. Now you have to switch over to Ozeki Phone System. Click on Extensions inside the menu on the right (Figure 11). Click on the blue Create new Extension button on the top. Click on the Service icon on the right.
Select SQL call type
Here you need to select which type of call extension you want to create. Select SQL Call by clicking on it (Figure 12).
Install PostgreSQL call extension
Find Postgre SQL Calls and click on Install next to it (Figure 13).
Setup connection details
After you have selected Postgre SQL Calls, you must configure your new connection. This is done in the Connection settings section of Extension details (Figure 14). Here you need to provide the following details by entering them into the corresponding textboxes:
- Server (IP address)
- Port
- Database
- UserID
- Password
Connect to PostgreSQL database
You have now created your connection. Enable your connection by clicking on the swtich button on the right (Figure 15). The switch turns green to indicate that a connection is active.
Create new outside line
After you have successfully created the database connection, you have to create a new outside line connection. Click on Outside lines inside the menu on the left (Figure 16). Click on the blue Create new Phone Line button on the top. In the Phone line details menu on the right, click on VoIP PBX. This will bring you to a configuration menu.
Setup outside line connection
In this menu on the right side of the screen, you need to configure your outside line connection (Figure 17). Here you need to provide the following details by entering them into the corresponding textboxes:
- Display name
- Username
- Register name
- Password
- Domain (IP address)
- Port
Create dial plan rule
he last step before you are able to use the database, is to create a dial plan rule. Click on Dial plan inside the menu on the left (Figure 18). Click on the blue Create new Route button on the top. Look for the Settings section in the Route details menu on the right. Set From: as 9000. Set To: as voip_Phone_Line_1.
Insert call into database
You are now able to use the databas for scripting calls. Open the details page of your MSSQL connection. Click on the SQL tab to open the SQL text editor. Paste the code shown in Figure 19. Click on Execute to run the code, and insert the call into the database.
Phone called from database
Here you can see that the phone is being called from the database (Figure 20).
Summary
This is the end of the tutorial. You are now able to send SMS using Postgre SQL and Ozeki Phone System. We hope you found the information presented in this article helpful. For more information on Ozeki Phone System and our various different solutions, check out our other guides too.
More information
- Oracle
- MSSQL
- ODBC
- OLEDB
- PostgreSQL
- MSAccess
- SQLExpress
- MySQL
- SQLAnywhere