Call IVR
Synopsis - CallIvr
CallIvr(const char* phoneno, const char* appname, BOOL selfdelete = false, const char* callerid, const char* detection)
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
CallIvr('123-4567', 'reminderApp', 1, '12345678911', 2)
Call Status
Synopsis - CallStatus
CallStatus(const char* reqId, cMapStringToString& responses)
Description - CallStatus
Objective
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.
Parameters
<reqId> |
The reqId. |
<responses> |
Reference to an array and is used to collect responses. |
Example - call_status_response
CString status = CallStatus("1234035434", 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);
}
...