Nothing Special   »   [go: up one dir, main page]

Presence Server Web Services Integration: Date: 11/2021

Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Presence Server Web Services Integration

Version 12.1
Date: 11/2021
2 Presence Server Web Services Integration

Contents
......................................................................................................... 3
1. Introduction
......................................................................................................... 4
2. Fundamentals
Architecture
............................................................................................................................................... 4
Installation and configuration
............................................................................................................................................... 4

......................................................................................................... 6
3. Example
Introduction
............................................................................................................................................... 6
Integrating web services with C#
............................................................................................................................................... 6
Example
............................................................................................................................................... 8

.........................................................................................................
4. Reference Guide 13
Methods
............................................................................................................................................... 13
AddCallData ...................................................................................................................................... 13
GetCallData ...................................................................................................................................... 14
GetErrorMessage
...................................................................................................................................... 15
GetServerTime
...................................................................................................................................... 16
InsertOutboundRecord
...................................................................................................................................... 16
InsertOutboundRecord2
...................................................................................................................................... 16
InsertOutboundRecord3
...................................................................................................................................... 16
InsertOutboundRecord4
...................................................................................................................................... 17
RefreshService
...................................................................................................................................... 21
RefreshTracers
...................................................................................................................................... 22
ReloadOutboundQueues
...................................................................................................................................... 23
RequestOutboundACDCall
...................................................................................................................................... 23
RequestOutboundACDCall2
...................................................................................................................................... 24
RequestOutboundACDCall3
...................................................................................................................................... 24
Sum ...................................................................................................................................... 26
UnloadOutboundRecord
...................................................................................................................................... 26

......................................................................................................... 28
5. Appendix
Troubleshooting
............................................................................................................................................... 28

Enghouse Interactive Presence Suite


Introduction 3

Chapter
Introduction 1
This manual is meant for technical personnel who have experience or, at least, a basic
knowledge of programming fundamentals.

This document sets out to provide the necessary basis for developing an integrated application
using Presence Server Web Services, while providing both a useful reference guide and
examples for the development stage of such application.

Any programming language supporting this type of technology (such as C#, Visual Basic, C++,
Delphi or Javascript) may be used to develop integrated applications via Presence Server Web
Services. Likewise, other computing systems may be integrated, either by adding the web
services to the system -if applicable-, or by using "bridge" applications developed in any of the
above-mentioned languages.

This document is divided into four chapters, which describe the implementation and
development test processes of an application to be integrated with Presence Server Web
Services.

Fundamentals. Explains the basics that must be known before proceeding with any
integration process with the web services supplied by Presence Server Web Services.

Example. This chapter is meant to be a practical guide to designing an application to be


integrated with Presence Server Web Services. It describes both the process of adding the web
services to the development tool and the creation of an application from scratch. The example
in this chapter has been developed from the C# programming language.

Reference Guide. This chapter lists all methods one by one provided by Presence Server Web
Services. A description of the utility, the required parameters, the return values, as well as an
example of use are given for each of these items. Examples in this chapter have been
developed from the C# programming language.

Troubleshooting. This chapter is very useful in the stage of development and test of the
created application, since the most common problems occurring when integrating an
application with Presence Server Web Services are listed here. The troubleshooting method for
each problem is described in a quick, easy way.

Enghouse Interactive Presence Suite


4 Presence Server Web Services Integration

Chapter
Fundamentals 2
Architecture
The Presence system allows you to integrate third-party applications to carry out actions
processed directly in Presence Server or against the data repository. This is possible using the
provided web services, called Presence Server Web Services (pcoserverws.dll), so that they
can be included in a customer application that will be able to invoke methods to perform the
above mentioned actions.

As shown in the figure below, Presence Server Web Services establishes a communication
between the customer application and the web services. As a result, the customer application
can invoke any web service method for it to be executed.

Integration architecture with Presence Server Web Services

Installation and configuration


The installation of Presence Server Web Services is carried out through the
PresenceServerWebServices-Setup-x.x.xxx.msi setup program. For information on how to

Enghouse Interactive Presence Suite


Fundamentals 5

install and configure Presence Server Web Services, refer to the Presence Installation Guides
document.

Enghouse Interactive Presence Suite


6 Presence Server Web Services Integration

Chapter
Example 3
Introduction
Based on an example developed in C#, this section shows the steps to create an application
integrated with Presence Server Web Services. This application must be able to insert and
unload outbound records from the information entered by the user.

This example should be used as a reference guide when developing a new application in order
to be integrated with Presence Server Web Services, providing the basic programming
structures to integrate the application using these web services.

