Telephony API

This API acts as your Agent Remote Control. Use it to control an agent who is already logged into the system, for example to change their status, dial or dispose of a call, or transfer a call to another agent.

TABLE OF CONTENTS [Document Version - 1.9]


Authentication

You need an authentication token to access this API. Request a token from the token service using the Token API.

Token API

Every API method requires a security token. This token is stored in the HTTP cookie so you can make multiple API calls from one authentication request. Request a token by authenticating with a user and password combination. The Token service API returns a token on success.

Token URL

https://[CUSTOMER].maxcontact.com/webservices/services/apitoken/login/{login}

Password

Send the password in the authorization header of the request. Convert the password to Base64 with ASCII encoding to get the bytes[] from the password string.

Steps

  1. Make a request to the token URI.
  2. Store the token key for any subsequent requests.
  3. Make a request to the Telephony API.
Note. Keep track of the token key and its expiry. Requesting a new token every time can slow down the process. Send the login as plain text.

A successful call to the API Token service returns a JSON or XML object. Pass the token key with every API request.


Common API Parameters

The following common parameters are used across a significant number of the API methods.

  • Call Id – The unique integer Id of a particular call. These Ids are maintained in-memory within the system, with values starting at 1,000 each time the system starts up.
  • Campaign Id – The unique identifier of a particular campaign as recorded in the correspondingly named table in the system’s database.
  • CLI (Caller ID) – For inbound calls, this is the number the customer is dialling from, if supplied.
  • Lead Id – Unique Id of a particular lead as recorded in the correspondingly named table in the database.
  • Lead Phone Id – Unique Id for each phone linked to a particular lead. You can find these values in the database.
  • List Id – When leads are imported into the system, they're grouped together into lists. This is the unique Id of a particular list as recorded in the database.
  • Reference Id – When importing leads into the system, you can supply an external reference number, for example a customer Id from an external CRM system. Use a reference Id parameter to supply one of these external reference numbers in place of other parameters, such as a lead Id or phone number.
  • Result Code – When an agent completes a call with a customer, they select a result code that outlines the outcome of the call. A list of the result codes included by default with the system is available in the appendix. You can configure this list of result codes to meet your business needs.
  • User Id – Unique Id of a particular user (often representing an agent) as recorded in the corresponding table in the database.

Responses

By default, the API returns an XML response. Supply Accept and Content-Type headers with a value of application/json in your request to receive JSON formatted responses instead.

CallActionResponse

Every method returns a CallActionResponse object. The “data” property’s type depends on the method used.

{
 Success: Bool,
 Data: This type is dependent on the method used, entities are described below,
 ResponseCode: int,
 ResponseDetail: string
}
Note. See the appendix for a list of the response codes the API returns.

Entities

Call

Returned by /dial, and as an array by /getcalls. Represents an active call.

{
 CallId: int,
 CallStartTime: dateTime,
 CallState: int,
 CallStatus: int,
 CustomerName: string,
 CustomerName2: string,
 PhoneNumber: string,
 RecordingState: int,
 CauseValue: int
}
Note. Consult the appendix for the call states, call statuses, recording states and cause values the API can return.

Agent Name ID Pair

Returned as an array by /users.

{
 FullName: string,
 ID: int
}

Lead Phone

Returned by /leadphones.

{
 LeadId: int64,
 PhoneNumber: string,
 RecordType: string,
 RecordTypeId: int
}
Note. RecordTypeId and RecordType identify what type of phone number or contact information the lead phone relates to, for example work, home or mobile. Consult the appendix for the full list of phone and record types.

Campaign

Returned by /campaigns.

{
 CampaignID: int,
 CampaignName: string,
 Type: string,
 Active: boolean,
 AlwaysRun: boolean,
 AutoRecord: boolean,
 BlackoutDates: string array,
 MaxLines: int,
 CallerID: string,
 …
}

ACD (Skill) Queue

Returned as an array by /acdqueues.

{
 AbandonThreshold: int,
 AcceptableQueueTime: int,
 AcdIcon: string,
 AcdName: string,
 Active: boolean,
 DefaultTimeout: int,
 DefaultTimeoutIvr: int,
 ID: int,
 …
}

Result Code

Returned as an array by /resultcodes. A list of the default result codes is available in the appendix.

