- He would like customers to be able to make appointments 24/7 even after closing hours.
- He would like his customers to receive a confirmation SMS after they make an appointment.
- He would also like customers to be able to check their current appointment any time of the day.
- He would like a web page where he could see current appointments.
- The manager of ABCauto will also like to update car repair status using a telephone system.
Telestax offered ABCauto a solution powered by Telscale Restcomm using the Visual Designer as a great way to quickly accelerate building an IVR application. Since, Restcomm can integrate with other Service Providers, the solution will allow SMS through the Voip Innovations network.
List of Car Service Application features:
- menu 1 – make new appointment
- menu 2 – check car status
- menu 3 – Admin for ABCauto owner to update car status and set cost of repair. At the end of this, an SMS will be sent to the customer, stating car has been repaired and the cost of repair. Menu 3 is password protected with password set to (1234)
Requirements:
– knowledge of Restcomm
– knowledge of PHP and MySQL
– knowledge of JSON
NOTE: In order to set up the application you need to register SMS enabled DID in Voip Innovations
You also need to add the Restcomm.xml configuration section that allows you to send SMS (with voip innovations IP)
1
2
3
4
5
6
7
|
<!—The SMS aggregator isresponsible forthe handling of SMS messages
inside of RestComm.Refer tothe org.mobicents.servlet.sip.restcomm.SmsAggregator
interfaceformore information.—>
<sms–aggregator class=“org.mobicents.servlet.restcomm.sms.SmsService”>
<outbound–prefix>#</outbound-prefix>
<outbound–endpoint>64.136.174.30</outbound–endpoint>
</sms–aggregator>
|
Step 1
- Log into your Restcomm Admin UI
- Create new project
- Create modules as follows:
– Welcome
– getAvailableDay
– chooseDay
– enterPhone
– validateApp
– confirmationApp
– getCarBrand
– chooseCarBrand
– CarStatus
– StatusAndCost
– CarStatusConfirm
– AdminGetPwd
– AdminCheckPwd
– AdminGetPhone
– AdminGetStatusCode
– AdminSetCost
– AdminStatusUpdate
– AdminSendSMS
Step 2
- Enter your phpMyAdmin
- Create new database
- Create the following MySQL tables:
– appointments; fields: id, day, car_brand, telephone
– calendar; fields: numbers, days; Days and their numbers should be inserted here. Use Insert button in order to add records in the table. The result after all records being added should be:
– carstatus; fields: telephone, car_brand, carStatus, cost
– car_brand; fields: number, brand_name
Car brands and numbers should be inserted in the table. Use again Insert button to add records in the table. The result should be similar to:
-status_list; fields: number, status_list
In this table add status for number 1 – “Repaired” and for 2 – “Welcome back, ABC auto has not yet updated the status for”.
You will need the following PHP scripts in order to make the application work.
- checkAppointment.php
- getCarBrand.php
- validateAppointment.php
- getCarStatus.php
- adminStatusUpdate.php
- adminCheckPwd.php
getCarBrand.php
validateAppointment.php
getCarStatus.php
adminStatusUpdate.php
adminCheckPwd.php
Step 3
- Go to Restcomm Visual Designer
- In Welcome module remove the default Say message and drag and drop Collect verb.
- Drag and drop Say into Collect prompt. Type following in the text area: “Welcome to ABC Auto Repair. To schedule an appointment press 1. To check your car status press 2. For admin press 3?.
- From the right side choose menu.
- Select as digit 1 target to be getAvailableDay module.
- Select as digit 2 target to be CarStatus module.
- Select as digit 3 target to be AdminGetPwd.
Step 4
- Go to getAvailableDay module.
- Add External Service from the left side.
- Service Url is actually the path to the PHP script checking the appointment – checkAppointment.php
- Click on Add assignment button. Type available_days and set module as a scope. In right side from the first drop down menu choose object, from the second drop down menu select propertyNamed then type the name of the variable – available_days. Click add operation. Select value from the drop down menu and click on Done button.
- Go to Continue to and select fixed. Then select chooseDay module from the drop down menu on the right side.
Step 5
- Go to chooseDay module.
- Drag and drop Collect.
- In Say command in Collect’s prompt type the following: “Appointment days menu, $available_days”.
- In the right part choose to collect digits.
- Assign to app_day_chosen. Set module as a scope.
- Continue to getCarBrand.
- This module ask user to choose day for his appointment.
Step 6
- Go getCarBrand module.
- Add External Service.
- Service URL is a PHP script which allows customer to choose a car brand for his appointment – getCarBrand.php.
- Add assignment. Assign to getCarBrand. Select online application as a scope. Add gerCarBrand as a value in the same way as in step 4.
- Select chooseCarBrand from the drop down menu in Continue to area.
Step 7
- Go to chooseCarBrand module.
- Add Collect. Type the following in the Say area “select your car brand from the list, $getCarBrand”.
- Choose to Collect digits. Assign to car_brand_chosen. Select application as scope.
- Continue to enterPhone.
Step 8
- Go to enterPhone module.
- Add Collect. Type following in Say are: “Enter your 7 digit phone number and press star”. Customer has to enter his mobile number in order to finish the appointment.
- Set star as a finish on key.
- Choose to Collect digits. Assign to app_phone_chosen. Set application as scope.
- Continue to validateApp module.
Step 9
- Go to validateApp module.
- Add External Service
- Service URL uses PHP script to validate the appointment – validateAppointment.php
- Add three URL parameters: app_day, car_brand, app_phone and their values as follows: $app_day_chosen, $app_phone_chosen and $car_brand_chosen.
- Add three assignments:
– day_conf , choose application as scope. From the right side add confirm_day value.
– phone_conf, choose application as scope. Add confirm_phone as value.
– brand_conf, choose application as scope. Add confirm_brand value. - Continue to confirmationApp module.
Step 10
- Go to confirmationApp module.
- Add Collect and in Say text area type: “You have an appointment at ABC auto on $day_conf for your $brand_conf. Your appointment phone number is $phone_conf. You may hang up or press 1 to go back to the main menu”. This module informs user that appointment has been confirmed.
- Select to create a Menu. Set Welcome module as target of the first digit.
Step 11
- Go back to CarStatus module
- Add Collect. Type following in Say area: “Please enter your phone number and press star”.
- Set star as finish on key.
- Select to Collect digits. Assign to app_phone. Select module as a scope. Choose to continue to StatusAndCost module.
Step 12
- Go to StatusAndCost module.
- Add External Service.
- Service URL uses PHP script – getCarStatus.php which is taking information from carstatus mysql table and inform user about the status of the car registered under the number he entered and the cost of the service.
- Add two URL parameters:
– app_phone with $app_phone value; - Add assignment:
– car_status , choose module as scope. Add car_status as value. - Continue to CarStatusConfirm module.
Step 13
- Go to CarStatusConfirm module
- Add Say. Type the following in the text area: “$car_status Thank you for calling ABC Auto Repair”. Customer will hear car status for his number and the cost for the service.
- Type following in SMS Text area: “$car_status Thank you for calling ABC Auto Repair.”. This message will include the telephone entered by the customer, the status of the car for that number and the cost for the service.
- In order to receive sms to the number you are calling from you need to use $core_From variable. Type it in To are
- Type the number from which you want to send SMS in From area.
- In Continue to you can set next module to which you want the application to proceed. In this application there isn’t continue to module.
- Status callback takes a URL as an argument. When the SMS message is actually sent, or if sending fails, RestComm will make an asynchronous POST request to this URL with the parameters ‘SmsStatus’ and ‘SmsSid’. Note, ‘statusCallback’ always uses HTTP POST to request the given url. You can leave the field blank if you don’t need it.
Step 14
- Go to AdminGetPwd module
- Add Collect. Add Say in Collect prompt and type: “Enter your 4 digits admin password and press star” in the text area.
- Set star as Finish on key.
- From the right side choose to collect digits.
- Assign to admin_Pwd and choose application as a scope.
- Continue to AdminCheckPwd
Step 15
- Go to AdminCheckPwd module
- Add External Service.
- Service Url will be a PHP script checking password entered by admin – adminCheckPwd.php
- Add admin_Pwd as URL parameter
- Choose routing decision to be dynamic and to continue to confirm_pwd value
If the password is correct the application will proceed to AdminGetPhone module. If it is not it will proceed to AdminWrongPwd.
Step 16
- Go to AdminWrongPwd module
- Add Collect
- Add Say in Collect prompt. Type: “You entered an invalid password, press 1 to try again or you may hang up” in the text area.
- Choose to create a menu.
- Set AdmingGetPwd as digit 1 target.
Step 17
- Go to AdminGetPhone module
- Add Collect.
- Add Say in Collect prompt. Type: “Enter customer’s phone number and press star”.
- Set star as Finish on key.
- From the right side choose to collect digits.
- Assing to admin_phone. Choose application as scope.
- Continue to AdminGetStatusCode.
Step 18
- Go to AdminGetStatusCode module
- Add Collect
- Add Say and type the following: “If car has been repaired press 1?.
- From right side choose to Collect digits.
- Assign to admin_Repair_Code. Set application as scope.
- Continue to AdminSetCost.
Step 19
- Go to AdminSetCost module
- Add Collect
- Add Say. Type following in the text area: “Enter the cost of the car repaired and press star”.
- Set star as Finish on key.
- Choose to collect digits.
- Assign to admin_Repair_Cost. Choose application as scope.
- Continue to AdminStatusUpdate.
Step 20
- Go to adminStatusUpdate module
- Add External Service
- Service Url will PHP script updating status and cost entered by admin in carstatus table – adminStatusUpdate.php
- Add three URL parameters:
– admin_Phone, $admin_Phone value
– admin_Repair_Code, $admin_Repair_Code value
– admin_Repair_Cost, $admin_Repair_Cost value - Assign to admin_result_cost. Choose module as a scope. Add car_cost value from the right side.
- Continue to AdminSendSMS
Step 21
- Go to AdminSendSMS module
- Add say and type “$admin_result_cost”. Admin will hear changed status and cost in an existing appointment.
- In order to receive sms to the number you are calling from you need to use $core_From variable. Type it in To area.
- Type the number from which you want to send SMS in From area. From should be a valid DID number from Voip Innovations or another other valid Service Provider.
- Leave Continue to and Status callback empty.
And the application is ready to be tested.
Step 22
This step is showing how to easily cancel appointments using simple PHP scripts.
Firstly create listRemoveAppointment.php. The script includes simple HTML table showing list of all of the appointments. All of the records from appointments table are being selected. Then calendar and car_brand tables are being joined to appointments so that script can get needed information (telephone, brand_name, days). Cancel button runs validateCancelAppointment.php.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<html>
<body>
<h1>ABC Auto Repair</h1>
<h4>Powered by Telscale Restcomm</h4>
<br>
<table border=“1”style=“width:300px”>
<tr>
<th>Telephone</th>
<th>CarBrand</th>
<th>AppointmentDay</th>
</tr>
<?php
$con=mysqli_connect(“localhost”,“username”,“password”,“database”);
if(mysqli_connect_errno()){
echo“Failed to connect to MySQL: “.mysqli_connect_error();
}
$result=mysqli_query($con,“SELECT * FROM appointments INNER JOIN car_brand ON appointments.car_brand=car_brand.number INNER JOIN calendar ON appointments.day=calendar.number “);
// get available appointment days
while($row=mysqli_fetch_array($result)){
?>
<tr>
<td><?phpecho$row[‘telephone’];?></td>
<td><?phpecho$row[‘brand_name’];?> </td>
<td><?phpecho$row[‘days’];?></td>
<td>
<form action=“validateCancelAppointment.php”method=“post”>
<input type=“hidden”name=“phone”value=“<?phpecho$row[‘telephone’];?>“ >
<input type=“hidden”name=“day”value=“<?phpecho$row[‘day’];?>“ >
<input type=“hidden”name=“brand”value=“<?phpecho$row[‘car_brand’];?>“ >
<input value=“cancel”type=“submit”>
</form>
<td>
</tr>
<?php}?>
</table>
</body>
</html>
|
The output of listRemoveAppointment.php should be similar to:
For more information about Restcomm Communication Language please visit our docs page!