= Purpose=
The Bright Pattern Contact Center ''Desktop JavaScript API Specification'' describes the Desktop JavaScript API that provides access to a number of functions of the Bright Pattern Contact Center Agent Desktop application from the web pages or IFrames loaded into this application from other domains.
For general information about the Bright Pattern Contact Center Agent Desktop application, see the [[#topic_agent-guide/Purpose|''Agent Guide'']]. For information about loading web pages into Agent Desktop from scenarios, see the ''Scenario Builder Reference Guide'', section [[#topic_scenario-builder-reference-guide/WebScreenPop|Web Screen Pop]] block.
[[#topic_desktop-javascript-api-specification/Audience|Next >]]
= Audience=
This guide is intended for the IT personnel responsible for the data infrastructure of Bright Pattern Contact Center-based contact centers. Readers of this guide are expected to have expertise in web application development as well as a solid understanding of contact center operations.
[[#topic_desktop-javascript-api-specification/Purpose|< Previous]] | [[#topic_desktop-javascript-api-specification/GeneralInformation|Next >]]
= General Information=
The API supports a number of desktop telephony functions, including call initiation, voice and screen recording, interaction completion, and the setting of interaction dispositions and notes.
These functions are available via a global object called ''window.bpspat.api''.
For example:
''window.bpspat.api.dialNumber(“1234567”);''
The object is created when the script file is included in the web page loaded into the Agent Desktop application as follows:
''<script type="text/javascript" src="[agent-desktop-web-server]/app/libs/servicepatternapi-dev.js"></script>''
For example:
''<script type="text/javascript" src="''[http://barco.brightpattern.com/app/libs/servicepatternapi-dev.js ''https://barco.brightpattern.com/app/libs/servicepatternapi-dev.js'']''"></script>''
[[#topic_desktop-javascript-api-specification/Audience|< Previous]] | [[#topic_desktop-javascript-api-specification/DialNumber|Next >]]
= Dial Number=
This function makes a call to the specified number.
For more information, see the Bright Pattern Contact Center ''Agent Guide'', section [[#topic_agent-guide/HowtoMakeanInternalCall|How to Make an Internal Call]] and section [[#topic_agent-guide/HowtoMakeanOutboundCall|How to Make an Outbound Call]].
== Syntax ==
''dialNumber(number);''
== Parameters ==
''number'' – String containing the number to be dialed; required
[[#topic_desktop-javascript-api-specification/GeneralInformation|< Previous]] | [[#topic_desktop-javascript-api-specification/SelectService|Next >]]
= Select Service=
This function selects the service that will be associated with subsequent call attempts (until another service is selected using this method or via Agent Desktop)
For more information, see the Bright Pattern Contact Center ''Agent Guide'', section [[#topic_agent-guide/HowtoMakeanInternalCall|How to Make an Internal Call]] and section [[#topic_agent-guide/HowtoMakeanOutboundCall|How to Make an Outbound Call]].
== Syntax ==
''selectService(name);''
== Parameters ==
''name'' – String containing the name of the selected service; optional
If omitted or empty, subsequent call attempts will not be associated with any service.
[[#topic_desktop-javascript-api-specification/DialNumber|< Previous]] | [[#topic_desktop-javascript-api-specification/Single-StepTransfer|Next >]]
= Single-Step Transfer=
This function initiates a [[#topic_agent-guide/HowtoPlaceaCallinaServiceQueue|single-step (blind) transfer]] of the current call to the specified number.
== Syntax ==
''singleStepTransfer(number);''
== Parameters ==
''number'' – string containing the number to which the call is to be transferred; required
[[#topic_desktop-javascript-api-specification/SelectService|< Previous]] | [[#topic_desktop-javascript-api-specification/Single-StepConference|Next >]]
= Single-Step Conference=
This function initiates a [[#topic_agent-guide/HowtoHostaConference|single-step conference]] with the current party on the call and the party at the specified number.
== Syntax ==
''singleStepConference(number);''
== Parameters ==
''number'' – string containing the number for which the call is to be conferenced; required
[[#topic_desktop-javascript-api-specification/Single-StepTransfer|< Previous]] | [[#topic_desktop-javascript-api-specification/TerminateInteraction|Next >]]
= Terminate Interaction=
Unlike [[#topic_desktop-javascript-api-specification/CompleteInteraction|Complete Interaction]], this method only [[#topic_agent-guide/HowtoReleaseaCall|releases the communication channel]] of the current interaction.
For example, if after-call work (ACW) is configured for the corresponding service, interaction processing will continue until ACW is completed.
== Syntax ==
''terminateInteraction();''
[[#topic_desktop-javascript-api-specification/Single-StepConference|< Previous]] | [[#topic_desktop-javascript-api-specification/SetNotes|Next >]]
= Set Notes=
This function sets the [[#topic_agent-guide/HowtoEnterDispositionsandNotes|free-form notes]] for the current interaction to the specified string.
== Syntax ==
''setNotes(notes);''
== Parameters ==
''notes'' – String containing the interaction notes
[[#topic_desktop-javascript-api-specification/TerminateInteraction|< Previous]] | [[#topic_desktop-javascript-api-specification/SetDisposition|Next >]]
= Set Disposition=
This function sets the [[#topic_agent-guide/HowtoEnterDispositionsandNotes|disposition]] for the current interaction to the value corresponding to the [[#topic_contact-center-administrator-guide/DispositionsTab|alphanumeric code specified for this disposition]].
== Syntax ==
''setDisposition(dispositionCode);''
== Parameters ==
''dispositionCode'' – String containing the numeric code of the desired disposition
[[#topic_desktop-javascript-api-specification/SetNotes|< Previous]] | [[#topic_desktop-javascript-api-specification/CompleteInteraction|Next >]]
= Complete Interaction=
This function [[#topic_agent-guide/HowtoWrapUpAfter-callWork|completes]] the current interaction.
If the interaction [[#topic_contact-center-administrator-guide/PropertiesTab|requires a disposition]] in order to be completed, Agent Desktop will show a warning message.
== Syntax ==
''completeInteraction();''
[[#topic_desktop-javascript-api-specification/SetDisposition|< Previous]] | [[#topic_desktop-javascript-api-specification/CompleteInteractionwithDispositionandNotes|Next >]]
= Complete Interaction with Disposition and Notes=
This function [[#topic_agent-guide/HowtoWrapUpAfter-callWork|completes]] the current interaction and [[#topic_agent-guide/HowtoEnterDispositionsandNotes|sets its disposition and notes]] to the specified values (i.e., combines the actions of the [[#topic_desktop-javascript-api-specification/SetNotes|Set Notes]], [[#topic_desktop-javascript-api-specification/SetDisposition|Set Disposition]], and [[#topic_desktop-javascript-api-specification/CompleteInteraction|Complete Interaction]] methods).
== Syntax ==
''completeInteractionWithDisp(dispositionCode, notes);
== Parameters ==
''dispositionCode'' – String containing the [[#topic_contact-center-administrator-guide/DispositionsTab|alphanumeric code]] of the desired disposition
''notes'' – String containing the interaction notes
[[#topic_desktop-javascript-api-specification/CompleteInteraction|< Previous]] | [[#topic_desktop-javascript-api-specification/GetCallRecordingStatus|Next >]]
= Get Call Recording Status=
This function requests the current status of voice recording of the current call.
== Syntax ==
''getCallRecordingStatus(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/CompleteInteractionwithDispositionandNotes|< Previous]] | [[#topic_desktop-javascript-api-specification/StartCallRecording|Next >]]
= Start Call Recording=
This function starts voice recording for the current call.
For more information, see the Bright Pattern Contact Center ''Agent Guide'', section [[#topic_agent-guide/HowtoRecordaCall|How to Record a Call]].
== Syntax ==
''startCallRecording(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method; see ''Callback''
Note that prior to Bright Pattern Contact Center version 3.8, this method was called ''startCurrentCallRecording();'' and backward compatibility is preserved.
[[#topic_desktop-javascript-api-specification/GetCallRecordingStatus|< Previous]] | [[#topic_desktop-javascript-api-specification/StopCallRecording|Next >]]
= Stop Call Recording=
This function stops voice recording for the current call.
== Syntax ==
''stopCallRecording(callback);''
== Parameters ==
''callback'' – Function that will be called upon completion of the method; see ''[[#topic_desktop-javascript-api-specification/Callback|Callback]]''
Note that prior to Bright Pattern Contact Center version 3.8, this method was called ''stopCurrentCallRecording();'' and backward compatibility is preserved.
[[#topic_desktop-javascript-api-specification/StartCallRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/MuteCallRecording|Next >]]
= Mute Call Recording=
This function mutes voice recording for the current call. Unlike [[#topic_desktop-javascript-api-specification/StopCallRecording|Stop Call Recording]], this method will continue voice recording for the current call, but any voice signal will be replaced with silence.
== Syntax ==
''muteCallRecording(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/StopCallRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/UnmuteCallRecording|Next >]]
= Unmute Call Recording=
This function unmutes the previously [[#topic_desktop-javascript-api-specification/MuteCallRecording|muted]] voice recording for the current call.
== Syntax ==
''unmuteCallRecording(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/MuteCallRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/GetScreenRecordingStatus|Next >]]
= Get Screen Recording Status=
This function requests the current status of screen recording of the user session.
== Syntax ==
''getScreenRecordingStatus(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/UnmuteCallRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/StopScreenRecording|Next >]]
= Stop Screen Recording=
This function stops screen recording of the user session.
== Syntax==
''stopScreenRecording(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/GetScreenRecordingStatus|< Previous]] | [[#topic_desktop-javascript-api-specification/PauseScreenRecording|Next >]]
= Pause Screen Recording=
This function pauses screen recording of the user session.
For the period when screen recording is paused, the recording will contain a static snapshot of the desktop at the moment when pause was applied.
== Syntax ==
''pauseScreenRecording(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/StopScreenRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/ResumeScreenRecording|Next >]]
= Resume Screen Recording=
This function resumes the previously [[#topic_desktop-javascript-api-specification/PauseScreenRecording|paused]] screen recording of the user session.
== Syntax ==
''resumeScreenRecording(callback);''
== Parameters ==
[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – Function that will be called upon completion of the method
[[#topic_desktop-javascript-api-specification/PauseScreenRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/Callback|Next >]]
= Pause Call and Screen Recording=
{|border="1" style="border-collapse:collapse" cellpadding="5"
|'''Syntax'''
|''parent.frames.postMessage('{"command": "MUTE_CALL_RECORDINGS"}', '*');''
|-
|'''Description'''
|Mutes call recording (e.g., when an agent opens a payment screen, a third-party web application loaded into Agent Desktop may issue the Javascript command). Note that it does not require loading API code on the application's page.
|-
|}
{|border="1" style="border-collapse:collapse" cellpadding="5"
|'''Syntax'''
|''parent.frames.postMessage('{"command": "MUTE_SCREEN_RECORDINGS"}', '*');''
|-
|'''Description'''
|Nutes screen recording (e.g., when an agent opens a payment screen, a third-party web application loaded into Agent Desktop may issue the Javascript command). Note that it does not require loading API code on the application's page.
|-
|}
[[#topic_desktop-javascript-api-specification/ResumeScreenRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/ResumeCallandScreenRecording|Next >]]
= Resume Call and Screen Recording=
{|border="1" style="border-collapse:collapse" cellpadding="5"
|'''Syntax'''
|''parent.frames.postMessage('{"command": "UNMUTE_CALL_RECORDINGS"}', '*');''
|-
|'''Description'''
|Resumes call recording (e.g., when an agent exits a payment screen, a third-party web application loaded into Agent Desktop may issue the Javascript command). Note that it does not require loading API code on the application's page.
|-
|}
{|border="1" style="border-collapse:collapse" cellpadding="5"
|'''Syntax'''
|''parent.frames.postMessage('{"command": "UNMUTE_SCREEN_RECORDINGS"}', '*');''
|-
|'''Description'''
|Resumes screen recording (e.g., when an agent exits a payment screen, a third-party web application loaded into Agent Desktop may issue the Javascript command). Note that it does not require loading API code on the application's page.
|-
|}
[[#topic_desktop-javascript-api-specification/PauseCallandScreenRecording|< Previous]] | [[#topic_desktop-javascript-api-specification/Callback|Next >]]
= Callback=
This is the function that is called upon completion of the call/screen recording methods.
== Syntax ==
''callback = function(data) {''
''data.recording = 1/0;''
''data.muted = 1/0;''
''data.paused = 1/0;''
''}''
== Parameters ==
''data.recording'' – Boolean; indicates if voice/screen recording is currently in progress; note that voice recording is applied to interactions (calls), while screen recording is applied to user sessions
''data.muted'' – Boolean; indicates if voice recording is currently muted; returned only for the voice recording methods
''data.paused'' – Boolean; indicates if screen recording is currently paused; returned only for the screen recording methods
[[#topic_desktop-javascript-api-specification/ResumeScreenRecording|< Previous]]