Export VoIP Results to MySQL

You are here
Export VoIP Results to MySQL

Overview

The prerequisites for this tutorial are that MySQL has already been installed and that a database has been created. The database name in these examples will be mcs.

Create Table

The CREATE TABLE statement below can be used to create a table named myvoip. The table includes some generic test metrics, such as ISP, IP and Session ID (SID), along with the results of the test.

CREATE TABLE myvoip (recordid int, testid int, jitter float, djitter float, loss float, dloss float, uorder float, dorder float, discards float, mos float, reg int, invite int, bye int, PRIMARY KEY (recordid));

The image below is an example of copying and pasting the above statement into a MySQL command prompt. Once the table has been created the describe tablename; command can be used to view the newly created table structure.

myvoip mysql create table

Enable MySQL

The next step is to enable MySQL in MyConnection Server (MCS). This step may have already been done. If not, click here.

Create Profile

With MySQL enabled and the table created it's time to configure MCS to export data. The first step in doing this is to create an SQL profile.

From the MCS main menu click on Manage SQL Profiles, which is in the administration panel, as shown below.

sql profiles

On the resulting page click the Create new SQL profile link, as shown below.

create new sql profile

The first step when creating a new profile is to enter the connection settings.

  • Name: Enter a name for the profile. This will appear in the list of profiles on the previous page.
  • Server Type & Address: Select MySQL from the drop down list box and then enter the IP/domain and port number of the MySQL database.
  • Credentials & DB: Enter the login credentials for the MySQL server and the database name that contains the table created in the first part of this tutorial.
  • Run Check the Run... box. With the box checked the SQL profile will run each time a Speed test is run, ensuring all data gets exported.

sql connection settings

Save the profile, which will take you back to the profiles list. Immediately modify the profile as the next step is definiing the export data.

modify

Define Export Data

The SQL Statements to run text box is where the export data is specified, in the form of an INSERT INTO statement, as shown below.

The INSERT INTO statement below matches the CREATE TABLE specified in the first step. So, simply copy and paste it into the text box.

[voip] INSERT INTO myvoip (recordid, testid, jitter, djitter, loss, dloss, uorder, dorder, discards, mos, reg, invite, bye) VALUES (%RECORDID%, %TESTID%, %VOIP.JITTER%, %VOIP.DJITTER%, %VOIP.LOSS%, %VOIP.DLOSS%, %VOIP.ORDER%, %VOIP.DORDER%, %VOIP.DISCARDS%, %VOIP.MOS%, %VOIP.REGISTER%, %VOIP.INVITE%, %VOIP.BYE%);

Once pasted it should look like this:

insert into statement

Save the profile to complete the process!

Now, whenever a VoIP test is run, this MySQL Export should run and put data in the database.

When using a MySQL command prompt the data for a table can be viewed by using the command select * from tablename, as shown below.

view data in mysql table command prompt

Note: If data does not appear in the database check the SQL logs. These can be found in the /logs/ directory of the root install of MCS.