diff options
author | Olle Johansson <oej@edvina.net> | 2006-06-26 16:43:21 +0000 |
---|---|---|
committer | Olle Johansson <oej@edvina.net> | 2006-06-26 16:43:21 +0000 |
commit | f8311adcdafbe3e8692f99e2e064112a591972da (patch) | |
tree | 7c4ae410cac4ecff766920eb510930499d5d5a19 /apps | |
parent | e2b0c5b55852d20ff90c2d9d95fed1534060b864 (diff) |
METERMAIDS:
-----------
- Adding devicestate providers, a new architecture to add non-channel related
device state information, like parking lots, queues, meetmes, vending machines
and Windows 98 reboots (lots of blinking on those lights)
- Adding provider for parking lots, so you can subscribe to the status of a
parking lot
- Adding provider for meetme, so you can have a blinking lamp for a meetme
( Example: exten => edvina,hint,meetme:1234 )
- Adding support for directed parking - set the PARKINGEXTEN before you manually
call Park() and you will be parked on that space. If it's occupied, dialplan
execution will continue.
This work was sponsored by Voop A/S - www.voop.com
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@36055 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_meetme.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 16cf7f1a8..e162c56a2 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -58,6 +58,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" #include "asterisk/translate.h" #include "asterisk/ulaw.h" +#include "asterisk/devicestate.h" #include "enter.h" #include "leave.h" @@ -274,7 +275,7 @@ struct ast_conference { int markedusers; /*!< Number of marked users */ time_t start; /*!< Start time (s) */ int refcount; /*!< reference count of usage */ - enum recording_state recording:2; /*!< recording status */ + enum recording_state recording:2; /*!< recording status */ unsigned int isdynamic:1; /*!< Created on the fly? */ unsigned int locked:1; /*!< Is the conference locked? */ pthread_t recordthread; /*!< thread for recording */ @@ -967,6 +968,10 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, int c snprintf(members, sizeof(members), "%d", conf->users); ast_update_realtime("meetme", "confno", conf->confno, "members", members , NULL); + /* This device changed state now - if this is the first user */ + if (conf->users == 1) + ast_device_state_changed("meetme:%s", conf->confno); + ast_mutex_unlock(&conf->playlock); if (confflags & CONFFLAG_EXIT_CONTEXT) { @@ -1742,6 +1747,10 @@ bailoutandtrynormal: /* Return the number of seconds the user was in the conf */ snprintf(meetmesecs, sizeof(meetmesecs), "%d", (int) (time(NULL) - user->jointime)); pbx_builtin_setvar_helper(chan, "MEETMESECS", meetmesecs); + + /* This device changed state now */ + if (!conf->users) /* If there are no more members */ + ast_device_state_changed("meetme:%s", conf->confno); } free(user); AST_LIST_UNLOCK(&confs); @@ -2510,6 +2519,29 @@ static void *recordthread(void *args) pthread_exit(0); } +/*! \brief Callback for devicestate providers */ +static int meetmestate(const char *data) +{ + struct ast_conference *conf; + + /* Find conference */ + AST_LIST_LOCK(&confs); + AST_LIST_TRAVERSE(&confs, conf, list) { + if (!strcmp(data, conf->confno)) + break; + } + AST_LIST_UNLOCK(&confs); + if (!conf) + return AST_DEVICE_INVALID; + + + /* SKREP to fill */ + if (!conf->users) + return AST_DEVICE_NOT_INUSE; + + return AST_DEVICE_INUSE; +} + static void load_config(void) { struct ast_config *cfg; @@ -2547,6 +2579,7 @@ static int unload_module(void *mod) res |= ast_unregister_application(app2); res |= ast_unregister_application(app); + ast_devstate_prov_del("Meetme"); STANDARD_HANGUP_LOCALUSERS; return res; @@ -2565,6 +2598,7 @@ static int load_module(void *mod) res |= ast_register_application(app2, count_exec, synopsis2, descrip2); res |= ast_register_application(app, conf_exec, synopsis, descrip); + res |= ast_devstate_prov_add("Meetme", meetmestate); return res; } |