Voicent Gateway C++ Simple 
              Interface for IVR Applications
              In addtion to the basic Voicent C++ Simple Interface class, 
              the extended API contains the following functions. 
              
              The extended C++ interface source code is 
              included at the end of this section. 
              A Sample SimpleCall using this 
              extended 
              interface class is also provided. 
               
              SYNOPSIS 
              
                - 
                CString CallIvr(const 
                char* phoneno, const char* appname, BOOL selfdelete = false)
 
               
              DESCRIPTION 
              
                - Make a phone call and use the IVR application to interact 
                with the callee.
 
  
                - The options are:
 
                -  
                  
                    |  phoneno | 
                    The phone number to call | 
                   
                  
                    | 
                    appname | 
                    The name of deployed IVR application | 
                   
                  
                    |  
                    selfdelete | 
                    Ask the gateway to automatically delete the 
                    call request after the call is made if it is set to '1' | 
                   
                 
                The return value is the call request id <reqId>.  
               
              EXAMPLE 
              
                - CString reqId = 
                CallText("123-4567", "reminderApp");
 
  
                - 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.
 
  
                -  
 
                 
               
              SYNOPSIS 
              
                - CString
                 
                CallStatus(const char* reqId, CMapStringToString& responses)
 
               
              DESCRIPTION 
              
                - This is the second form of CallStatus. The return code is 
                the same as the first form. The second parameter 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 
              
                - CString status = 
                CallStatus("11234035434", responses);
 
                
                - if (responses["AttendMeeting"] == "1") ...
 
                
                -  
 
               
               
              
              The following Voicent class is included in the sample 
              SimpleCall2. The added 2 APIs are listed 
              below. 
                
                --------------- 
                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); 
                } 
                 
                ... 
                
                
                 
                 
               
              
              (Click here to download the sample) 
                 
  
               |