To end a call using the JSONP interface, you need to issue a GET request to /call/2.0/<sessionId>/end?callback=<callbackFunction>
where:
<sessionId> is the session ID that uniquely identifies the call. This is the value returned in the sessionId attribute of the response for the originating start call request.
<callbackFunction> specifies the name of the call back function to which the server‐side JSON response is passed.
If the request is successful, then the response body should contain a JavaScript function call with the JSONresponse, which contains call status information for the call, embedded in the function call. The name of the function is specified in the callback request parameter.
For example, if the callback request parameter contains the name ‘processEndCallResponse’, then the response body is as follows (for a connected call):
processEndCallResponse({"callState":"ending"});
If the request is unsuccessful, the response body is:
processCallStatusResponse({"statuscode":"<statusCode>","reason":"<reason>"});
where <statusCode> contains the HTTP status code (i.e. 400, 403, 404) and <reason> contains the reason for the unsuccessful request.