Integrating web services with C#


This section details how to integrate the web services supplied by Presence Server Web
Services into the C# development tool.

To add the web services, you must have previously installed these services in a local computer
or a remote computer, as explained in the Fundamentals, Installation section. After installing
Presence Server Web Services and creating the new programming project, go to the Project
menu in the C# development tool and select the Add Service Reference... item. Selecting
this option displays a new window where you must specify the Address that the web services
have been installed in. The address format must be as follows:

http://<IP_Address>/<IIS_Virtual_Directory_Name>/pcoserverws.dll/SOAP

where the <IP_Address> parameter is the IP address of the computer where the Presence
Server Web Services have been installed and the <IIS_Virtual_Directory_Name> parameter is
the name of the virtual directory that was created in IIS during the installation process.

Once the address has been entered click on Go. If the address is correct, the list of available
operations in the PcowsService service (i.e. the Presence Server web services) will be
displayed.

Enghouse Interactive Presence Suite


Example 7

Screen to add services in C#

A name for the class that is going to be created in the C# project may be specified in the
Namespace field. Click on OK to finish.

When this process is completed, the web services are displayed among the service reference
created in the project and are available for use.

Enghouse Interactive Presence Suite


8 Presence Server Web Services Integration

Solution Explorer of a C# project

Example
Example. Insert and unload outbound records

This example is intended to show that it is possible to insert records in or unload records from
an outbound service. This updates the service queues so that new records can be considered or
discarded according to the action taken.

To create a new application, go to the File menu, select New > Project... and create a
Windows Forms Application for C#.

Initial screen to create an application in C#

Next, add the web services to the project as described in the Integrating web services with C#
section.

Enghouse Interactive Presence Suite


Example 9

Create the following screen (frmOutboundRecordInfo), which allows you to specify the
necessary data to insert or unload an outbound record.

Main screen of the application

This screen allows you to enter the basic parameters to insert or unload an outbound record.

First of all, the connection with the Presence Server web services must be established. To do
this, create a global variable in the form, which will allow access to these web services during
the execution of the application.

private PresenceWebServices.PcowsServiceClient WebServices;

Creating and checking the web services is done in the Load event from the main form. With
this event, it is also possible to check the web services using the Sum method in order to
verify that the communication has been successfully established. If a connection could not be
made with Presence Server Web Services, an error message is displayed and the application is
automatically closed.

private void Form1_Load(object sender, EventArgs e)


{
bool Result;

Enghouse Interactive Presence Suite


10 Presence Server Web Services Integration

try
{
// Creates the object to establish communication with Presence Server
// Web Services
WebServices = new PresenceWebServices.PcowsServiceClient();

// Performs a test to check the connection using the Sum method


if (WebServices.Sum(1, 2) == 3)
Result = true;
else
Result = false;
}
catch
{
Result = false;
}

// If an error occurs, a message is generated and the application closes


if (!Result)
{
MessageBox.Show("Unable to connect with Presence Server Web Services");
Application.Exit();
}
}

Clicking on the Execute button must perform the action selected in the Action parameter.
The Click event of this button is captured, which executes the selected action by the user.

private void bExecute_Click(object sender, EventArgs e)


{
// Performs one action or another according to the user selection
if (cbAction.SelectedIndex == 0)
ExecuteInsertOutboundRecord();
else
ExecuteUnloadOutboundRecord();
}

The ExecuteInsertOutboundRecord method will get the values entered in the form parameters
and will attempt to insert a new outbound record with those values. The method will display a
confirmation message if the outbound record has been inserted successfully, or a message
with the error that occurred if the action failed.

private void ExecuteInsertOutboundRecord()


