Visual Basic IVR API | Simple Gateway API

Back to Visual Basic Interface

  1. CallIvr
  2. CallStatus
  3. Source Code

Call IVR

Synopsis - CallIvr

String CallIvr(ByVal phoneno As String, ByVal appname As String, ByVal selfdelete As Boolean, ByVal callerid As String, ByVal detection As String)

Description - CallIvr

Objective

Make a phone call to the specified number and use the IVR application to interact and control the phone call.

Parameters
phoneno The phone number to call.
appname The name of the deployed IVR application.
selfdelete Ask the gateway to automatically delete the call request after the call is made if it is set to '1';
callerid The 11 digit caller ID number.
detection The amount of detection for our system to recognize human answer. 0= balanced, 1= more aggressive, 2= most aggressive, 3= detection off.
Returns
reqId The return value is the call request ID.

Example - CallIvr


                        Dim reqId As string = CallIvr("123-4567", "reminderApp", 1, "12345678911", 1);
                    

Call Status

Synopsis - CallStatus

String CallStatus(ByVal reqId As String, ByRef responses As)

Description - CallStatus

Objective

Check the call status of the call with . If the call is made, the return value is 'Call Made', or if the call is failed, the return value is 'Call Failed', or if the call will retry, the return value is "Call will Retry", and for any other status, the return value is " " (empty string). Please note that you can have multiple IVR elements that collect responses.

Parameters
<reqId> The reqId.
<responses> Reference to an array and is used to collect responses.

Example - CallStatus


                        Dim status As String = CallStatus("11234035434", responses)
                    

Source Code


                        ----------------
                        File Voicent.vb:
                        ----------------
                        Imports System
                        Imports System.Net
                        Imports System.IO

                        Public Class Voicent

                        ...

                        Public Function CallIvr(ByVal phoneno As String, ByVal appname As String, ByVal selfdelete As Boolean)
                        Dim urlstr As String = "/ocall/callreqHandler.jsp"

                        ' setting the http post string
                        Dim poststr As String = "info=Simple Text Call " + phoneno

                        poststr += "&phoneno=" + phoneno
                        poststr += "&firstocc=10"
                        poststr += "&selfdelete="
                        If (selfdelete) Then
                        poststr += "1"
                        Else
                        poststr += "0"
                        End If

                        poststr += "&startapp=" + appname

                        ' Send Call Request
                        Dim rcstr As String = PostToGateway(urlstr, poststr)
                        Return GetRequestID(rcstr)
                        End Function

                        Public Function CallStatus(ByVal reqID, ByRef responses)
                        ' call status url
                        Dim urlstr As String = "/ocall/callstatusHandler.jsp"

                        Dim poststr As String
                        poststr = "reqid=" + reqID

                        ' Send Call Request
                        Dim rcstr As String = PostToGateway(urlstr, poststr)

                        ' the responses is the 9th field
                        ' the call status is the 3rd field
                        ...
                        End Function

                        ...

                        End Class