[svn-commits] qwell: branch qwell/http-channels-post r390538 - /team/qwell/http-channels-po...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Jun 5 14:01:46 CDT 2013


Author: qwell
Date: Wed Jun  5 14:01:44 2013
New Revision: 390538

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=390538
Log:
Fail on missing fields.

Modified:
    team/qwell/http-channels-post/res/stasis_http/resource_channels.c

Modified: team/qwell/http-channels-post/res/stasis_http/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/http-channels-post/res/stasis_http/resource_channels.c?view=diff&rev=390538&r1=390537&r2=390538
==============================================================================
--- team/qwell/http-channels-post/res/stasis_http/resource_channels.c (original)
+++ team/qwell/http-channels-post/res/stasis_http/resource_channels.c Wed Jun  5 14:01:44 2013
@@ -333,7 +333,7 @@
 		ast_str_append(&appdata, 0, ",%s", args->app_args);
 	}
 
-	if (args->endpoint) {
+	if (!ast_strlen_zero(args->endpoint)) {
 		char *tmp = ast_strdupa(args->endpoint);
 		char *stuff;
 
@@ -342,8 +342,13 @@
 			dialtech = tmp;
 			ast_copy_string(dialdevice, stuff, sizeof(dialdevice));
 	        }
+	} else if (!ast_strlen_zero(args->extension) && !ast_strlen_zero(args->context)) {
+		snprintf(dialdevice, sizeof(dialdevice), "%s@%s", args->extension, args->context);
 	} else {
-		snprintf(dialdevice, sizeof(dialdevice), "%s@%s", args->extension, args->context);
+		stasis_http_response_error(
+			response, 500, "Internal server error",
+			"Endpoint or extension and context required");
+		return;
 	}
 
 	ast_log(LOG_DEBUG, "Dialing %s/%s\n", dialtech, dialdevice);




More information about the svn-commits mailing list