[asterisk-commits] dlee: branch dlee/record r394774 - in /team/dlee/record: res/ rest-api-templa...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 18 16:28:06 CDT 2013
Author: dlee
Date: Thu Jul 18 16:28:04 2013
New Revision: 394774
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394774
Log:
Improved handling of unimplemented methods for dev mode
Modified:
team/dlee/record/res/res_stasis_http.c
team/dlee/record/res/res_stasis_http_asterisk.c
team/dlee/record/res/res_stasis_http_bridges.c
team/dlee/record/res/res_stasis_http_channels.c
team/dlee/record/res/res_stasis_http_endpoints.c
team/dlee/record/res/res_stasis_http_playback.c
team/dlee/record/res/res_stasis_http_recordings.c
team/dlee/record/res/res_stasis_http_sounds.c
team/dlee/record/rest-api-templates/res_stasis_http_resource.c.mustache
Modified: team/dlee/record/res/res_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http.c (original)
+++ team/dlee/record/res/res_stasis_http.c Thu Jul 18 16:28:04 2013
@@ -545,9 +545,10 @@
callback(get_params, path_vars, headers, response);
if (response->message == NULL && response->response_code == 0) {
/* Really should not happen */
- ast_assert(0);
+ ast_log(LOG_ERROR, "ARI %s %s not implemented\n",
+ ast_get_http_method(method), uri);
stasis_http_response_error(
- response, 418, "I'm a teapot",
+ response, 501, "Not Implemented",
"Method not implemented");
}
}
Modified: team/dlee/record/res/res_stasis_http_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_asterisk.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_asterisk.c (original)
+++ team/dlee/record/res/res_stasis_http_asterisk.c Thu Jul 18 16:28:04 2013
@@ -78,7 +78,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -128,7 +132,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -181,7 +189,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
Modified: team/dlee/record/res/res_stasis_http_bridges.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_bridges.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_bridges.c (original)
+++ team/dlee/record/res/res_stasis_http_bridges.c Thu Jul 18 16:28:04 2013
@@ -70,7 +70,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -120,7 +124,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -170,7 +178,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Bridge not found */
is_valid = 1;
break;
@@ -221,7 +233,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Bridge not found */
is_valid = 1;
break;
@@ -278,7 +294,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Bridge not found */
case 409: /* Bridge not in Stasis application */
case 422: /* Channel not found, or not in Stasis application */
@@ -337,7 +357,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -408,7 +432,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
Modified: team/dlee/record/res/res_stasis_http_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_channels.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_channels.c (original)
+++ team/dlee/record/res/res_stasis_http_channels.c Thu Jul 18 16:28:04 2013
@@ -70,7 +70,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -141,7 +145,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 400: /* Invalid parameters for originating a channel. */
is_valid = 1;
break;
@@ -192,7 +200,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
is_valid = 1;
break;
@@ -243,7 +255,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
is_valid = 1;
break;
@@ -309,7 +325,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -373,7 +393,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -425,7 +449,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -483,7 +511,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -541,7 +573,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -593,7 +629,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -645,7 +685,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -712,7 +756,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -788,7 +836,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
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 channels; A recording with the same name is currently in progress. */
@@ -847,7 +899,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
@@ -908,7 +964,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 404: /* Channel not found */
case 409: /* Channel not in a Stasis application */
is_valid = 1;
Modified: team/dlee/record/res/res_stasis_http_endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_endpoints.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_endpoints.c (original)
+++ team/dlee/record/res/res_stasis_http_endpoints.c Thu Jul 18 16:28:04 2013
@@ -70,7 +70,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -120,7 +124,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -173,7 +181,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
Modified: team/dlee/record/res/res_stasis_http_playback.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_playback.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_playback.c (original)
+++ team/dlee/record/res/res_stasis_http_playback.c Thu Jul 18 16:28:04 2013
@@ -78,7 +78,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -128,7 +132,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -184,7 +192,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
case 400: /* The provided operation parameter was invalid */
case 404: /* The playback cannot be found */
case 409: /* The operation cannot be performed in the playback's current state */
Modified: team/dlee/record/res/res_stasis_http_recordings.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_recordings.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_recordings.c (original)
+++ team/dlee/record/res/res_stasis_http_recordings.c Thu Jul 18 16:28:04 2013
@@ -70,7 +70,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -120,7 +124,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -170,7 +178,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -212,7 +224,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -262,7 +278,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -312,7 +332,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -362,7 +386,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -412,7 +440,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -462,7 +494,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -512,7 +548,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -562,7 +602,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
Modified: team/dlee/record/res/res_stasis_http_sounds.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/res/res_stasis_http_sounds.c?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/res/res_stasis_http_sounds.c (original)
+++ team/dlee/record/res/res_stasis_http_sounds.c Thu Jul 18 16:28:04 2013
@@ -81,7 +81,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
@@ -131,7 +135,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
is_valid = 1;
break;
default:
Modified: team/dlee/record/rest-api-templates/res_stasis_http_resource.c.mustache
URL: http://svnview.digium.com/svn/asterisk/team/dlee/record/rest-api-templates/res_stasis_http_resource.c.mustache?view=diff&rev=394774&r1=394773&r2=394774
==============================================================================
--- team/dlee/record/rest-api-templates/res_stasis_http_resource.c.mustache (original)
+++ team/dlee/record/rest-api-templates/res_stasis_http_resource.c.mustache Thu Jul 18 16:28:04 2013
@@ -78,7 +78,11 @@
code = response->response_code;
switch (code) {
- case 500: /* Internal server error */
+ case 0: /* Implementation is still a stub, or the code wasn't set */
+ is_valid = response->message == NULL;
+ break;
+ case 500: /* Internal Server Error */
+ case 501: /* Not Implemented */
{{#error_responses}}
case {{code}}: /* {{{reason}}} */
{{/error_responses}}
More information about the asterisk-commits
mailing list