Contents
Contact Center Initialization Samples
One Contact Center - One Genesys Environment
The sample requests in this section show the creation of a single contact center associated with a single Genesys environment, as well as creation of some basic resources.
Create Contact Center
To create a new contact center, an HTTP POST is sent to /api/v2/ops/contact-centers with an authorization header that includes the ops username/password and the following body content:
{ "name": "Red Wings Contact Center", "countryCode": "US", "domainName": "redwings", "admin": { "userName": "mikeb@redwings", "password": "password", "roles": ["ROLE_ADMIN"], "firstName": "Mike", "lastName": "Babcock" }, "genesysEnvironment": { "tenant": "Environment", "primaryAddress": "hpe-voicevm-84.genesyslab.com", "backupAddress": "hpe-voicevm-84.genesyslab.com", "cmePort": "8888", "primaryStatServerAddress": "hpe-voicevm-84.genesyslab.com", "primaryStatServerPort": "2060", "backupStatServerAddress": "hpe-voicevm-84.genesyslab.com", "backupStatServerPort": "2060", "voiceEnvironments": [{ "switchName": "SIP_Switch", "switchType": "CFGSIPSwitch", "switchDbid": "101", "primaryTServerName": "SIPS", "primaryAddress": "hpe-voicevm-84.genesyslab.com", "primaryTlibPort": "5001", "primarySipPort": "5060", "backupTServerName": "SIPS_B", "backupAddress": "hpe-voicevm-84.genesyslab.com", "backupTlibPort": "5001", "backupSipPort": "5060" }] } }
The response includes a status code and the ids of the objects that were created:
{ statusCode: 0 adminId: "2b512bc4179b4808bb0b1fa846bc372f" contactCenterId: "cfed8b8b-1d6e-4e69-bdaf-07babf9b858f" genesysEnvironmentId: "98dd8c6d-8e25-48aa-9ae9-46d6b0a12f22" }
Creating Users
To create a user, an HTTP POST is sent to /api/v2/users with an authorization header that includes the *admin* username and password, and that were included in the contact center creation. In this case, mikeb@redwings.com/password. The following body is included in the request:
{ "firstName": "Pavel", "lastName": "Datsyuk", "userName": "paveld@redwings", "roles": ["ROLE_AGENT"], "password": "password" }
The response includes a status code along with the id and uri of the newly created user:
{ statusCode: 0 id: "3f9b097ef34f46069aef959157fd4d5f" uri: "http://localhost:8080/api/v2/users/3f9b097ef34f46069aef959157fd4d5f" }
Creating and Assigning Devices
Next, a device will be created and assigned to the user. This is done by sending an HTTP POST to the URI of the newly created user - /api/v2/users/3f9b097ef34f46069aef959157fd4d5f/devices - with the following body:
{ "phoneNumber": "5000" }
Notice that this request is also performed with the admin username/password.
The response includes a status code and the id/uri of the created device:
{ statusCode: 0 id: "b58d23ce-961b-4b64-819a-f757abfc2cad" uri: "http://localhost:8080/api/v2/devices/b58d23ce-961b-4b64-819a-f757abfc2cad" }
Also notice that devices can be created and assigned to users in separate steps using slightly different API calls. These will not be demonstrated here.
Creating a Supervisor
A supervisor can be created by sending the same user creation request with the supervisor role instead of agent:
{ "firstName": "Niklas", "lastName": "Lidstrom", "userName": "lidstrom@redwings", "roles": ["ROLE_SUPERVISOR"], "password": "password" }
Python Script
"""
Workspace Web Edition & Web Services ONE CONTACT CENTER ONE GENESYS ENVIRONMENT SAMPLE
This sample script creates a single contact center and a single Genesys environment. To use this script,
modify the constants in the first section, including the base URI and ops credentials for Workspace Web Edition & Web Services.
"""
import base64;
import httplib2;
import json;
""" Modify the values below to match the target environment """
# Workspace Web Edition & Web Services
GWS_BASE_URI = "http://127.0.0.1:8080/api/v2"
GWS_OPS_USERNAME = "ops"
GWS_OPS_PASSWORD = "ops"
# ConfigServer
CONFIG_SERVER_HOST = "hpe-voicevm-84.genesyslab.com"
CONFIG_SERVER_BACKUP_HOST = "hpe-voicevm-84.genesyslab.com"
CONFIG_SERVER_PORT = "8888"
TENANT = "Environment"
# Switch
SWITCH_NAME = "SIP_Switch"
SWITCH_TYPE = "CFGSIPSwitch" # CFGSIPSwitch, CFGLucentDefinityG3, CFGAvayaTSAPI
SWITCH_DBID = "101"
# TServers
PRIMARY_TSERVER_NAME = "SIPS"
PRIMARY_TSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
PRIMARY_TSERVER_PORT = "5001"
PRIMARY_TSERVER_SIP_PORT = "5060"
BACKUP_TSERVER_NAME = "SIPS_B"
BACKUP_TSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
BACKUP_TSERVER_PORT = "5001"
BACKUP_TSERVER_SIP_PORT = "5060"
# StatServers
PRIMARY_STATSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
PRIMARY_STATSERVER_PORT = "2060"
BACKUP_STATSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
BACKUP_STATSERVER_PORT = "2060"
# Contact Center
CONTACT_CENTER_NAME = "Red Wings"
CONTACT_CENTER_DOMAIN_NAME = "redwings"
CONTACT_CENTER_COUNTRY_CODE = "US"
# Contact Center Admin
ADMIN_USERNAME = "mikeb@redwings" # Typically user@domain
ADMIN_FIRST_NAME = "Mike"
ADMIN_LAST_NAME = "Babcock"
ADMIN_PASSWORD = "password"
# Contact Center Users
USER_INFO = [
{
"userName": "paveld@redwings",
"firstName": "Pavel",
"lastName": "Datsyuk",
"password": "password",
"phoneNumber": "5000",
"role": "ROLE_AGENT"
},
{
"userName": "henrikz@redwings",
"firstName": "Henrik",
"lastName": "Zetterberg",
"password": "password",
"phoneNumber": "5001",
"role": "ROLE_AGENT"
},
{
"userName": "stevey@redwings",
"firstName": "Steve",
"lastName": "Yzerman",
"password": "password",
"phoneNumber": "5002",
"role": "ROLE_AGENT"
},
{
"userName": "lidstrom@redwings",
"firstName": "Nicklas",
"lastName": "Lidstrom",
"password": "password",
"phoneNumber": "5005",
"role": "ROLE_SUPERVISOR"
}
]
""" The steps below create a single contact center and genesys environment based on the variables above. """
genesys_environment = {
"tenant": TENANT,
"primaryAddress": CONFIG_SERVER_HOST,
"backupAddress": CONFIG_SERVER_BACKUP_HOST,
"cmePort": CONFIG_SERVER_PORT,
"primaryStatServerAddress": PRIMARY_STATSERVER_HOST,
"primaryStatServerPort": PRIMARY_STATSERVER_PORT,
"backupStatServerAddress": BACKUP_STATSERVER_HOST,
"backupStatServerPort": BACKUP_STATSERVER_PORT,
"voiceEnvironments": [{
"switchName": SWITCH_NAME,
"switchType": SWITCH_TYPE,
"switchDbid": SWITCH_DBID,
"primaryTServerName": PRIMARY_TSERVER_NAME,
"primaryAddress": PRIMARY_TSERVER_HOST,
"primaryTlibPort": PRIMARY_TSERVER_PORT,
"primarySipPort": PRIMARY_TSERVER_SIP_PORT,
"backupTServerName": BACKUP_TSERVER_NAME,
"backupAddress": BACKUP_TSERVER_HOST,
"backupTlibPort": BACKUP_TSERVER_PORT,
"backupSipPort": BACKUP_TSERVER_SIP_PORT
}]
}
contact_center = {
"name": CONTACT_CENTER_NAME,
"countryCode": CONTACT_CENTER_COUNTRY_CODE,
"domainName": CONTACT_CENTER_DOMAIN_NAME,
"admin": {
"userName": ADMIN_USERNAME,
"password": ADMIN_PASSWORD,
"roles": ["ROLE_ADMIN"],
"firstName": ADMIN_FIRST_NAME,
"lastName": ADMIN_LAST_NAME
},
"genesysEnvironment": genesys_environment
}
http = httplib2.Http(".cache")
def create_request_headers(username, password):
request_headers = dict()
request_headers["Content-Type"] = "application/json"
request_headers["Authorization"] = "Basic " + base64.b64encode(username + ":" + password)
return request_headers
def post(uri, username, password, content):
request_headers = create_request_headers(username, password)
body = json.dumps(content, sort_keys=True, indent=4)
print "POST %s (%s/%s)..." % (uri, username, password)
print body
print
response_headers, response_content = http.request(uri, "POST", body = body, headers = request_headers)
status = response_headers["status"]
ugly_response = json.loads(response_content)
pretty_response = json.dumps(ugly_response, sort_keys=True, indent=4)
print "Response: %s" % (status)
print "%s" % (pretty_response)
print
return response_headers, ugly_response
def check_response(response_headers, expected_code):
if response_headers["status"] != expected_code:
print "Request failed."
exit(-1)
def create_user(user_info):
user_name = user_info["userName"]
print "Creating user [%s]..." % (user_name)
uri = "%s/users" % (GWS_BASE_URI)
user = {
"userName": user_name,
"password": user_info["password"],
"firstName": user_info["firstName"],
"lastName": user_info["lastName"],
"roles": ["ROLE_AGENT"]
}
response_headers, response_content = post(uri, ADMIN_USERNAME, ADMIN_PASSWORD, user)
check_response(response_headers, "200")
user_id = response_content["id"]
print "User [%s] created. User id [%s]." % (user_name, user_id)
return user_id
def assign_device_to_user(user_id, phone_number):
print "Creating device [%s] and assigning to user [%s]..." % (phone_number, user_id)
uri = "%s/users/%s/devices" % (GWS_BASE_URI, user_id)
device = {
"phoneNumber": phone_number
}
response_headers, response_content = post(uri, ADMIN_USERNAME, ADMIN_PASSWORD, device)
check_response(response_headers, "200")
device_id = response_content["id"]
print "Device [%s] created and assigned to user id [%s]." % (device_id, user_id)
def create_users_and_devices():
for user_info in USER_INFO:
user_id = create_user(user_info)
assign_device_to_user(user_id, user_info["phoneNumber"])
def create_contact_center():
print "Creating contact center [%s]..." % (CONTACT_CENTER_NAME)
uri = "%s/ops/contact-centers" % (GWS_BASE_URI)
response_headers, response_content = post(uri, GWS_OPS_USERNAME, GWS_OPS_PASSWORD, contact_center)
check_response(response_headers, "200")
if __name__ == "__main__":
print
print "*****************************************************************"
print " Workspace Web Edition & Web Services ONE CONTACT CENTER ONE GENESYS ENVIRONMENT SAMPLE"
print "*****************************************************************"
print
create_contact_center()
create_users_and_devices()
Multiple Contact Centers - One Genesys Environment
Creating the First Contact Center
To begin, the first contact center is created in the same way as the previous example with a POST to /api/v2/ops/contact-centers. The request should include an authorization header with the ops username/password and the following payload:
{ "name": "Red Wings Contact Center", "countryCode": "US", "domainName": "redwings.com", "admin": { "userName": "mikeb@redwings", "password": "password", "roles": ["ROLE_ADMIN"], "firstName": "Mike", "lastName": "Babcock" }, "genesysEnvironment": { "tenant": "Environment", "primaryAddress": "hpe-voicevm-84.genesyslab.com", "backupAddress": "hpe-voicevm-84.genesyslab.com", "cmePort": "8888", "primaryStatServerAddress": "hpe-voicevm-84.genesyslab.com", "primaryStatServerPort": "2060", "backupStatServerAddress": "hpe-voicevm-84.genesyslab.com", "backupStatServerPort": "2060", "voiceEnvironments": [{ "switchName": "SIP_Switch", "switchType": "CFGSIPSwitch", "switchDbid": "101", "primaryTServerName": "SIPS", "primaryAddress": "hpe-voicevm-84.genesyslab.com", "primaryTlibPort": "5001", "primarySipPort": "5060", "backupTServerName": "SIPS_B", "backupAddress": "hpe-voicevm-84.genesyslab.com", "backupTlibPort": "5001", "backupSipPort": "5060" }] } }
The response is as follows:
{ statusCode: 0 adminId: "2b512bc4179b4808bb0b1fa846bc372f" contactCenterId: "cfed8b8b-1d6e-4e69-bdaf-07babf9b858f" genesysEnvironmentId: "98dd8c6d-8e25-48aa-9ae9-46d6b0a12f22" }
Creating the Second Contact Center
The second contact center will be created and associated with the previously defined Genesys environment. This is achieved by including the id of the Genesys environment instead of the full details. The request is sent to /api/v2/ops/contact-centers using the ops username/password in the authorization header:
{ "name": "Maple Leafs Contact Center", "countryCode": "US", "domainName": "mapleleafs", "admin": { "userName": "rcarlyle@mapleleafs", "password": "password", "roles": ["ROLE_ADMIN"], "firstName": "Randy", "lastName": "Carlyle" }, "genesysEnvironment": { "id": "98dd8c6d-8e25-48aa-9ae9-46d6b0a12f22" } }
The response to the request is:
{ statusCode: 0, adminId: "0e2cb1d8783c4ce58c77e0d3872446ab", contactCenterId: "2c83cb11-7927-4634-8fc9-fe94e4a103fa" }
Notice that a genesysEnvironmentId is not included in the response as the existing environment has been used.
As noted in the Considerations for Multiple Contact Centers section, Workspace Web Edition & Web Services employs a naming and organization scheme based on the domainName of the contact centers when creating and storing objects in the Genesys Configuration database.
See the "What CME Objects Get Created When and Where" section for more details.
Creating Users and Creating / Assigning Devices
Creating users and assigning devices when working with multiple contact centers functions exactly as it does when doing so with a single contact center. The key thing to keep in mind is that the admin username and password provided in the requests allows Workspace Web Edition & Web Services to determine which contact center the request is related to.
Python Script
"""
Workspace Web Edition & Web Services MULTIPLE CONTACT CENTERS ON ONE GENESYS ENVIRONMENT SAMPLE
This script creates two contact centers on a single genesys environment.
"""
import base64;
import httplib2;
import json;
""" Modify the values below to match the target environment """
# Workspace Web Edition & Web Services
GWS_BASE_URI = "http://127.0.0.1:8080/api/v2"
GWS_OPS_USERNAME = "ops"
GWS_OPS_PASSWORD = "ops"
# ConfigServer
CONFIG_SERVER_HOST = "hpe-voicevm-84.genesyslab.com"
CONFIG_SERVER_BACKUP_HOST = "hpe-voicevm-84.genesyslab.com"
CONFIG_SERVER_PORT = "8888"
TENANT = "Environment"
# Switch
SWITCH_NAME = "SIP_Switch"
SWITCH_TYPE = "CFGSIPSwitch" # CFGSIPSwitch, CFGLucentDefinityG3, CFGAvayaTSAPI
SWITCH_DBID = "101"
# TServers
PRIMARY_TSERVER_NAME = "SIPS"
PRIMARY_TSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
PRIMARY_TSERVER_PORT = "5001"
PRIMARY_TSERVER_SIP_PORT = "5060"
BACKUP_TSERVER_NAME = "SIPS_B"
BACKUP_TSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
BACKUP_TSERVER_PORT = "5001"
BACKUP_TSERVER_SIP_PORT = "5060"
# StatServers
PRIMARY_STATSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
PRIMARY_STATSERVER_PORT = "2060"
BACKUP_STATSERVER_HOST = "hpe-voicevm-84.genesyslab.com"
BACKUP_STATSERVER_PORT = "2060"
# Contact Center #1
DETROIT_CONTACT_CENTER_NAME = "Red Wings"
DETROIT_CONTACT_CENTER_DOMAIN_NAME = "redwings"
DETROIT_CONTACT_CENTER_COUNTRY_CODE = "US"
DETROIT_ADMIN_USERNAME = "mikeb@redwings" # Typically user@domain
DETROIT_ADMIN_FIRST_NAME = "Mike"
DETROIT_ADMIN_LAST_NAME = "Babcock"
DETROIT_ADMIN_PASSWORD = "password"
DETROIT_CONTACT_CENTER_USERS = [
{
"userName": "paveld@redwings",
"firstName": "Pavel",
"lastName": "Datsyuk",
"password": "password",
"phoneNumber": "5000",
"role": "ROLE_AGENT"
},
{
"userName": "henrikz@redwings",
"firstName": "Henrik",
"lastName": "Zetterberg",
"password": "password",
"phoneNumber": "5001" ,
"role": "ROLE_AGENT"
},
{
"userName": "stevey@redwings",
"firstName": "Steve",
"lastName": "Yzerman",
"password": "password",
"phoneNumber": "5002",
"role": "ROLE_AGENT"
},
{
"userName": "lidstrom@redwings",
"firstName": "Nicklas",
"lastName": "Lidstrom",
"password": "password",
"phoneNumber": "5005",
"role": "ROLE_SUPERVISOR"
}
]
# Contact Center #2
TORONTO_CONTACT_CENTER_NAME = "Maple Leafs"
TORONTO_CONTACT_CENTER_DOMAIN_NAME = "mapleleafs"
TORONTO_CONTACT_CENTER_COUNTRY_CODE = "US"
TORONTO_ADMIN_USERNAME = "randyc@mapleleafs" # Typically user@domain
TORONTO_ADMIN_FIRST_NAME = "Randy"
TORONTO_ADMIN_LAST_NAME = "Carlyle"
TORONTO_ADMIN_PASSWORD = "password"
TORONTO_CONTACT_CENTER_USERS = [
{
"userName": "dionp@mapleleafs",
"firstName": "Dion",
"lastName": "Phaneuf",
"password": "password",
"phoneNumber": "6000",
"role": "ROLE_AGENT"
},
{
"userName": "joffreyl@mapleleafs",
"firstName": "Joffrey",
"lastName": "Lupul",
"password": "password",
"phoneNumber": "6001",
"role": "ROLE_AGENT"
},
{
"userName": "dougg@mapleleafs",
"firstName": "Doug",
"lastName": "Gilmore",
"password": "password",
"phoneNumber": "6002" ,
"role": "ROLE_AGENT"
},
{
"userName": "sundin@redwings",
"firstName": "Mats",
"lastName": "Sundin",
"password": "password",
"phoneNumber": "6005",
"role": "ROLE_SUPERVISOR"
}
]
""" The steps below create a two contact centers sharing a single genesys environment based on the variables above. """
genesys_environment = {
"tenant": TENANT,
"primaryAddress": CONFIG_SERVER_HOST,
"backupAddress": CONFIG_SERVER_BACKUP_HOST,
"cmePort": CONFIG_SERVER_PORT,
"primaryStatServerAddress": PRIMARY_STATSERVER_HOST,
"primaryStatServerPort": PRIMARY_STATSERVER_PORT,
"backupStatServerAddress": BACKUP_STATSERVER_HOST,
"backupStatServerPort": BACKUP_STATSERVER_PORT,
"voiceEnvironments": [{
"switchName": SWITCH_NAME,
"switchType": SWITCH_TYPE,
"switchDbid": SWITCH_DBID,
"primaryTServerName": PRIMARY_TSERVER_NAME,
"primaryAddress": PRIMARY_TSERVER_HOST,
"primaryTlibPort": PRIMARY_TSERVER_PORT,
"primarySipPort": PRIMARY_TSERVER_SIP_PORT,
"backupTServerName": BACKUP_TSERVER_NAME,
"backupAddress": BACKUP_TSERVER_HOST,
"backupTlibPort": BACKUP_TSERVER_PORT,
"backupSipPort": BACKUP_TSERVER_SIP_PORT
}]
}
detroit_contact_center = {
"name": DETROIT_CONTACT_CENTER_NAME,
"countryCode": DETROIT_CONTACT_CENTER_COUNTRY_CODE,
"domainName": DETROIT_CONTACT_CENTER_DOMAIN_NAME,
"admin": {
"userName": DETROIT_ADMIN_USERNAME,
"password": DETROIT_ADMIN_PASSWORD,
"roles": ["ROLE_ADMIN"],
"firstName": DETROIT_ADMIN_FIRST_NAME,
"lastName": DETROIT_ADMIN_LAST_NAME
},
"genesysEnvironment": genesys_environment
}
toronto_contact_center = {
"name": TORONTO_CONTACT_CENTER_NAME,
"countryCode": TORONTO_CONTACT_CENTER_COUNTRY_CODE,
"domainName": TORONTO_CONTACT_CENTER_DOMAIN_NAME,
"admin": {
"userName": TORONTO_ADMIN_USERNAME,
"password": TORONTO_ADMIN_PASSWORD,
"roles": ["ROLE_ADMIN"],
"firstName": TORONTO_ADMIN_FIRST_NAME,
"lastName": TORONTO_ADMIN_LAST_NAME
}
}
http = httplib2.Http(".cache")
def create_request_headers(username, password):
request_headers = dict()
request_headers["Content-Type"] = "application/json"
request_headers["Authorization"] = "Basic " + base64.b64encode(username + ":" + password)
return request_headers
def post(uri, username, password, content):
request_headers = create_request_headers(username, password)
body = json.dumps(content, sort_keys=True, indent=4)
print "POST %s (%s/%s)..." % (uri, username, password)
print body
print
response_headers, response_content = http.request(uri, "POST", body = body, headers = request_headers)
status = response_headers["status"]
ugly_response = json.loads(response_content)
pretty_response = json.dumps(ugly_response, sort_keys=True, indent=4)
print "Response: %s" % (status)
print "%s" % (pretty_response)
print
return response_headers, ugly_response
def check_response(response_headers, expected_code):
if response_headers["status"] != expected_code:
print "Request failed."
exit(-1)
def create_user(admin_user, admin_password, user_info):
user_name = user_info["userName"]
print "Creating user [%s]..." % (user_name)
uri = "%s/users" % (GWS_BASE_URI)
user = {
"userName": user_name,
"password": user_info["password"],
"firstName": user_info["firstName"],
"lastName": user_info["lastName"],
"roles": [user_info["role"]]
}
response_headers, response_content = post(uri, admin_user, admin_password, user)
check_response(response_headers, "200")
user_id = response_content["id"]
print "User [%s] created. User id [%s]." % (user_name, user_id)
return user_id
def assign_device_to_user(admin_user, admin_password, user_id, phone_number):
print "Creating device [%s] and assigning to user [%s]..." % (phone_number, user_id)
uri = "%s/users/%s/devices" % (GWS_BASE_URI, user_id)
device = {
"phoneNumber": phone_number
}
response_headers, response_content = post(uri, admin_user, admin_password, device)
check_response(response_headers, "200")
device_id = response_content["id"]
print "Device [%s] created and assigned to user id [%s]." % (device_id, user_id)
def create_users_and_devices(admin_user, admin_password, contact_center_users):
for user_info in contact_center_users:
user_id = create_user(admin_user, admin_password, user_info)
assign_device_to_user(admin_user, admin_password, user_id, user_info["phoneNumber"])
def create_contact_center(contact_center):
print "Creating contact center [%s]..." % (contact_center["name"])
uri = "%s/ops/contact-centers" % (GWS_BASE_URI)
response_headers, response_content = post(uri, GWS_OPS_USERNAME, GWS_OPS_PASSWORD, contact_center)
check_response(response_headers, "200")
if "genesysEnvironmentId" in response_content:
return response_content["genesysEnvironmentId"]
if __name__ == "__main__":
print
print "*************************************************************************************"
print " Workspace Web Edition & Web Services MULTIPLE CONTACT CENTERS ON ONE GENESYS ENVIRONMENT SAMPLE"
print "*************************************************************************************"
print
genesys_environment_id = create_contact_center(detroit_contact_center)
create_users_and_devices(DETROIT_ADMIN_USERNAME, DETROIT_ADMIN_PASSWORD, DETROIT_CONTACT_CENTER_USERS)
print "Last and certainly least..."
toronto_contact_center["genesysEnvironment"] = { "id": genesys_environment_id }
create_contact_center(toronto_contact_center)
create_users_and_devices(TORONTO_ADMIN_USERNAME, TORONTO_ADMIN_PASSWORD, TORONTO_CONTACT_CENTER_USERS)
Multiple Contact Centers - Multiple Genesys Environment
To create multiple contact centers across multiple Genesys environments, repeat the steps for creating a single or multiple contact centers on a single Genesys environment multiple times as required.