# Recorder

The Recorder resource encapsulates a single instance of a media recording resource. This resource defines the source for the media recording operation (MediaStream or Conference) the destination for the recording, and various media-related properties associated with the Recorder resource.

## XML Definition

<recorder identifier="<identifier>" appid="<appid>"
href=http://server/dialogicwebservice/mediacontrol/recorders/<identifier>
streamidentifier="<stream identifier>" conferenceidentifier="<conference identifier>"
destination="<destination>" append="< boolean >" duration=”<duration>”
dtmfterminate=”<digits>” initsilence=”<milliseconds>” endsilence=”<milliseconds>”>
</recorder>

## Recorder Properties

Name | Description | Type | Input / Output | Optional / Mandatory
identifier | Unique identifier assigned to the specific instance of the resource. This identifier is used by the web service client when performing actions on the resource. | String | Output | N/A
appid | Unique application id included in the original HTTP POST creation process that is utilized by the web service such that clients only have access to resources that they created | String | Output | N/A
href | An HTTP reference to the specific resource | String | Output | N/A
streamidentifier | Unique identifier of the MediaStream that is being recorded by the resource | String | Input / Output | Mandatory if conferenceidentifier is not being set
conferenceidentifier | Unique identifier of the Conference that is being recorded by the resource | String | Input / Output | Mandatory if streamidentifier is not being set.
destination | The location where the Recorder resource will store the recording | String URL | Input / Output | Mandatory
append | Append recording to a previously created recording | Boolean | Input / Output | Optional
duration | Length of time to record (in milliseconds) | Integer (milliseconds) | Input / Output | Optional
dtmfterminate | A list of digits that can be used to terminate the recording process | String | Input / Output | Optional
initsilence | Initial silence (in milliseconds) that will terminate the recording operation | Integer (milliseconds) | Input / Output | Optional
endsilence | Ending silence (in milliseconds) that will terminate the recording operation | Integer (milliseconds) | Input / Output | Optional

## Interaction Diagram

### Recorder Creation

The following diagram illustrates the Recorder creation process.

### Recorder Deletion

The following diagram illustrates the Recorder deletion process.

## Java Sample Code

public void CreateRecorder(String srcIdentifier, IdentifierType type, String dest) {
logger.info("Recorder:: CreateRecorder - Entered.");
//Create a HttpURLConnection with the correct server
//Send request to create recorder and retrieve response
String response = "";
String identifierText = "streamidentifier";
if (type == IdentifierType.CONFERENCE) {
identifierText = "conferenceidentifier";
}
String requestBody = "<recorder " +
identifierText +
"=\"" +
srcIdentifier +
"\" " +
“destination=\”” +
dest +
“\”” +
">" +
"</recorder>";
HttpURLConnection connection = utils.SendHTTPRequest("http://" + MainSipServlet.WMSHost + ":81/DialogicWebService/mediacontrol/recorders",
"POST",
requestBody);
if (connection != null) {
response = utils.GetHTTPStringResponse(connection);
}
//Retrive response codes
int responseCode = 0;
try {
responseCode = connection.getResponseCode();
} catch (IOException ex) {
Logger.getLogger(MainSipServlet.class.getName()).log(Level.SEVERE, null, ex);
}
String responseMessage = "";
try {
responseMessage = connection.getResponseMessage();
} catch (IOException ex) {
Logger.getLogger(MainSipServlet.class.getName()).log(Level.SEVERE, null, ex);
}
String responseLocation = connection.getHeaderField("location");
//close the connection
connection.disconnect();
//log results
logger.info("Recorder:: CreateRecorder - Http response code =" + responseCode);
logger.info("Recorder:: CreateRecorder - Http response message =" + responseMessage);
logger.info("Recorder:: CreateRecorder - Http response location =" + responseLocation);
if (responseCode == 201) {
recorderRef = responseLocation;
int index = recorderRef.lastIndexOf("/recorders", recorderRef.length());
resourceId = recorderRef.substring(index+11);
logger.info("Recorder:: CreateRecorder - Resource Id = " + resourceId);
}
logger.info("Recorder:: CreateRecorder - Exited.");
}