The Audio Data Service can be used to request a single audio data file from the server. The user needs to be logged in and authorized for the audio file requested, however a download token is not required in order to retrieve files.
Service Pre-requisites
The service requires:
- The
JSESSIONIDobtained from the Log In Service - Search criteria for calls provided as input parameters
Service Invocation
An HTTP POST method must be addressed to the following URL:
http://<server>/callrec/audiodata
Input Parameters
The service expects to receive:
- The previously obtained
JSESSIONIDto identify the user in the form of:- A cookie
- An append to the URL immediately after the servlet name, as follows:
jsessionid=<sessionid>
Input Parameters
When requesting audio data, search criteria must be specified. The Audio Data Service accepts one or more of the following search parameters:
Output
The service will return:
- An HTTP status
- This status can be:
200 OK:always returned
- This status can be:
- A body response
- The response will be sent as
text/xml, and will include details about the operation; for example: problem with connection
- The response will be sent as
- The actual media file returned as
application/octet-stream, if the operation was successful
Important:This status will be sent in all cases, including when the parameters are correct, incorrect, or when the request is malformed.
The service expects the search criteria to identify a single audio file. If multiple audio files meet the search criteria, then no audio file will be returned, and the body response will return the list of couple IDs. The maximum size of this list is 1000.
Request a Media File with the Send Call File Service Example
Now that we have the download token, the Send Call File Service can be called:
With Firefox:
Enter the following URL into the browser to invoke the Send Call File Service (substituting in the download token obtained):
http://<server>/callrec/sendcallfile.mp3;jsessionid=< jsessionid>?token=<download_token>
The server will respond by sending a zip containing the requested media files, triggering the browser to display the file open/save dialog.
With cURL:
Invoke the Send Call Service with the following request:
curl -v -b cookies.txt -c cookies.txt -X POST -d "token=<download_token>" \ -H"Content-Type: application/x-www-form-urlencoded" -H"Accept: application/octet-stream" \ -o file.zip http://<server>/callrec/sendcallfile.mp3
The server will respond with a zip containing the requested media files:
* About to connect() to myserver port 80 (#0)
* Trying 10.0.0.1... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0connected
* Connected to myserver (10.0.0.1) port 80 (#0)
> POST /callrec/sendcallfile.mp3 HTTP/1.1
> User-Agent: curl/7.21.0 (x86_64-pc-linux-gnu) libcurl/7.21.0 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: myserver
> Cookie: JSESSIONID=8A355EC61B5D804447704B8CB64DF535
> Content-Type: application/x-www-form-urlencoded
> Accept: application/octet-stream
> Content-Length: 26
> } [data not shown]
< HTTP/1.1 200 OK
< Server: Apache-Coyote/1.1
< Content-Disposition: attachment; filename=calldata.zip
< Content-Type: application/zip;
< Transfer-Encoding: chunked
< Date: Fri, 20 May 2011 13:55:18 GMT
< { [data not shown]
100 40521 0 40521 0 26 440k 289 --:--:-- --:--:-- --:--:-- 454k
* Connection #0 to host myserver left intact
* Closing connection #0
See the description of the Send Call File Service for more details about valid search parameters.