Voicent Gateway SDK Reference Table of Content << Previous >> Next

Voicent Gateway Tcl/Tk Simple Interface

In addition to the basic Voicent Tcl/Tk Simple Interface class, the extended API contains the following functions.

The extended Tcl/Tk interface source code is included at the end of this section.


SYNOPSIS

callIvr phoneno appname selfdelete gateway

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 The name of the deployed IVR application
gateway Installed Voicent Gateway. Defaults to 'http://localhost:8155'

The return value is the call request id <reqId>.

EXAMPLE

set 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 CallStatusResponse to get the call status and responses, or use CallRemove to remove the call record.
 

SYNOPSIS

callStatusResponse reqId responses gateway

DESCRIPTION

Check the call status and responses of the call with reqId. The second parameter is a reference to a dictionary and 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

set status [callStatus "11234035434" 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 ""
}
 

Developer Network Table of Content << Previous >> Next