{
int ServiceId; // Service ID
int LoadId; // Load ID
int SourceId; // Source ID of the record
string Name; // Contact name
int Status; // Record initial status
string Phone; // Contact phone number
DateTime ScheduleDate; // Schedule date and time
Int64 CapturingAgent; // ID of the capturing agent (login)
int Priority; // Record priority
string Comments; // Comments
int Result; // Return value of the operation

// Checks if the numeric values (Service, Load, ID and


// Priority) are correct
if ((int.TryParse(tbServiceId.Text, out ServiceId)) &&
(int.TryParse(tbLoadId.Text, out LoadId)) &&
(int.TryParse(tbSourceId.Text, out SourceId)) &&
(int.TryParse(tbPriority.Text, out Priority)))
{

Enghouse Interactive Presence Suite


Example 11

// Gets the rest of parameters


Name = tbName.Text;
Phone = tbPhone.Text;
Comments = tbComments.Text;

// Checks the status and, if necessary, the date and time of the
// scheduling
if (cbStatus.SelectedIndex == 0)
{
Status = 1; // Initial
ScheduleDate = DateTime.MinValue;
}
else
{
Status = 2; // Scheduled
ScheduleDate = new DateTime(dtpDay.Value.Year, dtpDay.Value.Month,
dtpDay.Value.Day, dtpTime.Value.Hour, dtpTime.Value.Minute,
dtpTime.Value.Second);
}

// Checks if the outbound record must be captured


CapturingAgent = 0;
if (cbCapturingAgent.Checked)
{
Int64.TryParse(tbCapturingAgent.Text, out CapturingAgent);
}

// Launches the request and stores the returned value


Result = WebServices.InsertOutboundRecord4(ServiceId, LoadId, SourceId,
Name, "", Status, Phone, "", "", "", "", ScheduleDate, CapturingAgent,
Priority, Comments, "", "", "", "", "", false);

// Final message with the result


if (Result == 0)
{
MessageBox.Show("The outbound record has been successfully inserted");
}
else
{
MessageBox.Show("The outbound record could not be inserted: " +
WebServices.GetErrorMessage(Result));
}
}
else
{
MessageBox.Show("The entered numeric parameters are incorrect");
}
}

The ExecuteUnloadOutboundRecord method will get the values entered in the form parameters
that are necessary to unload an outbound record, i.e. the service ID, load ID and the outbound
record ID that you want to unload. The method will display a confirmation message if any
outbound records have been unloaded successfully, or a message with the error that occurred
if no records were unloaded.

private void ExecuteUnloadOutboundRecord()


{
int ServiceId; // Service ID
int LoadId; // Load ID
int SourceId; // Source ID of the record
int Result; // Return value of the operation

// Checks if the numeric values (Service, Load and ID) are correct

Enghouse Interactive Presence Suite


12 Presence Server Web Services Integration

if ((int.TryParse(tbServiceId.Text, out ServiceId)) &&


(int.TryParse(tbLoadId.Text, out LoadId)) &&
(int.TryParse(tbSourceId.Text, out SourceId)))
{
// Launches the request and stores the returned value
Result = WebServices.UnloadOutboundRecord(ServiceId, LoadId, SourceId);

// Final message with the result


if (Result > 0)
{
MessageBox.Show("Number of unloaded outbound records: " +
Result.ToString());
}
else
{
MessageBox.Show("No outbound records could be unloaded: " +
WebServices.GetErrorMessage(Result));
}
}
else
{
MessageBox.Show("The entered numeric parameters are incorrect");
}
}

Enghouse Interactive Presence Suite


Reference Guide 13

Chapter
Reference Guide 4
Methods

AddCallData

Description
Adds data to a contact from its call identifier ID (CallId). This information will be
associated with the contact throughout all of its handling process. This function is used,
for example, to implement voice and data transfers.

Parameters

Parameter Type Description

AServiceId Integer ID of the service where the contact to which data


will be added is

ACallId Integer ID of the call associated with the contact

AKey WideString Name/Key of the variable to identify the data that


will be added. The maximum length value for this
parameter is 30 characters

AValue WideString Value that will be added. The maximum length


value for this parameter is 250 characters

Return value
Integer. When the returned value is <0, the data could not be added to the contact. If
the value is 0, the data could be added.

The most common error codes are as follows:


· -33554432 (-0x02000000): Service does not exist.
· -33554435 (-0x02000003): Service is disabled.
· -33685514 (-0x0202000A): Outbound contact does not exist.
· -33685515 (-0x0202000B): Inbound contact does not exist.
· -34144257 (-0x02090001): Maximum number of additional data that can be
attached to the contact has been exceeded.

Example

private void AddCallDataExample()


