fireOnCallEnd()

Fires an event that notifies a call has ended. Use to get information or send information between an interaction log and a custom console component. This method executes when fireOnCallBegin() is called first. This method is only available in API version 31.0 or later.

Syntax 

1sforce.console.cti.fireOnCallEnd( callObjectId:String, callDuration:Number, callDisposition:String, (optional)callback:Function )

Arguments 

NameTypeDescription
callObjectIdstringThe object ID of the call.
callDurationnumberNumber specifying the duration of the call.
callDispositionstringString representing the call’s disposition, such as call successful, left voicemail, or disconnected.
callbackfunctionJavaScript method called upon completion of the method.

Sample Code–Visualforce 

1<apex:page>
2    <A HREF="#" onClick="testFireOnCallEnd();return false">
3             Click here to end a call</A>
4
5    <apex:includeScript value="/support/console/68.0/integration.js"/>
6    <script type="text/javascript">
7
8        function testFireOnCallEnd() {
9            //Here, 'call.1' refers to a call that is in progress.
10            sforce.console.cti.fireOnCallEnd('call.1', 60, 'Set Appointment');
11        }
12
13    </script>
14</apex:page>

Response 

This method is asynchronous, so it returns its response in an object in a callback method. The response object contains the following field:

NameTypeDescription
successbooleantrue if firing the event is successful, false otherwise.