SMS Gateway software
Ozeki brings you outstanding
SMS Gateway technology. Use our SMS Server products on Windows,Linux, or Android

Developers can use our C# SMS API to send SMS from C#.Net. The C# SMS API comes with full source code

The ozeki PHP SMS gateway software can be used to send SMS from PHP and to receive SMS usig PHP on your website

SMPP SMS Gateway
SMS service providers use our SMPP gateway solution, that offers a high performance SMPP server and SMPP client gateway with amazing routing capabilities
Ozeki Phone System

How to make an Appointment Reminder
with HTTP OzML

Using Ozeki Phone System it is possible to make an automatic reminder call before your appointments. You only need to use an OzML script and HTTP OzML. To do this, a simple, self-made application should send an HTTP request at the given time to the HTTP OzML.

Figure 1 - HTTP OzML

In order to make an Appointment Reminder using HTTP OzML, you need use a scheduler, a text file and some PHP files. The text file contains the appointments (in this format: "dialed number;location of the meeting;date of the call"), the php file will read the appointments from the text file and notify the Ozeki Phone System XE to call the dialed number and read the text out. Finally the scheduler will open the PHP file intermittently.

Step 1: Install PHP and Apache

In order to run a PHP file, you need to use a webserver and PHP environment. In this example we use Wampserver development environment, because it also contains Apache webserver and PHP for Windows. First download Wampserver from the official website of Wampserver and then install it. After you have installed it, you need to save your PHP files to c:wampwww.

Step 2: Prepare Ozeki Phone System for handling HTTP Requests

First open your Ozeki Phone System and login to the system. After you have logged into the phone system, click on Productivity and select HTTP API (Figure 2).

select http api
Figure 2 - Select HTTP API

On the next page, click on Configure, and then under the Advanced tab, specify the IP address of your phone system and the Listen address where it is listening for incoming HTTP requests (Figure 3).

setup listen address
Figure 3 - Setup listen address

Step 3: Develop an application for handling appointments

First create a handleappointments.php file (c:wampwwwhandleappointments.php) that will be opened by a task scheduler. This PHP file will handle the list of the appointments, and in case of a need it sends an HTTP request to your Ozeki Phone System XE that initiates a call (caller.php) with the parameters of the event. You can see below an example for the handleappointments.php file that should be written.

    $file_handle = fopen("appointments.txt", "rb");

	while (!feof($file_handle) ) {
	$line_of_text = fgets($file_handle);
	$parts = explode(';', $line_of_text);

	if (date("F, jS, Y", strtotime($parts[2])) >= date("Y-m-d H:i:s")){	
		$server = "http://localhost/caller.php";				
		$command = http_build_query(array('Dialed' => $parts[0], 
									      'Location' => $parts[1], 
									      'Date' => $parts[2]));
		$params = array('http' => array('method' => "POST",'content' => $command));   

		$context = stream_context_create($params);
		$fp = @fopen($server, 'r', false, $context);
		//Remove the actual line from the file


Code example 1 - handleappointments.php - Handles the list of appointments and in case of a need forwards the task

The following figure shows the proper format of the appointments.txt file. You need to create it in the same directory where the other PHP files (c:wampwww) are created (Figure 4).

appointments.txt file
Figure 4 - appointments.txt file

Step 4: Send the parameters of the call to the HTTP OzML Extension

Now create the caller.php (c:wampwwwcaller.php) file that is being called if an initiation of a reminder call is actual. The next example is responsible for sending the parameters of the call to the HTTP OzML Extension.

	$url = "http://localhost/callconnected.php".
	$server = "http://ozekixepbx.ip:7780";		
	$command = http_build_query(array('Command' => "Call", 
	                                  'Dialed' => $_REQUEST['Dialed'], 
	                                  'CallerDisplayName' => "Appointment Reminder",
									  'Url' => $url));
	$params = array('http' => array('method' => "POST",'content' => $command));   
	$context = stream_context_create($params);    
	$fp = @fopen($server, 'r', false, $context);
Code example 2 - caller.php - Make a call by sending an HTTP Request to the PBX
Read information about the call parameters at the following page. Please change the ozekixepbx.ip text to that IP address where the Ozeki Phone System is installed. The localhost is the address where the sample application is running. If we do not have an installed API Extension than a built-in System extension will manage the call. If you would like to control route the way of the outside calls you need to install an API Extension. API Extension is a standard extension that provides a phone number for your client application connecting through Ozeki Phone System. Using the API, you can build call assistants, call center clients, IVRs or any custom Voice or Messaging application. If you click on this page you can find the full description of the API Extension and the installation of it.

If we installed an API Extension than we can manage of the routing roules of this extension. The Ozeki Phone System makes it possible to connect several types of devices to it, and make dial plans which handle the Call routing for those devices.
The types of dial plans in the Ozeki Phone System are the followings:
  • Inbound dial plans
  • Outbound dial plans
  • Missed dial plans
  • Messages dial plans

You can find more informations about the routing rules if you visit our How to setup Call routing page.

Step 5: OzML Command for speak text to the caller

When the called person picks up the phone, the HTTP OzML Extension sends a request to the address of the previousUrl parameter. If a valid OzML script comes back from there, it executes the commands in it. You can see an example for the callconnected.php application below.

	   "You have appointment at ".$_REQUEST['AppLocation']." at ".$_REQUEST['AppDate']."
Code example 3 - callconnected.php - OzML Command for speak text to the caller

This example reads only one message to the called person with the datas of the appointment. Of course you can apply more complex OzML script, too. You can see an example for that, too, here

You can find examples-written in other languages- for how you can initiate a call via HTTP on the following page.

Step 6: Generate a scheduler

In this section you can see how to add and configure a new task scheduler in Windows. First create a bat file that will be opened in every 10 minutes by the task scheduler. This bat file contains the website address where your PHP file is located (Figure 5).

bat file that will be opened every ten minutes
Figure 5 - Bat file that will be opened in every 10 minutes

After you have saved your file, open the Task Scheduler, and click on Create task button (Figure 6).

Figure 6 - Create Task

Under the General tab provide a Name for the task and choose Run whether user is logged on or not(Figure 7).

general tab
Figure 7 - General tab

Under the Triggers tab click on New to create a new task (Figure 8).

triggers tab
Figure 8 - Triggers tab

In the next window, select Repeat task every 1 hour where you can configure how often your bat file will be opened. In addition you can setup the duration of the task. If you have configured the task, click on Ok button (Figure 9).

task configuring
Figure 9 - Task configuring

If you click on Actions tab and New button, you can setup which programs will be opened in the given date (Figure 10).

actions tab
Figure 10 - Actions tab

In the next windows select the task will be performed. Select Start a program and specify the path of the bat file (Figure 11).

specify the actions and the program path
Figure 11 - Specify the action and the program path

Now your system has been configured for making automated calls based on the text file that contains the appointment reminders.

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