Developers: IVR, SMS, CRM, Dialers

Python IVR Interface

The Voicent Python IVR module contains the following functions:

Call IVR

Synopsis - callIvr

callIvr(phoneno, appname, selfdelete)

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

reqId = callIvr("123-4567", "reminderApp", "0")
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

callStatus(reqId, 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 of the call with <reqId>. 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).

Example - callStatus

status = callStatus("11234035434", responses)

Source Code


import urllib
import time


class
Voicent:
  ...

  def
callIvr(self, phoneno, appname, selfdelete):
    urlstr = "/ocall/callreqHandler.jsp"

    param = {'info' : 'simple text call',
             'phoneno' : phoneno,
             'firstocc' : 10,
             'startapp' : appname,
             'selfdelete' : selfdelete}

    rcstr = self.postToGateway(urlstr, param)
    return self.getReqId(rcstr)


  def
callStatus(self, reqId, responses):
    urlstr = "/ocall/callstatusHandler.jsp"
    param = {'reqid' : reqId}
    rcstr = self.postToGateway(urlstr, param)

    // the responses is the 9th field
    // the status is the 3rd field

  ...