{
 Code: string,
 Description: string,
 IsAgentViewable: boolean,
 IsCallAgain: boolean,
 IsCallback: boolean,
 IsSuccess: boolean,
 …
}

Methods

Note. A number of the following API methods send instructions to the live CCaaS system, for example GoReady and Dial. A successful response only confirms that the instruction reached the system, not that the requested action succeeded. For example, if you send a GoReady instruction for a user who isn’t logged in, or who’s already talking to a customer, the system ignores it.

Log In

Logs the agent into the system.

POST
/webservices/services/telephony/login
Body:
{
 UserId: int,
 CampaignId: int,
 Extension: string
}
Returns:
CallActionResponse containing integer result code

Log Out

Logs the agent out of the system.

POST
/webservices/services/telephony/logout
Body:
{
 UserId: int,
 CampaignId: int
}
Returns:
CallActionResponse containing integer result code

Get Calls

Returns the current active calls for the specified user.

GET
/webservices/services/telephony/getcalls/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of Calls

Go Ready

Puts the specified user into the ready status for the campaign they’re logged into.

GET
/webservices/services/telephony/goready/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing integer result code

Go Not Ready

Puts the specified user into the not ready status for the campaign they’re logged into.

PATCH
/webservices/services/telephony/gonotready/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing integer result code

Request Break

Requests to put the specified user into break status, using the break type specified by the Break Id.

PATCH
/webservices/services/telephony/gotobreak/user/{userId}
Params:
userId: int
Body:
{
 BreakId: int
}
Returns:
CallActionResponse containing integer result code
Note. The appendix lists the default break types and their Id values. You can configure this list of break types to meet your business needs.

Dial

Initiates a manual dial for the specified user to the given phone number. You can optionally specify a lead Id and campaign Id. By default, the number is matched to the newest lead. If there’s no match, the system creates a new lead.

GET
/webservices/services/telephony/dial/user/{userId}/phone/{PhoneNum}?leadid={leadId}&campaignId={campaignId}
Params:
userId: int
phoneNum: string
leadId: long
campaignId: int
Returns:
CallActionResponse containing Call data

Dial Ext

Initiates a manual dial for the specified user to the given phone number. The user Id and phone number are mandatory; all other parameters are optional.

When performing a manual dial, the system attempts to match a lead using the phone number, reference Id and list Id, if provided. Use this when the same phone number has multiple leads. If you supply a campaign Id, the call links to that campaign rather than the campaign the agent is currently on.

POST
/webservices/services/telephony/dialext
Body:
{
 UserId: int,
 PhoneNum: string,
 CampaignId: int,
 CLI: string,
 LeadId: long,
 ListId: int,
 ReferenceId: string,
 UniqueRef: string,
 AdvancedLeadLookUp: Boolean
}
Returns:
CallActionResponse containing Call data

Dial Preview

When a user is assigned a Preview Dial, use this endpoint to trigger the dialling of the preview call. Set the call Id parameter to the integer Id of the call the agent is currently previewing.

PATCH
/webservices/services/telephony/placepreviewdial/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result code

Hangup

Hangs up the specified call and puts the agent into the wrapping status.

GET
/webservices/services/telephony/hangup/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result code

Dispose

Dispositions the specified call with the chosen result code. The call is also hung up if it hasn’t been already.

GET
/webservices/services/telephony/dispose/user/{userId}/call/{callId}?resultCode={resultCode}&goReady={goReady}
Params:
userId: int
callId: int
resultCode: string (required)
goReady: boolean (optional, default: false)
Returns:
CallActionResponse containing integer result code
Note. A list of the default result codes is available in the appendix.

goReady controls whether the agent returns to the ready state after the call is disposed.

Hold

Places the specified call on hold.

GET
/webservices/services/telephony/hold/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result code

Retrieve

Retrieves the specified call from hold.

GET
/webservices/services/telephony/retrieve/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing integer result code

Start Recording

Starts or continues the recording for the specified call.

GET
/webservices/services/telephony/startrecord/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing an array of Calls

Stop Recording

Stops the recording of the specified call. Use this to prevent sensitive information, such as bank details, from being recorded.

GET
/webservices/services/telephony/stoprecord/user/{userId}/call/{callId}
Params:
userId: int
callId: int
Returns:
CallActionResponse containing an array of Calls

Campaigns

