Developers: IVR, SMS, CRM, Dialers

C++ IVR Interface

The Voicent C++ IVR module contains the following functions:

Call IVR

Synopsis - CallIvr

CallIvr(const char* phoneno, const char* appname, BOOL selfdelete = false)

Description - CallIvr

Make a phone call to the specificed 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

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 Responses

Synopsis - CallStatus

CallStatus(const char* reqId, cMapStringToString& 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

CString status = CallStatus("11234035434", responses)
if (responses["AttendMeeting"] == "1") { ... }

Source Code

---------------
File Voicent.h:
---------------

class Voicent
{
public:
  ...

  // Call Request. Return reqId of this call record on the gateway

  CString
CallIvr(
    const char* phoneno, // phone number
    const char* appname,    // deployed IVR application name
    BOOL selfDelete = false); // delete call record after call made

  // Get call status

  CString
CallStatus(const char* reqId, // Call record reqId
                     CMapStringToString& responses);

  ...
};
-----------------
File voicent.cpp:
-----------------

...

CString Voicent::
CallIvr(const char* phoneno, const char* appname, BOOL selfDelete)
{
  // call request url
  CString urlstr = "/ocall/callreqHandler.jsp";

  // setting the http post string
  CString poststr;

  poststr += "info=";
  poststr += URLEncode(CString("Simple Text Call ") + phoneno);

  poststr += "&phoneno=";
  poststr += phoneno;

  poststr += "&firstocc=10";

  poststr += "&selfdelete=";
  poststr += (selfDelete ? "1" : "0");

  poststr += "&startapp=";
  poststr += URLEncode(appname);

  // Send Call Request
  CString rcstr;
  if (! PostToGateway(m_host, m_port, urlstr, poststr, rcstr))
    return "";

  return GetReqId(rcstr);
}

CString Voicent::
CallStatus(const char* reqId, CMapStringToString& responses)
{
  // call status url
  CString urlstr = "/ocall/callstatusHandler.jsp";

  // setting the http post string
  CString poststr = "reqid=";
  poststr += URLEncode(reqId);

  // Send Call Request
  CString rcstr;
  if (! PostToGateway(m_host, m_port, urlstr, poststr, rcstr))
    return "";

  return GetCallStatus(rcstr, responses);
}

...