Tcl/Tk IVR API | Simple Gateway API

Back to Tcl/Tk Interface

  1. callIvr
  2. callStatus
  3. Source Code

Call IVR

Synopsis - callIvr

callIvr <phoneno> <appname> <selfdelete> <gateway> <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';
<gateway> Installed Voicent Gateway. Defaults to 'http://localhost:8155'.
<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


                        set reqId [callIvr "123-4567" "reminderApp" "0" "12345678911" "1"]
                    

Call Status Responses

Synopsis - callStatus

callStatusResponse <reqId> <responses> <gateway>

Description - callStatus

Objective

Check the call status and responses of the call with . 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"].

Parameters
<reqId> The reqId.
<responses> Reference to an array and is used to collect responses.
<gateway> Installed Voicent Gateway. Defaults to 'http://localhost:8155'.

Example - callStatus


                        set status = [callStatus "123-4567" responses]
                    

Source Code


                        package require http


                        ......

                        proc callIvr { phoneno appname selfdelete {gateway "http://localhost:8155"} } {   set url "$gateway/ocall/callreqHandler.jsp"

                        set plist [list info "simple text call" \
                        phoneno $phoneno \
                        firstocc 10 \
                        startapp $appname \
                        selfdelete $selfdelete]
                        set param [eval ::http::formatQuery $plist]

                        set token [::http::geturl $url -query $param]
                        set rcstr [::http::data $token]
                        ::http::cleanup $token

                        return [getReqId $rcstr]
                        }

                        proc callStatus {reqId responses {gateway "http://localhost:8155"}} {   set url "$gateway/ocall/callstatusHandler.jsp"

                        set plist [list reqid $reqId]
                        set param [eval ::http::formatQuery $plist]

                        set token [::http::geturl $url -query $param]
                        set rcstr [::http::data $token]
                        ::http::cleanup $token

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

                        return ""
                        }