Gets an object containing all the campaigns in the system.

GET
/webservices/services/telephony/campaigns/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of Campaigns

Users

Gets an object containing the names and Ids of all users.

GET
/webservices/services/telephony/users/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of agent names and ids
Note. The userId parameter isn’t mandatory. You can call this method and pass a value of zero for this parameter.

Result Codes

Gets an array of all the available result codes.

GET
/webservices/services/telephony/resultcodes/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of result codes
Note. The userId parameter isn’t mandatory. You can call this method and pass a value of zero for this parameter. A list of the default result codes is available in the appendix.

ACD Queues

Returns a list of ACD queues in the system, also known as skill queues.

GET
/webservices/services/telephony/acdqueues/user/{userId}
Params:
userId: int
Returns:
CallActionResponse containing an array of ACD queues
Note. The userId parameter isn’t mandatory. You can call this method and pass a value of zero for this parameter.

Lead Phones

Returns the lead phones associated with the supplied lead Id.

GET
/webservices/services/telephony/leadphones/user/{userId}/lead/{leadId}
Params:
userId: int
leadId: long
Returns:
CallActionResponse containing an array lead phones
Note. The userId parameter isn’t mandatory. You can call this method and pass a value of zero for this parameter.

Change Lead Phone

Changes the lead of a call that’s in progress. Supply a lead phone Id, and the call is associated with that lead phone’s corresponding lead.

GET
/webservices/services/telephony/changelead/user/{userId}/call/{callId}/leadphone/{leadPhoneId}
Params:
userId: int
callId: int
leadPhoneId: int64
Returns:
CallActionResponse containing integer result code
Note. The userId parameter isn’t mandatory. You can call this method and pass a value of zero for this parameter.

Create New Lead

Creates a new lead with the specified phone number, then assigns the new lead to the specified call.

GET
/webservices/services/telephony/createnewlead/user/{userId}/call/{callId}/phone/{phoneNum}
Params:
userId: int
callId: int
phoneNum: string
Returns:
CallActionResponse containing integer result code
Note. The userId parameter isn’t mandatory. You can call this method and pass a value of zero for this parameter.

Connect Calls

Bridges two calls that are currently in progress together. Use this to perform a warm transfer to a third party or an external DDI. You can also specify a success count and notes relating to the call. The result codes and call Ids are required; notes and the number of successes are optional. A list of the default result codes is available in the appendix.

GET
/webservices/services/telephony/connectcalls/user/{userId}?call1={call1Id}&call2={call2Id}&resultcode1={resultCode1}&resultcode2={resultCode2}&notes1={notes1}&notes2={notes2}&numsales1={numSales1}&numsales2={numSales2}
Params Required:
userId: int
call1Id: int
call2Id: int
resultCode1: string
resultCode2: string
Params Optional:
notes1: string
notes2: string
numSales1: int
numSales2: int
Returns:
CallActionResponse containing integer result code

Transfer To User

Begins the transfer of an existing call from one agent to another.

POST
/webservices/services/telephony/transfertouser
Body:
{
 SendingUserId: int,
 ReceivingUserId: int,
 CallId: int,
 IsAttended: boolean,
 ResultCode: string
}
Returns:
CallActionResponse containing integer result code
Note. A list of the default result codes is available in the appendix.

Complete Transfer

Completes the transfer of an existing call from one agent to another.

POST
/webservices/services/telephony/completetransfer
Body:
{
 SendingUserId: int,
 ReceivingUserId: int,
 CallId: int,
 IsAttended: boolean,
 ResultCode: string
}
Returns:
CallActionResponse containing integer result code
Note. A list of the default result codes is available in the appendix.

Appendix

Appendix 1: Response Codes

The following table lists the response codes returned by the API methods.

IDDescription
-3Error
-2Command Timeout
-1Connection Failed
0Success
1General Failure
2Invalid Parameters
3Call No Longer Exists

Appendix 2: Record/Phone Types

The following table lists the available phone types recorded against each record in the lead phone table. This value identifies what type of contact details the lead phone record relates to.

IDDescription
0Home
1Work
2Mobile
3Home Email
4Work Email
5Messenger

Appendix 3: Recording States

The following table lists the recording states the system supports.

IDDescription
0NotRecording
1PendingStart
2CancelPendingStart
3Recording
4PendingStop

