diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-05 21:25:49 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-05 21:25:49 +0000 |
commit | b9ea142bcbb7aa85dbe79b6c743ba0254f112a0e (patch) | |
tree | a2430d086c86531a6963ed3c53030a4810c24218 /main/devicestate.c | |
parent | 03275acea2a3e04f0b409b3bfe9aacb9c163fa56 (diff) |
Merged revisions 199298 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r199298 | dvossel | 2009-06-05 16:21:22 -0500 (Fri, 05 Jun 2009) | 21 lines
Merged revisions 199297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r199297 | dvossel | 2009-06-05 16:19:56 -0500 (Fri, 05 Jun 2009) | 14 lines
Fixes issue with hints giving unexpected results.
Hints with two or more devices that include ONHOLD gave unexpected results.
(closes issue #15057)
Reported by: p_lindheimer
Patches:
onhold_trunk.diff uploaded by dvossel (license 671)
pbx.c.1.4.patch uploaded by p (license 558)
devicestate.c.trunk.patch uploaded by p (license 671)
Tested by: p_lindheimer, dvossel
Review: https://reviewboard.asterisk.org/r/254/
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@199299 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/devicestate.c')
-rw-r--r-- | main/devicestate.c | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/main/devicestate.c b/main/devicestate.c index 4572c6604..29f7c5b32 100644 --- a/main/devicestate.c +++ b/main/devicestate.c @@ -740,7 +740,6 @@ void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg) agg->all_unavail = 1; agg->all_busy = 1; agg->all_free = 1; - agg->all_on_hold = 1; } void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state) @@ -749,21 +748,18 @@ void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_dev case AST_DEVICE_NOT_INUSE: agg->all_unavail = 0; agg->all_busy = 0; - agg->all_on_hold = 0; break; case AST_DEVICE_INUSE: agg->in_use = 1; agg->all_busy = 0; agg->all_unavail = 0; agg->all_free = 0; - agg->all_on_hold = 0; break; case AST_DEVICE_RINGING: agg->ring = 1; agg->all_busy = 0; agg->all_unavail = 0; agg->all_free = 0; - agg->all_on_hold = 0; break; case AST_DEVICE_RINGINUSE: agg->in_use = 1; @@ -771,23 +767,22 @@ void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_dev agg->all_busy = 0; agg->all_unavail = 0; agg->all_free = 0; - agg->all_on_hold = 0; break; case AST_DEVICE_ONHOLD: agg->all_unavail = 0; agg->all_free = 0; + agg->on_hold = 1; break; case AST_DEVICE_BUSY: agg->all_unavail = 0; agg->all_free = 0; - agg->all_on_hold = 0; agg->busy = 1; + agg->in_use = 1; break; case AST_DEVICE_UNAVAILABLE: case AST_DEVICE_INVALID: agg->all_busy = 0; agg->all_free = 0; - agg->all_on_hold = 0; break; case AST_DEVICE_UNKNOWN: break; @@ -798,25 +793,25 @@ enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregat { if (agg->all_free) return AST_DEVICE_NOT_INUSE; - - if (agg->all_on_hold) - return AST_DEVICE_ONHOLD; - + + if ((agg->in_use || agg->on_hold) && agg->ring) + return AST_DEVICE_RINGINUSE; + if (agg->all_busy) return AST_DEVICE_BUSY; - if (agg->all_unavail) - return AST_DEVICE_UNAVAILABLE; - - if (agg->ring) - return agg->in_use ? AST_DEVICE_RINGINUSE : AST_DEVICE_RINGING; - if (agg->in_use) return AST_DEVICE_INUSE; - if (agg->busy) - return AST_DEVICE_BUSY; - + if (agg->ring) + return AST_DEVICE_RINGING; + + if (agg->on_hold) + return AST_DEVICE_ONHOLD; + + if (agg->all_unavail) + return AST_DEVICE_UNAVAILABLE; + return AST_DEVICE_NOT_INUSE; } |