[asterisk-commits] russell: branch 1.6.2 r203715 - in /branches/1.6.2: ./ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 26 14:49:32 CDT 2009
Author: russell
Date: Fri Jun 26 14:49:28 2009
New Revision: 203715
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203715
Log:
Merged revisions 203702 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r203702 | russell | 2009-06-26 14:31:14 -0500 (Fri, 26 Jun 2009) | 5 lines
Make invalid hints report Unavailable instead of Idle.
(closes issue #14413)
Reported by: pj
........
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/include/asterisk/devicestate.h
branches/1.6.2/main/devicestate.c
branches/1.6.2/main/pbx.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.2/include/asterisk/devicestate.h
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/include/asterisk/devicestate.h?view=diff&rev=203715&r1=203714&r2=203715
==============================================================================
--- branches/1.6.2/include/asterisk/devicestate.h (original)
+++ branches/1.6.2/include/asterisk/devicestate.h Fri Jun 26 14:49:28 2009
@@ -253,6 +253,7 @@
* This struct is only here so that it can be easily declared on the stack.
*/
struct ast_devstate_aggregate {
+ unsigned int all_unknown:1;
unsigned int all_unavail:1;
unsigned int all_busy:1;
unsigned int all_free:1;
Modified: branches/1.6.2/main/devicestate.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/devicestate.c?view=diff&rev=203715&r1=203714&r2=203715
==============================================================================
--- branches/1.6.2/main/devicestate.c (original)
+++ branches/1.6.2/main/devicestate.c Fri Jun 26 14:49:28 2009
@@ -354,9 +354,6 @@
res = ast_parse_device_state(device);
- if (res == AST_DEVICE_UNKNOWN)
- return AST_DEVICE_NOT_INUSE;
-
return res;
}
@@ -737,6 +734,7 @@
{
memset(agg, 0, sizeof(*agg));
+ agg->all_unknown = 1;
agg->all_unavail = 1;
agg->all_busy = 1;
agg->all_free = 1;
@@ -746,6 +744,7 @@
{
switch (state) {
case AST_DEVICE_NOT_INUSE:
+ agg->all_unknown = 0;
agg->all_unavail = 0;
agg->all_busy = 0;
break;
@@ -754,12 +753,14 @@
agg->all_busy = 0;
agg->all_unavail = 0;
agg->all_free = 0;
+ agg->all_unknown = 0;
break;
case AST_DEVICE_RINGING:
agg->ring = 1;
agg->all_busy = 0;
agg->all_unavail = 0;
agg->all_free = 0;
+ agg->all_unknown = 0;
break;
case AST_DEVICE_RINGINUSE:
agg->in_use = 1;
@@ -767,19 +768,23 @@
agg->all_busy = 0;
agg->all_unavail = 0;
agg->all_free = 0;
+ agg->all_unknown = 0;
break;
case AST_DEVICE_ONHOLD:
+ agg->all_unknown = 0;
agg->all_unavail = 0;
agg->all_free = 0;
agg->on_hold = 1;
break;
case AST_DEVICE_BUSY:
+ agg->all_unknown = 0;
agg->all_unavail = 0;
agg->all_free = 0;
agg->busy = 1;
agg->in_use = 1;
break;
case AST_DEVICE_UNAVAILABLE:
+ agg->all_unknown = 0;
case AST_DEVICE_INVALID:
agg->all_busy = 0;
agg->all_free = 0;
@@ -791,26 +796,37 @@
enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg)
{
- if (agg->all_free)
+ if (agg->all_unknown) {
+ return AST_DEVICE_UNKNOWN;
+ }
+
+ if (agg->all_free) {
return AST_DEVICE_NOT_INUSE;
-
- if ((agg->in_use || agg->on_hold) && agg->ring)
+ }
+
+ if ((agg->in_use || agg->on_hold) && agg->ring) {
return AST_DEVICE_RINGINUSE;
-
- if (agg->all_busy)
+ }
+
+ if (agg->all_busy) {
return AST_DEVICE_BUSY;
-
- if (agg->in_use)
+ }
+
+ if (agg->in_use) {
return AST_DEVICE_INUSE;
-
- if (agg->ring)
+ }
+
+ if (agg->ring) {
return AST_DEVICE_RINGING;
-
- if (agg->on_hold)
+ }
+
+ if (agg->on_hold) {
return AST_DEVICE_ONHOLD;
-
- if (agg->all_unavail)
+ }
+
+ if (agg->all_unavail) {
return AST_DEVICE_UNAVAILABLE;
+ }
return AST_DEVICE_NOT_INUSE;
}
Modified: branches/1.6.2/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/pbx.c?view=diff&rev=203715&r1=203714&r2=203715
==============================================================================
--- branches/1.6.2/main/pbx.c (original)
+++ branches/1.6.2/main/pbx.c Fri Jun 26 14:49:28 2009
@@ -3763,8 +3763,9 @@
rest = ast_str_buffer(hint); /* One or more devices separated with a & character */
- while ( (cur = strsep(&rest, "&")) )
+ while ( (cur = strsep(&rest, "&")) ) {
ast_devstate_aggregate_add(&agg, ast_device_state(cur));
+ }
state = ast_devstate_aggregate_result(&agg);
@@ -3774,6 +3775,8 @@
case AST_DEVICE_BUSY:
return AST_EXTENSION_BUSY;
case AST_DEVICE_UNAVAILABLE:
+ case AST_DEVICE_UNKNOWN:
+ case AST_DEVICE_INVALID:
return AST_EXTENSION_UNAVAILABLE;
case AST_DEVICE_RINGINUSE:
return (AST_EXTENSION_INUSE | AST_EXTENSION_RINGING);
@@ -3781,8 +3784,6 @@
return AST_EXTENSION_RINGING;
case AST_DEVICE_INUSE:
return AST_EXTENSION_INUSE;
- case AST_DEVICE_UNKNOWN:
- case AST_DEVICE_INVALID:
case AST_DEVICE_NOT_INUSE:
return AST_EXTENSION_NOT_INUSE;
}
More information about the asterisk-commits
mailing list