Author: dlee
Date: Thu Aug 15 10:17:27 2013
New Revision: 396735

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396735
Log:
Expanded error responses for bridge operations

Modified:
    team/dlee/ASTERISK-22036/res/ari/resource_bridges.c
    team/dlee/ASTERISK-22036/res/res_ari_bridges.c
    team/dlee/ASTERISK-22036/rest-api/api-docs/bridges.json

Modified: team/dlee/ASTERISK-22036/res/ari/resource_bridges.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22036/res/ari/resource_bridges.c?view=diff&rev=396735&r1=396734&r2=396735
==============================================================================
--- team/dlee/ASTERISK-22036/res/ari/resource_bridges.c (original)
+++ team/dlee/ASTERISK-22036/res/ari/resource_bridges.c Thu Aug 15 10:17:27 2013
@@ -98,6 +98,15 @@
 
        control = stasis_app_control_find_by_channel_id(channel_id);
        if (control == NULL) {
+               /* Distinguish between 400 and 422 errors */
+               RAII_VAR(struct ast_channel *, chan, NULL, ao2_cleanup);
+               chan = ast_channel_get_by_name(channel_id);
+               if (chan == NULL) {
+                       ast_ari_response_error(response, 400, "Bad Request",
+                                  "Channel not found");
+                       return NULL;
+               }
+
                ast_ari_response_error(response, 422, "Unprocessable Entity",
                        "Channel not in Stasis application");
                return NULL;

Modified: team/dlee/ASTERISK-22036/res/res_ari_bridges.c
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22036/res/res_ari_bridges.c?view=diff&rev=396735&r1=396734&r2=396735
==============================================================================
--- team/dlee/ASTERISK-22036/res/res_ari_bridges.c (original)
+++ team/dlee/ASTERISK-22036/res/res_ari_bridges.c Thu Aug 15 10:17:27 2013
@@ -345,9 +345,10 @@
                break;
        case 500: /* Internal Server Error */
        case 501: /* Not Implemented */
+       case 400: /* Channel not found */
        case 404: /* Bridge not found */
        case 409: /* Bridge not in Stasis application */
-       case 422: /* Channel not found, or not in Stasis application */
+       case 422: /* Channel not in Stasis application */
                is_valid = 1;
                break;
        default:
@@ -444,6 +445,10 @@
                break;
        case 500: /* Internal Server Error */
        case 501: /* Not Implemented */
+       case 400: /* Channel not found */
+       case 404: /* Bridge not found */
+       case 409: /* Bridge not in Stasis application */
+       case 422: /* Channel not in this bridge */
                is_valid = 1;
                break;
        default:

Modified: team/dlee/ASTERISK-22036/rest-api/api-docs/bridges.json
URL: 
http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22036/rest-api/api-docs/bridges.json?view=diff&rev=396735&r1=396734&r2=396735
==============================================================================
--- team/dlee/ASTERISK-22036/rest-api/api-docs/bridges.json (original)
+++ team/dlee/ASTERISK-22036/rest-api/api-docs/bridges.json Thu Aug 15 10:17:27 
2013
@@ -131,6 +131,10 @@
                                        ],
                                        "errorResponses": [
                                                {
+                                                       "code": 400,
+                                                       "reason": "Channel not 
found"
+                                               },
+                                               {
                                                        "code": 404,
                                                        "reason": "Bridge not 
found"
                                                },
@@ -140,7 +144,7 @@
                                                },
                                                {
                                                        "code": 422,
-                                                       "reason": "Channel not 
found, or not in Stasis application"
+                                                       "reason": "Channel not 
in Stasis application"
                                                }
                                        ]
                                }
@@ -171,6 +175,24 @@
                                                        "required": true,
                                                        "allowMultiple": true,
                                                        "dataType": "string"
+                                               }
+                                       ],
+                                       "errorResponses": [
+                                               {
+                                                       "code": 400,
+                                                       "reason": "Channel not 
found"
+                                               },
+                                               {
+                                                       "code": 404,
+                                                       "reason": "Bridge not 
found"
+                                               },
+                                               {
+                                                       "code": 409,
+                                                       "reason": "Bridge not 
in Stasis application"
+                                               },
+                                               {
+                                                       "code": 422,
+                                                       "reason": "Channel not 
in this bridge"
                                                }
                                        ]
                                }


--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits

Reply via email to