Developers: IVR, SMS, CRM, Dialers

C# IVR Interface

The Voicent C# IVR module contains the following functions:

Call IVR

Synopsis - CallIvr

string CallIvr(string phoneno, string appname, bool selfdelete)

Description - CallIvr

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'.

Returns
reqId - The return value is the call request id.

Example - CallIvr

string reqId = CallIvr("123-4567", "reminderApp', 1)
Make a call to phone number '123-4567' and use 'reminderApp' on the gateway for call interaction. You can use CallStatus to get the call status and responses, or use CallRemove to remove the call record.

Call Status

Synopsis - CallStatus

string CallStatus(string reqId, Dictionary<string, string> responses)

Description - CallStatus

Make a phone call to the specificed number and use the IVR application to interact and control the phone call.
Check the call status and responses of the call with <reqId>. The second parameter is a reference to an array and is used to collect responses. So if you have an element named AttendMeeting, the response can be accessed as responses["AttendMeeting"]. Please note that you can have multiple IVR elements that collect responses.

Example - CallStatus

string status = CallStatus("11234035434", responses)

Source Code

----------------
File Voicent.cs:
----------------
using System;
using System.Net;
using System.IO;


namespace Voicent
{
  ...
  public class
Voicent
  {
    ...

    public string
CallIvr(string phoneno, string appname, bool selfdelete)
    {
      // call request url
      string urlstr = "/ocall/callreqHandler.jsp";

      // setting the http post string
      string poststr = "info=Simple Text Call " + phoneno;

      poststr += "&phoneno=" + phoneno;
      poststr += "&firstocc=10";
      poststr += "&selfdelete=";
      poststr += (selfdelete ? "1" : "0");

      poststr += "&startapp=" + appname;

      // Send Call Request
      String rcstr = PostToGateway(urlstr, poststr);
      return GetRequestID(rcstr);
    }

    public string
CallStatus(string reqID, Dictionary<string, string> responses)
    {
      // call status url
      string urlstr = "/ocall/callstatusHandler.jsp";
      string poststr = "reqid=" + reqID;

      // Send Call Request
      string rcstr = PostToGateway(urlstr, poststr);
      string[] rcarr = rcstr.Split("^");
     
      // call responses is the 9th field
      string[] resparr = rcarr[8].Split("|");
      for (int i = 0; i < resparr.length; i++) {
          // each is a name value pair
          string[] nvarr = resparr[i].Split("=");
          $responses.Add(nvarr[0], nvarr[1]);
      }

      // call status is the 3rd field
      return rcarr[2];

    }

    ...
  }
}