make2WayCallback

This application is used to initiate 2-way callback request.

Parameters:

  • authname - VoIP login to be used as callback initiator. String. Required.
  • cld_first - number to make callback. String. Required.
  • cli_first - make call leg look like to be made from specified CLI. String. Optional.
  • cld_second - number to dial to. String. Required.
  • cli_second - make call leg look like to be made from specified CLI. String. Optional.
  • credit_time - terminate first call leg after this number of seconds. Integer. Optional.
  • next_call - at which time to schedule the call. The time must be in UTC timezone. Datetime. Optional.
Returns:
  • result - OK means that callback was initiated. String.
  • i_callback_request - ID of requested callback. Integer.
  • XMLRPC fault in case of any error.

callbackCallingCard

This application is used to initiate callback calls to Calling Card application.

Parameters:

  • authname - VoIP login to be used as callback initiator. String. Required.
  • cld - number to make callback. String. Required.
  • cli - make call leg look like to be made from specified CLI. String. Optional.
  • langs - languages to be proposed to user upon session start. Array. Optional.
  • credit_time - terminate callback call leg after this number of seconds. Integer. Optional.

The following parameters are the same as corresponding CLD options of Calling Card application. Please see that page for more information.

  • chpassext - String. Optional.
  • cliregext - String. Optional.
  • directhotdial - Boolean. Optional.
  • hotdialext - String. Optional.
  • hotdialeditext - String. Optional.
  • keepcli - Boolean. Optional.
  • nodial - Boolean. Optional.
  • playbalance - Boolean. Optional.
  • playduration - Boolean. Optional.
  • noredial - Boolean. Optional.
  • topupext - String. Optional.
  • trycliauth - Boolean. Optional.
Returns:
  • result - OK means that callback was initiated. String.
  • i_callback_request - ID of requested callback. Integer.
  • XMLRPC fault in case of any error.

cancelCallback

This application is used to cancel a callback request (and call if it has already started).

Parameters:

  • i_callback_request - callback request to cancel. Integer. Required.
Returns:
  • result - OK means that cancel request was initiated successfully. String.
  • XMLRPC fault in case of any error.

getCallbackStatus

This application is used to get information about a callback request status.

Parameters:

  • i_callback_request - callback request to retrieve information for. Integer. Required.
  • fetch_cdrs - should the corresponding CDRs be returned. Boolean. Optional.
Returns:
  • result - OK. String.
  • call_result *)
  • call_status *)
  • cdrs - optional field containing CDRs for the callback request. The date and time returned in the UTC timezone.
  • XMLRPC fault in case of any error.

*) A detailed explanation of the fields call_result and call_status you can see here.

Python Example

 

# this script requires httplib2 to be installed from http://code.google.com/p/httplib2/
import httplib2
import urllib
from xmlrpclib import ServerProxy, getparser, ProtocolError

my_number = '123456'
destination_number = '654321'
authname = '333333'

class HTTPSDigestAuthTransport:
    def request(self, host, handler, request_body, verbose=0):
        auth, host = urllib.splituser(host)
        username, password = urllib.splitpasswd(auth)

        h = httplib2.Http()
        if verbose:
            h.debuglevel = 1
        h.add_credentials(username, password)

        resp, content = h.request("https://" + host + handler, "POST", body=request_body,
                                  headers={'content-type':'text/xml'})

        if resp.status != 200:
            raise ProtocolError("https://" + host + handler,
                                resp.status, resp.reason, None)

        p, u = getparser(0)
        p.feed(content)

        return u.close()

transport = HTTPSDigestAuthTransport()
client = ServerProxy("https://username:password@1.2.3.4/xmlapi/xmlapi", transport)
res = client.make2WayCallback({ 'authname' : authname, 
                                'cli_first' : my_number, 
                                'cld_second' : destination_number,
                                'credit_time' : 3600 # call should not continue more than an hour
                               })
if res['result'] == 'OK':
    print res['i_callback_request']