various devicestate fixes (issue #5081, take two)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6496 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-09-01 22:28:33 +00:00
parent 3a31b6ff2d
commit d3a76999d0
3 changed files with 31 additions and 34 deletions

View File

@@ -109,9 +109,16 @@ int ast_device_state(const char *device)
return ast_parse_device_state(device); /* No, try the generic function */
else {
res = chan_tech->devicestate(number); /* Ask the channel driver for device state */
if (res == AST_DEVICE_UNKNOWN)
return ast_parse_device_state(device);
else
if (res == AST_DEVICE_UNKNOWN) {
res = ast_parse_device_state(device);
/* at this point we know the device exists, but the channel driver
could not give us a state; if there is no channel state available,
it must be 'not in use'
*/
if (res == AST_DEVICE_UNKNOWN)
res = AST_DEVICE_NOT_INUSE;
return res;
} else
return res;
}
}