diff options
author | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-17 16:07:08 +0000 |
---|---|---|
committer | root <root@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-05-17 16:07:08 +0000 |
commit | 364a664ff21d027715ec95938648469710415b91 (patch) | |
tree | 524634e306a2a6504bb7c3fe10c74ae7aff1a689 /apps | |
parent | 08033bd398bd6ae331e12884eef18b0dcd59756d (diff) |
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@27811 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_osplookup.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 2fe2d016a..f436d7cfa 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -216,31 +216,33 @@ static int ospnext_exec(struct ast_channel *chan, void *data) 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 */ |