{
int ServiceId; // Service ID
int CallId; // Call ID associated with the contact
string Key; // Variable name/key
string Value; // Value that will be added
int Result; // Return value of the operation

Enghouse Interactive Presence Suite


14 Presence Server Web Services Integration

// Sets the values to make the request


ServiceId = 100;
CallId = 2000;
Key = "Product";
Value = edProducto.Text;

// Launches the request and stores the return value


Result = WebServices.AddCallData(ServiceId, CallId, Key, Value);

// If the request fails, an error message is displayed


if (Result != 0)
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

GetCallData

Description
Gets the value of a variable attached to the contact from its call identifier (CallId).

Parameters

Parameter Type Description

AServiceId Integer ID of the service where the contact from which the
value of the attached variable will be retrieved is

ACallId Integer ID of the call associated with the contact

AKey WideString Name/Key of the variable to identify the data that will
be retrieved. The maximum length value for this
parameter is 30 characters

AValue WideString Value of the retrieved variable

Return value
Integer. When the returned value is <0, the call data could not be retrieved or the
variable to be retrieved does not exist. If the value is 0, the variable exists and the data
could be retrieved.

The most common error codes are as follows:


· -33554432 (-0x02000000): Service does not exist.
· -33554435 (-0x02000003): Service is disabled.
· -33685514 (-0x0202000A): Outbound contact does not exist.
· -33685515 (-0x0202000B): Inbound contact does not exist.
· -33816576 (-0x02040000): No data are associated to the call with that key.

Example

private void GetCallDataExample()


{
int ServiceId; // Service ID

Enghouse Interactive Presence Suite


Reference Guide 15

int CallId; // Call ID associated with the contact


string Key; // Variable name/key
string Value; // Value of the retrieved variable
int Result; // Return value of the operation

// Sets the values to make the request


ServiceId = 100;
CallId = 2000;
Key = "Product";
Value = "";

// Launches the request and stores the return value


Result = WebServices.GetCallData(ServiceId, CallId, Key, ref Value);

// If the request is successful the value is displayed on screen,


// otherwise an error message is displayed
if (Result == 0)
MessageBox.Show(Value);
else
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

GetErrorMessage

Description
Gets the error message from its code.

Parameters

Parameter Type Description

AErrorCode Integer Code that the error message will be retrieved from

Return value
WideString. Error message associated with the code.

Example

private void GetErrorMessageExample()


{
int ErrorCode; // Error code

// Sets the values to make the request


ErrorCode = -33554432;

// Launches the request and displays the message on screen


MessageBox.Show(WebServices.GetErrorMessage(ErrorCode));
}

Enghouse Interactive Presence Suite


16 Presence Server Web Services Integration

GetServerTime

Description
Gets the current date and time of the computer where Presence Server Web Services is
installed.

Parameters
No parameters

Return value
DateTime. Date and time of the computer where Presence Server Web Services is
installed.

Example

private void GetServerTimeExample()


{
// Launches the request and displays the current date and time
// on screen
MessageBox.Show(WebServices.GetServerTime().ToString());
}

InsertOutboundRecord

Deprecated. Refer to InsertOutboundRecord4.

InsertOutboundRecord2

Deprecated. Refer to InsertOutboundRecord4.

InsertOutboundRecord3

Deprecated. Refer to InsertOutboundRecord4.

Enghouse Interactive Presence Suite


Reference Guide 17

InsertOutboundRecord4

Description
Inserts a new outbound record into a service.

Parameters

Parameter Type Description

ServiceId Integer ID of the service for which the record will


be inserted

LoadId Integer ID of the load into which the record will be


included

SourceId Integer This parameter provides a reference to the


ID assigned to the customer in the system
integrated with the Presence Suite. Valid
values must range from 1 to 2147483647,
both inclusive

Name WideString Contact name

TimeZone WideString ID of the default time zone for the record.


Only if the Enable support for time
zones option is checked in the service.
The time zone must have been added to
the service, otherwise an error occurs and
the record is not inserted.
If this parameter contains en empty string,
the service default time zone is assigned to
the record

Status Integer Record initial state:


1: Record not scheduled (call as initial)
2: Record scheduled to a set date and time

Phone WideString Contact phone number. If the value set for


this parameter contains any blank spaces,
they will be removed when inserting the
record.
When the Check phone numbers when
inserting outbound record option is
enabled for the service, the system will
check whether the phone number is added
to any of the enabled Do-Not-Call lists that
are associated to that service

PhoneTimeZone WideString ID of the time zone for the contact phone


number. Only if the Enable support for
time zones option is checked in the
service.

Enghouse Interactive Presence Suite


18 Presence Server Web Services Integration

If the value of the


AutomaticTimeZoneDetection parameter is
set to TRUE, the time zone will be
automatically assigned according to the
contact phone prefix using the area codes
defined in the system.
The time zone cannot be assigned to the
phone if it is not added to the outbound
service. In that case the time zone
specified in the TimeZone parameter will
be used

AlternativePhones WideString Contact alternative phone numbers


separated by commas. If the value set for
this parameter contains any blank spaces,
they will be removed when inserting the
record. Only if the Enable alternative
phone numbers option is checked in the
service.
When the Check phone numbers when
inserting outbound record option is
enabled for the service, the system will
check whether the phone numbers are
added to any of the enabled Do-Not-Call
lists that are associated to that service.
The number of phone nos. that will be
processed depends on the value set for the
Alternative phone numbers to manage
option

AlternativePhoneDescriptions WideString IDs of the descriptions associated with


each alternative phone number separated
by commas. If the value set for this
parameter contains any blank spaces, they
will be removed when inserting the record.
Only if the Enable alternative phone
numbers option is checked in the service.
All the alternative phone numbers must
have a valid phone description that has
been added to the outbound service,
otherwise an error occurs and the record is
not inserted.
The number of phone nos. that will be
processed depends on the value set for the
Alternative phone numbers to manage
option

AlternativePhoneTimeZones WideString IDs of the time zones associated with each


alternative phone number separated by
commas. Only if the Enable alternative
phone numbers and Enable support for
time zones options are checked in the
service.
If the value of the
AutomaticTimeZoneDetection parameter is
set to TRUE, the time zone will be
automatically assigned according to each

Enghouse Interactive Presence Suite


Reference Guide 19

alternative phone prefix using the area


codes defined in the system.
The time zone cannot be assigned to the
phone if it is not added to the outbound
service. In that case the time zone
specified in the TimeZone parameter will
be used.
The number of phone nos. that will be
processed depends on the value set for the
Alternative phone numbers to manage
option

ScheduleDate DateTime Date and time for the scheduling. Only if


the Status parameter is set to 2.
If the support for time zones is enabled for
the service, the scheduled date and time
will match the date and time of the time
zone that is specified in the
PhoneTimeZone parameter

CapturingAgent Int64 Capturing agent login. Supports up to 18


digits.
If the value is 0, the outbound record is not
captured by any agent

Priority Integer Record priority

Comments WideString Record comments

CustomData1 WideString First custom data value to be assigned to


the record. This is useful to add business
data. Supports up to 100 alphanumeric
characters. Only if the Enable custom
fields option is selected for the service in
the Custom fields: Record tab

CustomData2 WideString Second custom data value to be assigned


to the record. This is useful to add business
data. Supports up to 100 alphanumeric
characters. Only if the Enable custom
fields option is selected for the service in
the Custom fields: Record tab

CustomData3 WideString Third custom data value to be assigned to


the record. This is useful to add business
data. Supports up to 100 alphanumeric
characters. Only if the Enable custom
fields option is selected for the service in
the Custom fields: Record tab

CallerId WideString Phone number that will be displayed at the


destination of calls made to the record.
Only if the Enable outgoing calls
identification option is checked in the
service

Enghouse Interactive Presence Suite


20 Presence Server Web Services Integration

CallerName WideString Descriptive text that will be displayed at


the destination of calls made to the record.
Only if the installed platform is OpenGate
and the Enable outgoing calls
identification option is checked in the
service

AutomaticTimeZoneDetection Boolean Indicates whether the automatic time zone


detection will be performed according to
the phone prefix and using the area codes
defined in the system. Only if the Enable
support for time zones and Enable
automatic time zones by phone prefix
options are checked in the service

Return value
Integer. When the returned value is <0, a new record could not be inserted into an
outbound service. If the value is 0, the record could be successfully inserted.

The most common error codes are as follows:


· -33554445 (-0x0200000D): Outbound service does not exist.
· -33685512 (-0x02020008): Error inserting outbound record.
· -33685513 (-0x02020009): Load does not exist.
· -33685516 (-0x0202000C): The main phone no. has been found in a Do-Not-Call
list of the service.
· -33685520 (-0x02020010): The default time zone for the outbound record is not
added to the service.
· -33685521 (-0x02020011): At least one of the phone no. descriptions is incorrect
or is not added to the service.
· -33685522 (-0x02020012): Maximum number of pending requests that insert a
new outbound record has been exceeded.
· -285278208 (-0x11010000): An internal database error occurred.

Example

private void InsertOutboundRecordExample()


{
int ServiceId; // Service ID
int LoadId; // Load ID
int SourceId; // Client ID
string Name; // Contact name
string TimeZone; // ID of the record time zone
int Status; // Record initial state
string Phone; // Contact phone number
string PhoneTimeZone; // ID of the contact phone number timezone
string AlternativePhones; // Alternative phone numbers
string AlternativePhoneDescriptions; // IDs of the phone descriptions
string AlternativePhoneTimeZones; // IDs of the time zones
DateTime ScheduleDate;// Scheduled date and time
Int64 CapturingAgent; // Agent ID (login) for capture
int Priority; // Record priority
string Comments; // Comments
string CustomData1; // First custom data value of the record
string CustomData2; // Second custom data value of the record
string CustomData3; // Third custom data value of the record
string CallerId; // Phone number to identify outgoing calls
string CallerName; // Text to identify outgoing calls
bool AutomaticTimeZoneDetection; // Automatic time zone detection
int Result; // Return value of the operation

Enghouse Interactive Presence Suite


Reference Guide 21

// Sets the values to make the request


ServiceId = 100;
LoadId = 1;
SourceId = 100000;
Name = "Theresa Kunec";
TimeZone = "BCN"; // Time zone must be added to the service
Status = 1; // Initial
Phone = "50020";
PhoneTimeZone = ""; // See AutomaticTimeZoneDetection parameter
AlternativePhones = "50021,50022,50023";
AlternativePhoneDescriptions = "1,2,3"; // Must be added to the
// service
AlternativePhoneTimeZones = ""; // See AutomaticTimeZoneDetection
ScheduleDate = DateTime.MinValue; // No schedule
CapturingAgent = 0; // No capture
Priority = 100;
Comments = "";
CustomData1 = "tkunec@domain.com";
CustomData2 = "72856490B";
CustomData3 = "07/21/1980";
CallerId = "900112233";
CallerName = "Customer service"; // OpenGate only
AutomaticTimeZoneDetection = true; // Automatic time zone detection

// Launches the request and stores the return value


Result = WebServices.InsertOutboundRecord4(ServiceId, LoadId,
SourceId, Name, TimeZone, Status, Phone, PhoneTimeZone,
AlternativePhones, AlternativePhoneDescriptions,
AlternativePhoneTimeZones, ScheduleDate, CapturingAgent,
Priority, Comments, CustomData1, CustomData2, CustomData3,
CallerId, CallerName, AutomaticTimeZoneDetection);

// If the request fails, an error message is displayed


if (Result != 0)
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

RefreshService

Description
Refreshes in Presence Server all the information about an enabled service using the
current information found in the database.

Parameters

Parameter Type Description

AServiceId Integer ID of the service that the information will be refreshed


for

Return value
Integer. When the returned value is <0, the service could not be refreshed. If the value
is 0, the service has been successfully refreshed.

The most common error codes are as follows:

Enghouse Interactive Presence Suite


22 Presence Server Web Services Integration

· -33554432 (-0x02000000): Service does not exist.


· -33554435 (-0x02000003): Service is disabled.
· -34013188 (-0x02070004): You have no licenses for Presence Scripting.
· -34013189 (-0x02070005): You have no licenses for the outbound mode.
· -34013190 (-0x02070006): The maximum number of Presence Agent outbound
licenses has been exceeded.
· -34013191 (-0x02070007): The maximum number of Presence Agent inbound
licenses has been exceeded.
· -34144259 (-0x02090003): Maximum number of outbound services set in
automatic predictive mode that an agent can be connected to has been exceeded.
· -285212672 (-0x11000000): Presence Server is not connected to the database.
· -285212674 (-0x11000002): Unable to find the database record in the table.
· -285278208 (-0x11010000): An internal database error occurred.

Example

private void RefreshServiceExample()


{
int ServiceId; // Service ID
int Result; // Return value of the operation

// Sets the values to make the request


ServiceId = 100;

// Launches the request and stores the return value


Result = WebServices.RefreshService(ServiceId);

// If the request fails, an error message is displayed


if (Result != 0)
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

RefreshTracers

Description
Refreshes the configuration values set to tracers.

Parameters
No parameters

Return value
Boolean. When the returned value is False, the tracer values could not be refreshed. If
the value is True, the tracer values have been successfully refreshed.

Example

private void RefreshTracersExample()


{
bool Result; // Return value of the operation

// Launches the request and stores the return value


Result = WebServices.RefreshTracers();

Enghouse Interactive Presence Suite


Reference Guide 23

// If the request fails, an error message is displayed


if (!Result)
MessageBox.Show("The tracer values could not be refreshed");
}

ReloadOutboundQueues

Description
Reloads the buffers of an outbound service that Presence Server manages in memory.

Parameters

Parameter Type Description

AServiceId Integer ID of the service that the buffers will be reloaded


for

Return value
Integer. When the returned value is <0, the buffers of the outbound service could not
be reloaded. If the value is 0, the buffers of the outbound service have been
successfully reloaded.

The most common error codes are as follows:


· -33554432 (-0x02000000): Service does not exist.
· -33554435 (-0x02000003): Service is disabled.

Example

private void ReloadOutboundQueuesExample()


{
int ServiceId; // Service ID
int Result; // Return value of the operation

// Sets the values to make the request


ServiceId = 100;

// Launches the request and stores the return value


Result = WebServices.ReloadOutboundQueues(ServiceId);

// If the request fails, an error message is displayed


if (Result != 0)
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

RequestOutboundACDCall

Deprecated. Refer to RequestOutboundACDCall3.

Enghouse Interactive Presence Suite


24 Presence Server Web Services Integration

RequestOutboundACDCall2

Deprecated. Refer to RequestOutboundACDCall3.

RequestOutboundACDCall3

Description
Requests a new manual outbound ACD contact for an agent in a particular outbound
service.

Parameters

Parameter Type Description

ALoginId Int64 ID (login) of the agent that requests the new manual
outbound ACD contact.
The agent that the new contact is requested for must
be currently connected to the outbound service

AServiceId Integer ID of the outbound service that the new contact will be
requested from.
The support for manual outbound ACD calls must be
enabled in the service

ASourceId Integer This parameter provides a reference to the ID assigned


to the customer in the system integrated with the
Presence Suite. Valid values must range from 1 to
2147483647, both inclusive.
If this parameter is set to 0, the source ID will be
automatically assigned by the Presence system

APhone WideString Contact phone number. When the Check phone


numbers when inserting outbound record option is
enabled for the service, the system will check whether
the phone number is added to any of the enabled Do-
Not-Call lists that are associated to that service

AName WideString Contact name

AScheduleDate DateTime Date and time to schedule the contact.


Specifying a date and time earlier than the current
date and time in Presence Server causes the manual
outbound ACD call to be made immediately. Otherwise

Enghouse Interactive Presence Suite


Reference Guide 25

the call is captured for the agent at the scheduled date


and time

AComments WideString Contact comments

Return value
Integer. When the returned value is <0, the new manual outbound ACD contact could
not be requested for the agent. If the value is 0, the new manual outbound ACD contact
has been successfully requested.

The most common error codes are as follows:


· -33554435 (-0x02000003): Service is disabled.
· -33554440 (-0x02000008): Service is paused.
· -33554442 (-0x0200000A): The outbound service type does not support manual
outbound ACD contacts.
· -33554445 (-0x0200000D): Outbound service does not exist.
· -33619969 (-0x02010001): No agent is connected with this login ID.
· -33619972 (-0x02010004): Agent does not work for the service.
· -33685510 (-0x02020006): Error generating preview call.
· -33685511 (-0x02020007): No phantom extensions are available.
· -33685512 (-0x02020008): Error inserting outbound record.
· -33685513 (-0x02020009): The load for manual outbound ACD contacts does not
exist or is not configured.
· -33685516 (-0x0202000C): The phone no. has been found in a Do-Not-Call list of
the service.
· -33685517 (-0x0202000D): The load for manual outbound ACD contacts is
disabled.
· -33685518 (-0x0202000E): The phone number does not contain any digits.
· -33685522 (-0x02020012): Maximum number of pending requests that insert a
new outbound record has been exceeded.
· -34144516 (-0x02090104): Maximum number of pending manual outbound ACD
calls by agent has been exceeded.
· -285278208 (-0x11010000): An internal database error occurred.

Example

private void RequestOutboundACDCallExample()


{
Int64 LoginId; // Agent ID (login)
int ServiceId; // Service ID
int SourceId; // Client ID
string Phone; // Contact phone number
string Name; // Contact name
DateTime ScheduleDate; // Scheduled date and time
string Comments; // Comments
int Result; // Return value of the operation

// Sets the values to make the request


LoginId = 91005;
ServiceId = 100;
SourceId = 100000;
Phone = "50020";
Name = "Theresa Kunec";
// Schedules the call 30 minutes later
ScheduleDate = WebServices.GetServerTime().AddMinutes(30);
Comments = "";

// Launches the request and stores the return value


Result = WebServices.RequestOutboundACDCall3(LoginId, ServiceId,
SourceId, Phone, Name, ScheduleDate, Comments);

Enghouse Interactive Presence Suite


26 Presence Server Web Services Integration

// If the request fails, an error message is displayed


if (Result != 0)
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

Sum

Description
Adds two integer values and returns the result of the addition. This method is
commonly used to verify that Presence Server Web Services has been properly installed.

Parameters

Parameter Type Description

A Integer First integer value

B Integer Second integer value

Return value
Integer. Returns the result of adding the two values.

Example

private void CheckExample()


{
// Performs a test run to check whether the web services are working
// properly
try
{
if (WebServices.Sum(1, 2) == 3)
MessageBox.Show("Working properly");
else
MessageBox.Show("Error while performing test run");
}
catch
{
MessageBox.Show("Error while performing test run");
}
}

UnloadOutboundRecord

Description
Unloads an outbound record from a service.

Enghouse Interactive Presence Suite


Reference Guide 27

Parameters

Parameter Type Description

AServiceId Integer ID of the service that the record will be unloaded from

ALoadId Integer ID of the load where the record will be searched for

ASourceId Integer This parameter provides a reference to the ID assigned


to the customer in the system integrated with the
Presence Suite

Return value
Integer. When the returned value is <0, the record could not be unloaded. If the value
is >0, the number of outbound records that have been unloaded is indicated.

The most common error codes are as follows:


· -33554445 (-0x0200000D): Outbound service does not exist.
· -33685513 (-0x02020009): Load does not exist.
· -33685519 (-0x0202000F): The outbound record cannot be unloaded. Please,
make sure it exists and check its current status.
· -285212672 (-0x11000000): Presence Server Web Services is not connected to
the database.
· -285278208 (-0x11010000): An internal database error occurred.

Example

private void UnloadOutboundRecordExample()


{
int ServiceId; // Service ID
int LoadId; // Load ID
int SourceId; // Source ID of the record
int Result; // Return value of the operation

// Sets the values to make the request


ServiceId = 100;
LoadId = 1;
SourceId = 100000;

// Launches the request and stores the return value


Result = WebServices.UnloadOutboundRecord(ServiceId, LoadId, SourceId);

// If the request fails, an error message is displayed


if (Result < 0)
MessageBox.Show(WebServices.GetErrorMessage(Result));
}

Enghouse Interactive Presence Suite


28 Presence Server Web Services Integration

Chapter
Appendix 5
Troubleshooting
This section describes the most common errors that can occur when executing any of the
methods supported by Presence Server Web Services.

1. "The server committed a protocol violation. Section=ResponseHeader


Detail=Header name is invalid."

This error is generated when the unsafe header parsing is not enabled. Microsoft sets this
value to false by default. Therefore, this error becomes more common if you are using a
Microsoft programming language (for example, C# or Visual Basic).

To fix this issue, you must change the configuration file (.config) of your application to
enable the unsafe header parsing. To do this, simply add the following lines to the end of the
configuration file of your application:

<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>

As a result, the configuration file would look like this:

<?xml version="1.0" encoding="utf-8" ?>


<configuration>
<!-- Rest of the XML content from the configuration file -->
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
</configuration>

2. "Could not connect to <URL>. TCP error code 10060: A connection attempt failed
because the connected party..."

Enghouse Interactive Presence Suite


Appendix 29

This error is generated when attempting to connect to Presence Server Web Services using the
specified <URL>.

To fix this issue, you must check that the specified URL is correct and that Presence Server
Web Services is installed and started on the machine that the URL points to. Depending on
your programming language, this URL can be found in the (.config) configuration file of the
application.

3. "The remote server returned an unexpected response: (405) Method not


allowed."

This error is generated when trying to execute a method whose reference is not found in
Presence Server Web Services. It could also be because the specified <URL> is incorrect,
therefore, the referenced method cannot be found. This error is generated when attempting to
connect to Presence Server Web Services using the specified <URL>.

To fix this issue, you must check that the specified URL is correct and that Presence Server
Web Services is installed and started on the machine that the URL points to. Depending on
your programming language, this URL can be found in the (.config) configuration file of the
application.

4. Other errors

For any other errors, the problem may be that a change made to the definition of the methods
of Presence Server Web Services is not compatible with the current definition of the integrated
application. While always trying to maintain the compatibility in the new versions of Presence
Server Web Services, this is not always possible and the error may be due to this type of
change.

Enghouse Interactive Presence Suite


30 Presence Server Web Services Integration

The most common error message in this case is "Error in deserializing body of...", but other
messages may also be shown.

To fix this issue, you must update the reference to Presence Server Web Services. This will
cause the integrated application to get the definition of the methods again. To do this, open
the application integrated with the programming language (C# in this example), then right-
click on the reference for Presence Server Web Services and select the Update Service
Reference option.

Once the updating process is complete, recompile and run the application to verify that the
issue has been fixed.

Enghouse Interactive Presence Suite

You might also like