Voicent Gateway Python Simple
Interface
In addition to the basic Voicent Python Simple Interface class, the extended API contains the following functions.
The extended Python interface source code is
included at the end of this section.
SYNOPSIS
- callIvr(phoneno, appname, selfdelete)
DESCRIPTION
- Make a phone call to the specified number and use the IVR application to interact and control the phone call.
- The options are:
-
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' |
The return value is the call request id <reqId>.
EXAMPLE
- reqId =
callText("123-4567", "reminderApp",
"0")
- Make a call to phone number '123-4567' and use 'reminderApp'
on the gateway for call interaction. You can use callStatusResponses to get the call status and responses, or use callRemove to remove the call record.
SYNOPSIS
- callStatusResponse(reqId, response)
DESCRIPTION
- 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
"".
EXAMPLE
- status =
callStatus("11234035434", responses)
-
Voicent class with extended methods for IVR applications.
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
...
|