[asterisk-commits] branch 1.2 r27767 - /branches/1.2/apps/app_osplookup.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed May 17 08:17:05 MST 2006


Author: file
Date: Wed May 17 10:17:04 2006
New Revision: 27767

URL: http://svn.digium.com/view/asterisk?rev=27767&view=rev
Log:
OSPNext does not handle success/failure correctly (issue #7147 reported and fixed by eborgstrom)

Modified:
    branches/1.2/apps/app_osplookup.c

Modified: branches/1.2/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_osplookup.c?rev=27767&r1=27766&r2=27767&view=diff
==============================================================================
--- branches/1.2/apps/app_osplookup.c (original)
+++ branches/1.2/apps/app_osplookup.c Wed May 17 10:17:04 2006
@@ -216,31 +216,33 @@
 	cause = str2cause(args.cause);
 	temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
 	result.handle = -1;
-	if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
-		temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
-		if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
-			result.numresults = 0;
-		}
-		if ((res = ast_osp_next(&result, cause)) > 0) {
-			char tmp[80];
-			snprintf(tmp, sizeof(tmp), "%d", result.handle);
-			pbx_builtin_setvar_helper(chan, "_OSPHANDLE", tmp);
-			pbx_builtin_setvar_helper(chan, "_OSPTECH", result.tech);
-			pbx_builtin_setvar_helper(chan, "_OSPDEST", result.dest);
-			pbx_builtin_setvar_helper(chan, "_OSPTOKEN", result.token);
-			snprintf(tmp, sizeof(tmp), "%d", result.numresults);
-			pbx_builtin_setvar_helper(chan, "_OSPRESULTS", tmp);
-			pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "SUCCESS");
-		}
+	if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.handle) != 1)) {
+		result.handle = -1;
+	}
+	temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
+	if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
+		result.numresults = 0;
+	}
+	if ((res = ast_osp_next(&result, cause)) > 0) {
+		char tmp[80];
+		snprintf(tmp, sizeof(tmp), "%d", result.handle);
+		pbx_builtin_setvar_helper(chan, "_OSPHANDLE", tmp);
+		pbx_builtin_setvar_helper(chan, "_OSPTECH", result.tech);
+		pbx_builtin_setvar_helper(chan, "_OSPDEST", result.dest);
+		pbx_builtin_setvar_helper(chan, "_OSPTOKEN", result.token);
+		snprintf(tmp, sizeof(tmp), "%d", result.numresults);
+		pbx_builtin_setvar_helper(chan, "_OSPRESULTS", tmp);
+		pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "SUCCESS");
 	} else {
 		if (!res) {
 			if (result.handle < 0)
 				ast_log(LOG_NOTICE, "OSP Lookup Next failed for handle '%d'\n", result.handle);
 			else
 				ast_log(LOG_DEBUG, "No OSP handle specified\n");
-			pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "FAILED");	
 		} else
 			ast_log(LOG_DEBUG, "Got hangup on '%s' while doing OSP Next!\n", chan->name);
+
+		pbx_builtin_setvar_helper(chan, "OSPNEXTSTATUS", "FAILED");	
 	}
 	if (!res) {
 		/* Look for a "busy" place */



More information about the asterisk-commits mailing list