diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-05 21:19:56 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-06-05 21:19:56 +0000 |
commit | 5c1db5dddce0d0153f7c0d1f45a81f20b295c9ce (patch) | |
tree | 802d454614f9e5d228be45b7cc0d2535a10b4c2a /main/pbx.c | |
parent | 8a24acab67889f15ca1d4d53180240fad60142e5 (diff) |
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.4@199297 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/main/pbx.c b/main/pbx.c index 8fa993501..6d2fc7c83 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -1920,8 +1920,8 @@ static int ast_extension_state2(struct ast_exten *e) { char hint[AST_MAX_EXTENSION]; char *cur, *rest; - int allunavailable = 1, allbusy = 1, allfree = 1, allonhold = 1; - int busy = 0, inuse = 0, ring = 0; + int allunavailable = 1, allbusy = 1, allfree = 1; + int busy = 0, inuse = 0, ring = 0, onhold = 0; if (!e) return -1; @@ -1935,67 +1935,60 @@ static int ast_extension_state2(struct ast_exten *e) case AST_DEVICE_NOT_INUSE: allunavailable = 0; allbusy = 0; - allonhold = 0; break; case AST_DEVICE_INUSE: inuse = 1; allunavailable = 0; allfree = 0; - allonhold = 0; break; case AST_DEVICE_RINGING: ring = 1; allunavailable = 0; allfree = 0; - allonhold = 0; break; case AST_DEVICE_RINGINUSE: inuse = 1; ring = 1; allunavailable = 0; allfree = 0; - allonhold = 0; break; case AST_DEVICE_ONHOLD: allunavailable = 0; allfree = 0; + onhold = 1; break; case AST_DEVICE_BUSY: allunavailable = 0; allfree = 0; - allonhold = 0; busy = 1; + inuse = 1; break; case AST_DEVICE_UNAVAILABLE: case AST_DEVICE_INVALID: allbusy = 0; allfree = 0; - allonhold = 0; break; default: allunavailable = 0; allbusy = 0; allfree = 0; - allonhold = 0; } } - if (!inuse && ring) - return AST_EXTENSION_RINGING; - if (inuse && ring) - return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING); - if (inuse) - return AST_EXTENSION_INUSE; if (allfree) return AST_EXTENSION_NOT_INUSE; - if (allonhold) - return AST_EXTENSION_ONHOLD; + if ((inuse || onhold) && ring) + return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING); if (allbusy) return AST_EXTENSION_BUSY; + if (inuse) + return AST_EXTENSION_INUSE; + if (ring) + return AST_EXTENSION_RINGING; + if (onhold) + return AST_EXTENSION_ONHOLD; if (allunavailable) return AST_EXTENSION_UNAVAILABLE; - if (busy) - return AST_EXTENSION_INUSE; return AST_EXTENSION_NOT_INUSE; } |