Manage DTMF keypress detection with
Ozeki Robot Controller

Generate automatic responses by calling your SIP account connection. Do this by running a simple C# code on Ozeki Robot Controller. Even if you cannot program, you can copy-paste the code from this tutorial. An IVR reacts to each DTMF signal. Interactive Voice Response (IVR) allows a computer to interact with humans by responding to DTMF tones.

Before starting this tutorial please add a VoIP SIP account connection by using Ozeki Control Panel. It is suggested to run a PBX server and copy paste your SIP account's login credentials for this tutorial.

Prerequisites:

  • Ozeki 10 installed on your computer
  • A VoIP SIP account added to Ozeki 10

If an Ozeki 10 application is currently running, please place it down to the system tray, so you can get back to Ozeki 10's desktop. Start Ozeki Robot Controller (Figure 1), which can manage your connections by running easy to write C# codes. It will be as simple as programming an Arduino, so let's get started.

start the robot controller
Figure 1 - Start Robot Controller from Ozeki 10's browser GUI

In Ozeki Robot Controller you can write C# codes (Figure 2). These codes will provide you the best solution to virtually wire any Ozeki 10 connection to eachother. You can send messages to any connection you have subscribed to (e.g. messages to an SMS Gateway, angles to a Servo motor or commands to a PBX VoIP SIP account connection) In this example you can see how to answer the call and send voice messages to the caller.

Write your own codes by using a simple code structure. It always begins with a Start() method, which you can use to subscribe to all Ozeki 10 connection you would like to. Keep in mind you can only receive messages from subscribed connections. Then it continues with the Receive(Message msg) method which is called every time a message is received from the subscribed connection. Here you can interract with each subscribed connection with simple messages.

This C# code manages any incoming DTMF keys pressed

using System;
using System.Media;

namespace Ozeki
{ 
    public class Program 
    { 
        public void Start()
        {
            SystemSounds.Beep.Play(); 
            Subscribe("120@localhost"); //SIP account connection
          	Log("My IVR system is running");
        }

        public void Receive(Message msg)
        {
          	Log("Message received:"+msg.Text);
            SystemSounds.Beep.Play(); 
          
            if (msg.Text.StartsWith("Ring"))
                {
                  Log("Answering call.");
                  Reply(msg,"Answer");
                  return;
                }
            if(msg.Text == "CallState InCall")
                {
                  Log("Sending text.");
                  Reply(msg, "Hello, Welcome to the Ozeki Robot Controller."
                        + " Please press 1 or 2.");
                  return;
                }
           	switch(msg.Text)
                {
                  case "1":
                       Reply(msg,"You have pressed 1.");
                       break;
                  case "2":
                       Reply(msg,"You have pressed 2.");
                       break;
                }
        }
    }
}          
Code 1 - The DTMF keypress detector C# code, which calls your SIP account connection.

Now you can copy the programcode from code 1 to your Ozeki Robot Controller. Do not forget to rewrite the connection name of the SIP account you use in Ozeki 10 (The line is highlighted for you). Click 'Compile' to check for syntax errors (Figure 2). The example code compiles successfully.

compile the c sharp programcode
Figure 2 - Compile the C# programcode after pasting it to your Robot Controller

Click 'Run' to run the code (Figure 3). Call the phone number to interact with the DTMF keypress selection system. In the program log below you can see the most important interactions highlighted. The run log includes all input and output message flow between the connections and Ozeki 10.

run the c sharp programcode
Figure 3 - Run the C# programcode and call it from any other number

More information