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.
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).
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).
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.
<?php $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 } } fclose($file_handle); ?>
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).
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.
<?php $url = "http://localhost/callconnected.php". "?AppLocation=".$_REQUEST['Location']."%26AppDate=".$_REQUEST['Date']; $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); ?>
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.
<?php print "<Response> <Speak>". "You have appointment at ".$_REQUEST['AppLocation']." at ".$_REQUEST['AppDate']." </Speak> </Response>"; ?>
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).
After you have saved your file, open the Task Scheduler, and click on Create task button (Figure 6).
Under the General tab provide a Name for the task and choose Run whether user is logged on or not(Figure 7).
Under the Triggers tab click on New to create a new task (Figure 8).
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).
If you click on Actions tab and New button, you can setup which programs will be opened in the given date (Figure 10).
In the next windows select the task will be performed. Select Start a program and specify the path of the bat file (Figure 11).
Now your system has been configured for making automated calls based on the text file that contains the appointment reminders.
People who read this also read...
- Appointment Reminder Examples: IVR Examples
- OzML reference book: OzML Commands
- How to make an Appointment Reminder with SQL OzML