Setup MySQL for sending and receiving SMS

In this chapter you can learn about how to send and receive SMS messages using a MySQL database server with your Ozeki Phone System. In this guide you can get information about the installation steps, the database connection string, the database connection type and the database table layout for MySQL database server.

In order to send or receive SMS messages using a MySQL database server you need to install the MyODBC driver on your computer. You can download this driver from the MySQL website. The newest drivers can give better performance and more reliable connection.

After you have installed the MyODBC driver to your computer, you need to install an SQL SMS API in the Ozeki Phone System.

During the configuration you should choose the following database connection type:

Odbc

You should use the next database connection string properly for your MyODBC driver:

Driver={MySQL ODBC 5.1 Driver};Server=127.0.0.1;Database=OzekiPBX;User=ozeki;Password=qwe123;Option=4;

The database connection string have to be modified to match your database. You should use the ip address or the hostname of your database server instead of the "127.0.0.1". Replace "OzekiPBX" to the name of you database and replace "ozeki" and "qwe123" to the username and password that can be used to connect to your database server.

The connection string and the connection type should be entered on the SQL SMS API configuration form.

Figure 1 shows the SQL queries that will send the SMS messages from your database.

sql queries for receiving sms messages
Figure 1 - SQL queries for receiving SMS messages

Under the SQL for receiving tab, you need to provide an SQL query that will store the incoming SMS messages. Figure 2 shows the SQL query that you need to use.

sql query for sending sms messages
Figure 2 - SQL query for sending SMS messages

After the SQL SMS API has been configured in the Ozeki Phone System, you need to create the database tables for SQL SMS API. Use the following table layout:

-- -----------------------------------------------------
-- Table `OzekiPBX`.`ozpbxmessageout`
-- -----------------------------------------------------
CREATE TABLE `ozpbxmessageout` (
    `id` int(11) auto_increment,
    `sender` varchar(30) default NULL,
    `receiver` varchar(30) default NULL,
    `msg` text default NULL,
    `senttime` varchar(100) default NULL,
    `receivedtime` varchar(100) default NULL,
    `reference` varchar(100) default NULL,
    `status` varchar(20) default NULL,
    `msgtype` varchar(160) default NULL,
    `operator` varchar(100) default NULL,
    `errormsg` varchar(250) default NULL,
    INDEX (`id` ASC),
    PRIMARY KEY (id))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

-- -----------------------------------------------------
-- Table `OzekiPBX`.`ozpbxmessagein`
-- -----------------------------------------------------
CREATE TABLE `ozpbxmessagein` (
    `id` int(11) auto_increment,
    `sender` varchar(30) default NULL,
    `receiver` varchar(30) default NULL,
    `msg` text default NULL,
    `senttime` varchar(100) default NULL,
    `receivedtime` varchar(100) default NULL,
    `extension` varchar(100) default NULL,
    INDEX (`id` ASC),
    PRIMARY KEY (id))
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8;

It is strongly recommended to maintain an index in the database for the 'id' field of the outgoing SMS table to support faster SQL updates.

If you have any questions or need assistance, please contact us at info@ozekiphone.com.

Dig deeper!
People who read this also read...

More information