[asterisk-commits] russell: branch 1.6.1 r203704 - in /branches/1.6.1: ./ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jun 26 14:37:48 CDT 2009
Author: russell
Date: Fri Jun 26 14:37:43 2009
New Revision: 203704
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=203704
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.1/ (props changed)
branches/1.6.1/include/asterisk/devicestate.h
branches/1.6.1/main/devicestate.c
branches/1.6.1/main/pbx.c
Propchange: branches/1.6.1/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.1/include/asterisk/devicestate.h
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/include/asterisk/devicestate.h?view=diff&rev=203704&r1=203703&r2=203704
==============================================================================
--- branches/1.6.1/include/asterisk/devicestate.h (original)
+++ branches/1.6.1/include/asterisk/devicestate.h Fri Jun 26 14:37:43 2009
@@ -252,6 +252,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.1/main/devicestate.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/main/devicestate.c?view=diff&rev=203704&r1=203703&r2=203704
==============================================================================
--- branches/1.6.1/main/devicestate.c (original)
+++ branches/1.6.1/main/devicestate.c Fri Jun 26 14:37:43 2009
@@ -378,9 +378,6 @@
res = ast_parse_device_state(device);
- if (res == AST_DEVICE_UNKNOWN)
- return AST_DEVICE_NOT_INUSE;
-
return res;
}
@@ -761,6 +758,7 @@
{
memset(agg, 0, sizeof(*agg));
+ agg->all_unknown = 1;
agg->all_unavail = 1;
agg->all_busy = 1;
agg->all_free = 1;
@@ -770,6 +768,7 @@
{
switch (state) {
case AST_DEVICE_NOT_INUSE:
+ agg->all_unknown = 0;
agg->all_unavail = 0;
agg->all_busy = 0;
break;
@@ -778,12 +777,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;
@@ -791,19 +792,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;
@@ -815,26 +820,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.1/main/pbx.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.1/main/pbx.c?view=diff&rev=203704&r1=203703&r2=203704
==============================================================================
--- branches/1.6.1/main/pbx.c (original)
+++ branches/1.6.1/main/pbx.c Fri Jun 26 14:37:43 2009
@@ -3274,8 +3274,9 @@
rest = 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);
@@ -3285,6 +3286,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);
@@ -3292,8 +3295,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