[asterisk-commits] jrose: trunk r402002 - in /trunk: ./ res/ res/ari/ rest-api/api-docs/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 25 17:01:46 CDT 2013


Author: jrose
Date: Fri Oct 25 17:01:43 2013
New Revision: 402002

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402002
Log:
ARI: channel/bridge recording errors when invalid format specified

Asterisk will now issue 422 if recording is requested against channels
or bridges with an unknown format

(closes issue ASTERISK-22626)
Reported by: Joshua Colp
Review: https://reviewboard.asterisk.org/r/2939/
........

Merged revisions 402001 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/ari/resource_bridges.c
    trunk/res/ari/resource_channels.c
    trunk/res/res_ari_bridges.c
    trunk/res/res_ari_channels.c
    trunk/rest-api/api-docs/bridges.json
    trunk/rest-api/api-docs/channels.json

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/ari/resource_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_bridges.c?view=diff&rev=402002&r1=402001&r2=402002
==============================================================================
--- trunk/res/ari/resource_bridges.c (original)
+++ trunk/res/ari/resource_bridges.c Fri Oct 25 17:01:43 2013
@@ -438,6 +438,27 @@
 	options->if_exists =
 		stasis_app_recording_if_exists_parse(args->if_exists);
 	options->beep = args->beep;
+
+	if (options->terminate_on == STASIS_APP_RECORDING_TERMINATE_INVALID) {
+		ast_ari_response_error(
+			response, 400, "Bad Request",
+			"terminateOn invalid");
+		return;
+	}
+
+	if (options->if_exists == -1) {
+		ast_ari_response_error(
+			response, 400, "Bad Request",
+			"ifExists invalid");
+		return;
+	}
+
+	if (!ast_get_format_for_file_ext(options->format)) {
+		ast_ari_response_error(
+			response, 422, "Unprocessable Entity",
+			"specified format is unknown on this system");
+		return;
+	}
 
 	recording = stasis_app_control_record(control, options);
 	if (recording == NULL) {

Modified: trunk/res/ari/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_channels.c?view=diff&rev=402002&r1=402001&r2=402002
==============================================================================
--- trunk/res/ari/resource_channels.c (original)
+++ trunk/res/ari/resource_channels.c Fri Oct 25 17:01:43 2013
@@ -404,6 +404,13 @@
 		ast_ari_response_error(
 			response, 400, "Bad Request",
 			"ifExists invalid");
+		return;
+	}
+
+	if (!ast_get_format_for_file_ext(options->format)) {
+		ast_ari_response_error(
+			response, 422, "Unprocessable Entity",
+			"specified format is unknown on this system");
 		return;
 	}
 

Modified: trunk/res/res_ari_bridges.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_ari_bridges.c?view=diff&rev=402002&r1=402001&r2=402002
==============================================================================
--- trunk/res/res_ari_bridges.c (original)
+++ trunk/res/res_ari_bridges.c Fri Oct 25 17:01:43 2013
@@ -745,6 +745,7 @@
 	case 400: /* Invalid parameters */
 	case 404: /* Bridge not found */
 	case 409: /* Bridge is not in a Stasis application; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
+	case 422: /* The format specified is unknown on this system */
 		is_valid = 1;
 		break;
 	default:

Modified: trunk/res/res_ari_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_ari_channels.c?view=diff&rev=402002&r1=402001&r2=402002
==============================================================================
--- trunk/res/res_ari_channels.c (original)
+++ trunk/res/res_ari_channels.c Fri Oct 25 17:01:43 2013
@@ -993,6 +993,7 @@
 	case 400: /* Invalid parameters */
 	case 404: /* Channel not found */
 	case 409: /* Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail */
+	case 422: /* The format specified is unknown on this system */
 		is_valid = 1;
 		break;
 	default:

Modified: trunk/rest-api/api-docs/bridges.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/bridges.json?view=diff&rev=402002&r1=402001&r2=402002
==============================================================================
--- trunk/rest-api/api-docs/bridges.json (original)
+++ trunk/rest-api/api-docs/bridges.json Fri Oct 25 17:01:43 2013
@@ -466,7 +466,11 @@
                         {
                             "code": 409,
                             "reason": "Bridge is not in a Stasis application; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail"
-                        }
+                        },
+						{
+							"code": 422,
+							"reason": "The format specified is unknown on this system"
+						}
                     ]
 				}
 			]

Modified: trunk/rest-api/api-docs/channels.json
URL: http://svnview.digium.com/svn/asterisk/trunk/rest-api/api-docs/channels.json?view=diff&rev=402002&r1=402001&r2=402002
==============================================================================
--- trunk/rest-api/api-docs/channels.json (original)
+++ trunk/rest-api/api-docs/channels.json Fri Oct 25 17:01:43 2013
@@ -721,6 +721,10 @@
 						{
 							"code": 409,
 							"reason": "Channel is not in a Stasis application; the channel is currently bridged with other hcannels; A recording with the same name already exists on the system and can not be overwritten because it is in progress or ifExists=fail"
+						},
+						{
+							"code": 422,
+							"reason": "The format specified is unknown on this system"
 						}
 					]
 				}




More information about the asterisk-commits mailing list