Appendix 4: Break Codes

The following table lists the default break types included with the system. You can amend this list in the Manager Portal application.

IDNameDescription
1BreakStandard 10 minute break.
2Lunch30 minute break for meals.
3MeetingBreak for a meeting.
4BioBreak to take care of biological needs.
5OtherA break that does not fit other categories.

Appendix 5: Result Codes

Result codes record the outcome of an interaction between an agent and an end customer, for example Sale, Callback or No Answer. The following table lists the result codes set up in the system when it’s shipped. You can edit this list in the Manager Portal application to meet your business requirements.

Result CodeDescription
ABANDONAbandoned Queue
ANSMACHAnswer Machine
BADBad Phone Number
BLACKLISTInbound call was blocked
BRIDGEBridge Call (Internal)
BRIDGE_WARMBridge Call (Warm Transfer) (Internal)
BUSYBusy
CALLBACKPrivate Callback
CANCELCancel - Third Party
DEADAIRDead Air
DNCDo Not Call
HKTHot Key Transfer
HKT_BRIDGEHot Key Transfer (Internal)
HKT_CANCELHKT Cancel - Third Party
HKT_WARMHot Key Transfer (Warm Transfer) (Internal)
IABANDONEDInteraction abandoned
IBRANCHEDInteraction branched
ICUSTOMERTIMEOUTInteraction customer timeout
IDUPLICATETERMINATEDuplicate Terminate Interaction
INBOUNDInbound
IRATEIrate
IRECEIVEDInteraction received
ISENTInteraction sent
ITERMINATEDInteraction terminated
ITIMEOUTInteraction timed out
ITXMOVEDInteraction Session Was Moved
ITXUSERDISCONNECTA User Disconnected before handling the interaction
KICKBARGEKicked and Retransferred
LIVEANSLive Answer (Person)
MAXTOMaximum Timeout Reached
NINot Interested
NOANSWERNo Answer
NOCARRIERNo Carrier
NOCPANo CPA (System)
OB-ABANOutbound Abandon
OPERATOROperator/Could Not Reach
REDIALRedial Client straight away
SKIPPEDSkipped Record
SYSANSMACHAnswering Machine (System)
SYSBUSYBusy (System)
SYSDROPDropped Call (System)
SYSFAXFax/Modem (System)
SYSNOANSNo Answer (System)
SYSOIOperator Intercept (System)
UNCONTACTUncontacted
USERAgent Nail-Up
WRAP_TOTimed-Out Wrapping
WRONGWrong Number
XFERTransferred
YANKYanked

Appendix 6: Call Statuses

Calls typically pass through a number of statuses during their lifetime. The following table lists these call statuses.

IDName
0Uncontacted
1NoCarrier
2Person
3NoAnswer
4Busy
5Operator
6Dropped
7AnswerMachine
8Transferring
9FaxModem
10DisconnectNoCpa
11DisconnectTimeout
12BadRecord
13Skipped
14DoNotCall
15Yanked
16Callback
17Ringing
18WrongNumber
19NotInterested
20Inbound
21Abandoned
22User
23Irate
24OutboundAbanoned
25InteractionSent
26InteractionTerminated
27InteractionAbandoned
28InteractionTimeout
29InteractionReceived
30InteractionBranched
31InteractionTerminateDuplicate
32InteractionMoved
33ItxUserDisconnect
34InteractionCustomerTimeout

Appendix 7: Call States

Calls typically pass through a number of states during their lifetime. The following table lists these call states.

IDName
0Unknown
1InBuffer
2PreviewQueue
3Previewing
4WaitingForLine
5Placing
6Ringing
7CpaAnalysis
8InDropQueue
9Transferring
10InIvr
11InExtension
12InQueue
13InConference
14Bridged
15OnHold
16PreviewOnHold
17WithAgent
18Wrapping
19Terminated
20History
21InVirtualQueue

Appendix 8: Cause Values

The following table lists the cause values the system supports.

IDName
-1Unknown
0Normal
1Busy
2NoAnswer
3Unobtainable
4NumberChanged
5OutOfOrder
6IncomingBarred
7Rejected
8Failed
9ChannelBusy
10NoChannels
11Congestion
12TcpConnectFailed
13SslError
14SslPeerCertNotTrusted
15SslPeerCertInvalid