diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-29 23:53:29 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-08-29 23:53:29 +0000 |
commit | 9fc16d81a1f2ed5a0b4f0e9271036e6c37f4a4e9 (patch) | |
tree | be2e95a515d90713c35a8f5fa517fd6d4e4828e9 /pbx.c | |
parent | 3a4e85fe5c2b854bac4c9dcd65834ab82cdca83a (diff) |
massive upgrade to SUBSCRIBE, device state and messaging support (issue #3644)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6446 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx.c')
-rwxr-xr-x | pbx.c | 34 |
1 files changed, 30 insertions, 4 deletions
@@ -1731,7 +1731,7 @@ static int ast_extension_state2(struct ast_exten *e) char *cur, *rest; int res = -1; int allunavailable = 1, allbusy = 1, allfree = 1; - int busy = 0; + int busy = 0, inuse = 0, ring = 0; if (!e) return -1; @@ -1742,7 +1742,7 @@ static int ast_extension_state2(struct ast_exten *e) do { rest = strchr(cur, '&'); if (rest) { - *rest = 0; + *rest = 0; rest++; } @@ -1753,7 +1753,15 @@ static int ast_extension_state2(struct ast_exten *e) allbusy = 0; break; case AST_DEVICE_INUSE: - return AST_EXTENSION_INUSE; + inuse = 1; + allunavailable = 0; + allfree = 0; + break; + case AST_DEVICE_RINGING: + ring = 1; + allunavailable = 0; + allfree = 0; + break; case AST_DEVICE_BUSY: allunavailable = 0; allfree = 0; @@ -1772,7 +1780,13 @@ static int ast_extension_state2(struct ast_exten *e) cur = rest; } while (cur); - if (allfree) + 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 (allbusy) return AST_EXTENSION_BUSY; @@ -1784,6 +1798,18 @@ static int ast_extension_state2(struct ast_exten *e) return AST_EXTENSION_NOT_INUSE; } +/*--- ast_extension_state2str: Return extension_state as string */ +const char *ast_extension_state2str(int extension_state) +{ + int i; + + for (i = 0; (i < (sizeof(extension_states) / sizeof(extension_states[0]))); i++) { + if (extension_states[i].extension_state == extension_state) { + return extension_states[i].text; + } + } + return "Unknown"; +} /*--- ast_extension_state: Check extension state for an extension by using hint */ int ast_extension_state(struct ast_channel *c, char *context, char *exten) |