summaryrefslogtreecommitdiff
path: root/rest-api-templates
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-07-03 17:58:45 +0000
committerDavid M. Lee <dlee@digium.com>2013-07-03 17:58:45 +0000
commita75fd32212c35b41143442bd757387fad636177a (patch)
tree461033acf36f4596d8fc9800a1195e12207b3ea2 /rest-api-templates
parentc4adaf91067559dd5aa90577e181693abade0602 (diff)
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
Diffstat (limited to 'rest-api-templates')
-rw-r--r--rest-api-templates/asterisk_processor.py5
-rw-r--r--rest-api-templates/swagger_model.py8
2 files changed, 6 insertions, 7 deletions
diff --git a/rest-api-templates/asterisk_processor.py b/rest-api-templates/asterisk_processor.py
index 0260b6b55..6f69b4865 100644
--- a/rest-api-templates/asterisk_processor.py
+++ b/rest-api-templates/asterisk_processor.py
@@ -139,10 +139,11 @@ class AsteriskProcessor(SwaggerPostProcessor):
#: String conversion functions for string to C type.
convert_mapping = {
- 'const char *': '',
+ 'string': '',
'int': 'atoi',
'long': 'atol',
'double': 'atof',
+ 'boolean': 'ast_true',
}
def __init__(self, wiki_prefix):
@@ -194,7 +195,7 @@ class AsteriskProcessor(SwaggerPostProcessor):
# Parameter names are camelcase, Asterisk convention is snake case
parameter.c_name = snakify(parameter.name)
parameter.c_data_type = self.type_mapping[parameter.data_type]
- parameter.c_convert = self.convert_mapping[parameter.c_data_type]
+ parameter.c_convert = self.convert_mapping[parameter.data_type]
# You shouldn't put a space between 'char *' and the variable
if parameter.c_data_type.endswith('*'):
parameter.c_space = ''
diff --git a/rest-api-templates/swagger_model.py b/rest-api-templates/swagger_model.py
index 2907688c5..aa065b342 100644
--- a/rest-api-templates/swagger_model.py
+++ b/rest-api-templates/swagger_model.py
@@ -246,11 +246,9 @@ def load_allowable_values(json, context):
value_type = json['valueType']
if value_type == 'RANGE':
- if not 'min' in json:
- raise SwaggerError("Missing field min", context)
- if not 'max' in json:
- raise SwaggerError("Missing field max", context)
- return AllowableRange(json['min'], json['max'])
+ if not 'min' in json and not 'max' in json:
+ raise SwaggerError("Missing fields min/max", context)
+ return AllowableRange(json.get('min'), json.get('max'))
if value_type == 'LIST':
if not 'values' in json:
raise SwaggerError("Missing field values", context)