Python IVR API | Simple Gateway API

Back to Python Interface

  1. callIvr
  2. callStatus
  3. Source Code

Call IVR

Synopsis - callIvr

CopycallIvr(phoneno, appname, selfdelete, callerid, 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

CopypythonreqId = callIvr("123-4567", "reminderApp", "0", "12345678911", "1");

Call Status Responses

Synopsis - callStatus

CopycallStatus(reqId, responses)

Description - callStatus

Objective

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

Parameters
reqId The reqId.
responses Reference to an array and is used to collect responses.

Example - callStatus

Copypythonstatus = callStatus("1234035434", responses)

Source Code

Copypythonimport 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

                        ...