= Purpose= ServicePattern Desktop JavaScript API Specification describes the Desktop JavaScript API that provides access to a number of functions of the ServicePattern Agent Desktop application from the web pages or IFrames loaded into this application from other domains. For general information about the ServicePattern Agent Desktop application, see [[#topic_agent-guide/Purpose|''ServicePattern Agent Guide'']]. For information about loading web pages into the Agent Desktop from scenarios, see description of the [[#topic_scenario-builder-reference-guide/WebScreenPop|Web Screen Pop]] block in the ''ServicePattern Scenario Builder Reference Guide''. = Audience= This guide is intended for the IT personnel responsible for the data infrastructure of the ServicePattern-based contact centers. Readers of this guide are expected to have expertise in web application development as well as solid understanding of contact center operations. = General Information= The API supports a number of desktop telephony functions including call initiation, voice and screen recording, interaction completion, and 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>'' = Dial Number= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''dialNumber(number);'' |- |'''Description''' |Makes a call to the specified number. For more information, see sections [[#topic_agent-guide/HowtoMakeanInternalCall|How to Make an Internal Call]] and [[#topic_agent-guide/HowtoMakeanOutboundCall|How to Make an Outbound Call]] of the ''ServicePattern Agent Guide''. |- |'''Parameters''' |''number'' – string containing the number to be dialed; required |} = Select Service= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''selectService(name);'' |- |'''Description''' |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 sections [[#topic_agent-guide/HowtoMakeanInternalCall|How to Make an Internal Call]] and [[#topic_agent-guide/HowtoMakeanOutboundCall|How to Make an Outbound Call]] of the ''ServicePattern Agent Guide''. |- |'''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 |} = Single-Step Transfer= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''singleStepTransfer(number);'' |- |'''Description''' |Initiates a [[#topic_agent-guide/HowtoPlaceaCallinaServiceQueue|single-step (blind) transfer]] of the current call to the specified number. |- |'''Parameters''' |''number'' – string containing the number that the call is to be transferred to; required |} = Single-Step Conference= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''singleStepConference(number);'' |- |'''Description''' |Initiates a [[#topic_agent-guide/HowtoHostaConference|single-step conference]] with the current party on the call and the party at the specified number. |- |'''Parameters''' |''number'' – string containing the number that the call is to be conferenced with; required |} = Terminate Interaction= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''terminateInteraction();'' |- |'''Description''' |Unlike [[#topic_desktop-javascript-api-specification/CompleteInteraction|Complete Interaction]], this method only [[#topic_agent-guide/HowtoReleaseaCall|releases the communication channel]] of the current interaction. I.e., if after-call work (ACW) is configured for the corresponding service, interaction processing will continue until ACW is completed. |} = Set Notes= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''setNotes(notes);'' |- |'''Description''' |Sets the [[#topic_agent-guide/HowtoEnterDispositionsandNotes|free-form notes]] for the current interaction to the specified string. |- |'''Parameters''' |''notes'' – string containing the interaction notes |} = Set Disposition= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''setDisposition(dispositionCode);'' |- |'''Description''' |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]]. |- |'''Parameters''' |''dispositionCode'' – string containing the numeric code of the desired disposition |} = Complete Interaction= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''completeInteraction();'' |- |'''Description''' |[[#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, the Agent Desktop will show a warning message. |} = Complete Interaction with Disposition and Notes= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''completeInteractionWithDisp(dispositionCode, notes);'' |- |'''Description''' |[[#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). |- |'''Parameters''' |''dispositionCode'' – string containing the [[#topic_contact-center-administrator-guide/DispositionsTab|alphanumeric code]] of the desired disposition ''notes'' – string containing the interaction notes |} = Get Call Recording Status= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''getCallRecordingStatus(callback);'' |- |'''Description''' |Requests the current status of voice recording of the current call. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Start Call Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''startCallRecording(callback);'' |- |'''Description''' |Starts voice recording for the current call. For more information, see section [[#topic_agent-guide/HowtoRecordaCall|How to Record a Call]] of the ''ServicePattern Agent Guide''. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method; see ''Callback'' |- |'''Note''' |Prior to version 3.8, this method was called ''startCurrentCallRecording();'' backward compatibility is preserved |} = Stop Call Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''stopCallRecording(callback);'' |- |'''Description''' |Stops voice recording for the current call. |- |'''Parameters''' |''callback'' – function that will be called upon completion of the method; see ''Callback'' |- |'''Note''' |Prior to version 3.8, this method was called ''stopCurrentCallRecording();'' backward compatibility is preserved |} = Mute Call Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''muteCallRecording(callback);'' |- |'''Description''' |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. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Unmute Call Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''unmuteCallRecording(callback);'' |- |'''Description''' |Unmutes the previously [[#topic_desktop-javascript-api-specification/MuteCallRecording|muted]] voice recording for the current call. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Get Screen Recording Status= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''getScreenRecordingStatus(callback);'' |- |'''Description''' |Requests the current status of screen recording of the user session. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Stop Screen Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''stopScreenRecording(callback);'' |- |'''Description''' |Stops screen recording of the user session. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Pause Screen Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''pauseScreenRecording(callback);'' |- |'''Description''' |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. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Resume Screen Recording= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''resumeScreenRecording(callback);'' |- |'''Description''' |Resumes the previously [[#topic_desktop-javascript-api-specification/PauseScreenRecording|paused]] screen recording of the user session. |- |'''Parameters''' |[[#topic_desktop-javascript-api-specification/Callback|''callback'']] – function that will be called upon completion of the method |} = Callback= {|border="1" style="border-collapse:collapse" cellpadding="5" |'''Syntax''' |''callback = function(data) {'' ''data.recording = 1/0;'' ''data.muted = 1/0;'' ''data.paused = 1/0;'' ''}'' |- |'''Description''' |Function that is called upon completion of the call/screen recording methods. |- |'''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 |}