High performance VoIP SDK for .Net developers

VoIP SIP SDK

Source code explanation for using the C# SIP source implementation of Ozeki VoIP SDK for Voice recognition IVR

Download: Voice_IVR.zip

This page is entitled to be a source code explanation for help you use the C# SIP source implementation of Ozeki VoIP SDK for Voice recognition IVR.

The IVR system

IVR system structure

The class based structure of the IVR system is quite simple (Figure 1):


Figure 1 - IVR system structure

IVREngine

This class handles the operation of the IVR system. It handles incoming calls and navigates the customer among the actual menu items in the IVR menu.

IVRMenuElement

This interface needs to be realized by the IVR menu items.

BaseIVRMenuElemnt

It is an abstract base class that realizes the IVRMenuElement interface and includes the methods that can be necessary for IVRMenuElement. The base class includes the method that is required for activate and deactivate the InputInterpreter, and the cloning of submenus.

IInputInterpreter

This interface needs to be realized by the class that interprets input data.

VoiceInputInterpreter

This is the class that realizes IInputInterpreter. It is responsible for realizing keywords. Users can receive notification by subscribing for InputInformation event, and if the searched keyword is used.

The realized IVR menu items in the example

The IVR system demonstrated in the example includes all the basic options that can be expected from a business IVR system. Please note that these functions are for demonstration and on request further functions can be added effectively without limitation.

WavePlayerElement

This function can be considered as the basis of IVR systems since with the help of this class you can play a prerecorded voice message to the called party.

VoiceMessageToEmailElement

With the help of this class you can record the voice message of the caller party and then the message can be forwarded to a predefined email address by a given DTMF signal.

DataBaseTextToSpeechElement

This class demonstrates how to query data from a database and how to make the queried data be read to the caller party.

SoftPhoneElement

With the use of this class you can contact the caller party directly. In other words, you can establish two-way audio communication.

EndElement

This class is for closing the menu and the call. In this way, it can be set that which key needs to be pressed by the caller party to finish the given operation (e.g. recording).

Use of IVREngine

IVREngine can be used in a really simple way and it can be realized easily:

private IVREngine ivrEngine;
/* Create a softphone...
 * */
ISoftPhone softPhone = SoftPhoneFactory.CreateSoftPhone("LOCALIPADDRESS",
           5000, 8000, 5060);

/* Set the SIP Account settings..
 * */
SIPAccount acc = new SIPAccount(
   registrationRequired: true,
   displayName: "oz875",
   userName: "oz875",
   registerName: "oz875",
   registerPassword: "oz875",
   domainServerHost: "192.168.112.100",
   domainServerPort: 5060
);
/* Create IVRMenu
 * */
IIVRMenuElement rootMenu = CreateIVRMenu();

/* Create IVREngine
 * */
ivrEngine = new IVREngine(softPhone, rootMenu, acc);

/* Start IVREngine
 * */
 ivrEngine.Start(); 

The setup of the IVR menu is similarly easy by using the previously learnt classes. The sample menu structure is the follows:

/*Create IVR root menu
 */
IIVRMenuElement rootMenu = new WavePlayerElement("D:\\demo.wav", new VoiceInputInterpreter(new[] { "Email", "Speech", "Softphone" }));

/*Create IVR submenus
 */
IIVRMenuElement dataBaseTextToSpeechElement = new DataBaseTextToSpeechElement(new VoiceInputInterpreter(new []{"end"}));
IIVRMenuElement voiceMessageToEmailElement = new VoiceMessageToEmailElement("mailinside.ozeki.hu", voiceMessageData, null, new VoiceInputInterpreter(new[] { "end" }));
IIVRMenuElement softPhoneElement = new SoftPhoneElement(new VoiceInputInterpreter(new[] { "end" }));

/*Adding submenus to the root menu
 */
rootMenu.AddSubMenuElement("Email", voiceMessageToEmailElement);
rootMenu.AddSubMenuElement("Speech", dataBaseTextToSpeechElement);
rootMenu.AddSubMenuElement("Softphone", softPhoneElement);

/*Create IVRMenu end element
 */
IIVRMenuElement endMenuElement = new EndElement();

/*Adding end menu to the submenus
 */
rootMenu.AddSubMenuElement("end", endMenuElement);
dataBaseTextToSpeechElement.AddSubMenuElement("end", endMenuElement);
voiceMessageToEmailElement.AddSubMenuElement("end", endMenuElement);
softPhoneElement.AddSubMenuElement("end", endMenuElement);

Possibilities for further development of the IVR system

The following list enlists the functions that are not included in the sample program but there is a possibility to implement them with Ozeki VoIP SIP SDK. For further information please contact us at info@voip-sip-sdk.com.

These further functions can also be realized with Ozeki VoIP SIP SDK effectively:

  1. "Go back" function in the IVR menu
    This function allows the caller to go back one level in the IVR menu.

  2. Dynamic menu system
    With this function you can avoid that the structure of IVR system is fix in the code. This function allows you to set the structure of the IVR system externally.

  3. Custom menu system on the basis of the telephone number of the caller
    This function enables you to create a menu system for those customers who have already been authenticated (based on their phone number).

  4. Call forward function
    Call forward function allows to forward incoming calls to a given telephone number.

  5. Windows service based IVR
    The main benefits of a Windows service based IVR is that users do not need to be logged-in the computer on which the IVR system runs on.
Name:C# Voice Recognition IVR Example Program
Download:Voice_IVR.zip (15.1 MB)


For further tips on utilization possibilities, please go to the fields of applications page!

For more information please contact us at info@voip-sip-sdk.com!