• Announcing Velocity Version 3.0
  • The Award Winning Development Toolkit
  • IVR and Speech Applications
  • Free SDK
  • The Developers Choice

Download

velocity_download
Velocity Toolkit VB.Net Sample PDF Print E-mail
 
Imports System
Imports Glorsoft.Velocity
 
Namespace Sample
  Class Program
    Shared Sub Main(ByVal args() As String)
      ' create a new engine
      Dim engine As VelocityEngine = New VelocityEngine()
      ' set the call handler on channel 1
      engine.SetCallHandler(1, New IVRApplication())
      ' start the engine
      engine.Start()
      Console.WriteLine("Engine running - ESCAPE to quit")
      While Console.ReadKey().Key <> ConsoleKey.Escape
      End While
      ' stop the engine
      engine.Stop()
    End Sub
  End Class
 
  Class IVRApplication
  Inherits VelocityAsyncCallHandler
    Public Overrides Sub HandleCall(ByVal Channel As VelocityChannel)
      Channel.Log("Waiting for a call")
      Channel.WaitForCall()
      Channel.Log("Received a call")
      Channel.AnswerCall(VelocityEngine.CallType.Voice)
      Channel.Log("Answered a call")
      ' play a file and stop it
      ' prematurely if the caller presses *
      Channel.PlayFile("welcome.wav", "*")
      ' prompt the user to enter some digits
      ' digit collection will terminate when
      ' the caller enters 5 digits or presses *
      ' it will also terminate if 3 seconds
      ' elapse between digit presses
      Dim result As VelocityDigitCollectionResult = Channel.GetDigits("enter_pin.wav", 5, "*", 3, 3)
      If result.Digits = "1234" Then
        Channel.PlayFile("logged_in.wav", "")
      Else
        Channel.PlayFile("access_denied.wav", "")
      End If
      Channel.DisconnectCall()
    End Sub
  End Class
End Namespace

 

Share

Dialogic Partner Logo

dialogic application partner