diff --git a/apps/app_stack.c b/apps/app_stack.c
index c32ed952add366a06c895e3aebb90934d83cf67c..ba681214223b56cd089ef8c9e8366c786f75473f 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -140,7 +140,7 @@ static int gosubif_exec(struct ast_channel *chan, void *data)
 	label1 = strsep(&args, ":");
 	label2 = args;
 
-	if (ast_true(condition)) {
+	if (pbx_checkcondition(condition)) {
 		if (label1) {
 			res = gosub_exec(chan, label1);
 		}
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index e56819cb0585e40a29794b74b76dcc70b89e4e76..8c18fcc03c8198286b1fa5ed70243a7e8bcfb578 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -720,6 +720,9 @@ int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout
    particular application with given extension */
 int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
 
+/* Evaluate a condition for non-falseness and return a boolean */
+int pbx_checkcondition(char *condition);
+
 /* Functions for returning values from structures */
 const char *ast_get_context_name(struct ast_context *con);
 const char *ast_get_extension_name(struct ast_exten *exten);
diff --git a/pbx.c b/pbx.c
index 6ab28ba6dadeedd60ea3b3f3f41ddd5356178d81..376124fc468b0ab8f769f635a812858ac348ba64 100644
--- a/pbx.c
+++ b/pbx.c
@@ -5709,7 +5709,7 @@ void pbx_builtin_clear_globals(void)
 	ast_mutex_unlock(&globalslock);
 }
 
-static int pbx_checkcondition(char *condition) 
+int pbx_checkcondition(char *condition) 
 {
 	if (condition) {
 		if (*condition == '\0') {