ARI - channel recording support

This patch is the first step in adding recording support to the
Asterisk REST Interface.

Recordings are stored in /var/spool/recording. Since recordings may be
destructive (overwriting existing files), the API rejects attempts to
escape the recording directory (avoiding issues if someone attempts to
record to ../../lib/sounds/greeting, for example).

(closes issue ASTERISK-21594)
(closes issue ASTERISK-21581)
Review: https://reviewboard.asterisk.org/r/2612/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393550 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
David M. Lee
2013-07-03 17:58:45 +00:00
parent c4adaf9106
commit a75fd32212
29 changed files with 1247 additions and 146 deletions

View File

@@ -565,7 +565,11 @@
"required": false,
"allowMultiple": false,
"dataType": "int",
"defaultValue": 0
"defaultValue": 0,
"allowableValues": {
"valueType": "RANGE",
"min": 0
}
},
{
"name": "maxSilenceSeconds",
@@ -574,16 +578,28 @@
"required": false,
"allowMultiple": false,
"dataType": "int",
"defaultValue": 0
"defaultValue": 0,
"allowableValues": {
"valueType": "RANGE",
"min": 0
}
},
{
"name": "append",
"description": "If true, and recording already exists, append to recording",
"name": "ifExists",
"description": "Action to take if a recording with the same name already exists.",
"paramType": "query",
"required": false,
"allowMultiple": false,
"dataType": "boolean",
"defaultValue": false
"dataType": "string",
"defaultValue": "fail",
"allowableValues": {
"valueType": "LIST",
"values": [
"fail",
"overwrite",
"append"
]
}
},
{
"name": "beep",
@@ -614,13 +630,17 @@
}
],
"errorResponses": [
{
"code": 400,
"reason": "Invalid parameters"
},
{
"code": 404,
"reason": "Channel not found"
},
{
"code": 409,
"reason": "Channel is not in a Stasis application, or the channel is currently bridged with other channels."
"reason": "Channel is not in a Stasis application; the channel is currently bridged with other channels; A recording with the same name is currently in progress."
}
]
}

View File

@@ -20,7 +20,7 @@
]
},
{
"path": "/recordings/stored/{recordingId}",
"path": "/recordings/stored/{recordingName}",
"description": "Individual recording",
"operations": [
{
@@ -30,8 +30,8 @@
"responseClass": "StoredRecording",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -46,8 +46,8 @@
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -70,7 +70,7 @@
]
},
{
"path": "/recordings/live/{recordingId}",
"path": "/recordings/live/{recordingName}",
"description": "A recording that is in progress",
"operations": [
{
@@ -80,8 +80,8 @@
"responseClass": "LiveRecording",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -96,8 +96,8 @@
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -108,7 +108,7 @@
]
},
{
"path": "/recordings/live/{recordingId}/stop",
"path": "/recordings/live/{recordingName}/stop",
"operations": [
{
"httpMethod": "POST",
@@ -117,8 +117,8 @@
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -129,17 +129,18 @@
]
},
{
"path": "/recordings/live/{recordingId}/pause",
"path": "/recordings/live/{recordingName}/pause",
"operations": [
{
"httpMethod": "POST",
"summary": "Pause a live recording.",
"notes": "Pausing a recording suspends silence detection, which will be restarted when the recording is unpaused.",
"nickname": "pauseRecording",
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -150,7 +151,7 @@
]
},
{
"path": "/recordings/live/{recordingId}/unpause",
"path": "/recordings/live/{recordingName}/unpause",
"operations": [
{
"httpMethod": "POST",
@@ -159,8 +160,8 @@
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -171,17 +172,18 @@
]
},
{
"path": "/recordings/live/{recordingId}/mute",
"path": "/recordings/live/{recordingName}/mute",
"operations": [
{
"httpMethod": "POST",
"summary": "Mute a live recording.",
"notes": "Muting a recording suspends silence detection, which will be restarted when the recording is unmuted.",
"nickname": "muteRecording",
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,
@@ -192,7 +194,7 @@
]
},
{
"path": "/recordings/live/{recordingId}/unmute",
"path": "/recordings/live/{recordingName}/unmute",
"operations": [
{
"httpMethod": "POST",
@@ -201,8 +203,8 @@
"responseClass": "void",
"parameters": [
{
"name": "recordingId",
"description": "Recording's id",
"name": "recordingName",
"description": "The name of the recording",
"paramType": "path",
"required": true,
"allowMultiple": false,