aboutsummaryrefslogtreecommitdiffstats
path: root/devicestate.c
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-01 22:28:33 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-01 22:28:33 +0000
commit5e2f0a65d097b1a16083d997b6f685b3a5c17525 (patch)
tree615dd86d4ac07062eedee46c34978b96272feba4 /devicestate.c
parent90521d3f603d399c3da2be87483468d638362745 (diff)
various devicestate fixes (issue #5081, take two)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6496 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'devicestate.c')
-rwxr-xr-xdevicestate.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/devicestate.c b/devicestate.c
index c3e7c52d0..6701a80ae 100755
--- a/devicestate.c
+++ b/devicestate.c
@@ -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;
}
}