[asterisk-commits] qwell: branch qwell/ari-originate2 r392899 - /team/qwell/ari-originate2/res/s...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 25 15:27:28 CDT 2013


Author: qwell
Date: Tue Jun 25 15:27:26 2013
New Revision: 392899

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392899
Log:
Bail sooner if endpoint isn't specified.

Modified:
    team/qwell/ari-originate2/res/stasis_http/resource_channels.c

Modified: team/qwell/ari-originate2/res/stasis_http/resource_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari-originate2/res/stasis_http/resource_channels.c?view=diff&rev=392899&r1=392898&r2=392899
==============================================================================
--- team/qwell/ari-originate2/res/stasis_http/resource_channels.c (original)
+++ team/qwell/ari-originate2/res/stasis_http/resource_channels.c Tue Jun 25 15:27:26 2013
@@ -316,34 +316,37 @@
 			   struct ast_originate_args *args,
 			   struct stasis_http_response *response)
 {
-	const char *dialtech = NULL;
+	char *dialtech;
 	char dialdevice[AST_CHANNEL_NAME];
 	char *caller_id = NULL;
 	char *cid_num = NULL;
 	char *cid_name = NULL;
 	int timeout = 30000;
 
+	char *stuff;
+
+	if (ast_strlen_zero(args->endpoint)) {
+		stasis_http_response_error(response, 500, "Internal server error",
+			"Endpoint must be specified");
+		return;
+	}
+
+	dialtech = ast_strdupa(args->endpoint);
+	if ((stuff = strchr(dialtech, '/'))) {
+		*stuff++ = '\0';
+		ast_copy_string(dialdevice, stuff, sizeof(dialdevice));
+	}
+
+	if (ast_strlen_zero(dialtech) || ast_strlen_zero(dialdevice)) {
+		stasis_http_response_error(response, 500, "Internal server error",
+			"Invalid endpoint specified");
+		return;
+	}
+
 	if (args->timeout > 0) {
 		timeout = args->timeout * 1000;
 	} else if (args->timeout == -1) {
 		timeout = -1;
-	}
-
-	if (!ast_strlen_zero(args->endpoint)) {
-		char *tmp = ast_strdupa(args->endpoint);
-		char *stuff;
-
-		if ((stuff = strchr(tmp, '/'))) {
-			*stuff++ = '\0';
-			dialtech = tmp;
-			ast_copy_string(dialdevice, stuff, sizeof(dialdevice));
-	        }
-	}
-
-	if (ast_strlen_zero(dialtech) || ast_strlen_zero(dialdevice)) {
-		stasis_http_response_error(response, 500, "Internal server error",
-			"Invalid endpoint specified");
-		return;
 	}
 
 	if (!ast_strlen_zero(args->caller_id)) {




More information about the asterisk-commits mailing list