diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-06-10 15:12:17 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-06-10 15:12:17 +0000 |
commit | e9d72e0cb22838d180a31d98deb40d4d951df0c7 (patch) | |
tree | d87634ac06f4e43877c9790c9f70d61d70b246f1 /res/ais/ckpt.c | |
parent | 823d1c7ea97e33646f38274ffa4ce585021eae3e (diff) |
Merge another big set of changes from team/russell/events
This commit merges in the rest of the code needed to support distributed device
state. There are two main parts to this commit.
Core changes:
- The device state handling in the core has been updated to understand device
state across a cluster of Asterisk servers. Every time the state of a device
changes, it looks at all of the device states on each node, and determines the
aggregate device state. That resulting device state is what is provided to
modules in Asterisk that take actions based on the state of a device.
New module, res_ais:
- A module has been written to facilitate the communication of events between
nodes in a cluster of Asterisk servers. This module uses the SAForum AIS
(Service Availability Forum Application Interface Specification) CLM and EVT
services (Cluster Management and Event) to handle this task. This module
currently supports sharing Voicemail MWI (Message Waiting Indication) and
device state events between servers. It has been tested with openais, though
other implementations of the spec do exist.
For more information on testing distributed device state, see the following doc:
- doc/distributed_devstate.txt
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@121559 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/ais/ckpt.c')
-rw-r--r-- | res/ais/ckpt.c | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/res/ais/ckpt.c b/res/ais/ckpt.c new file mode 100644 index 000000000..bdf4b312c --- /dev/null +++ b/res/ais/ckpt.c @@ -0,0 +1,78 @@ +/* + * Asterisk -- An open source telephony toolkit. + * + * Copyright (C) 2007, Digium, Inc. + * + * Russell Bryant <russell@digium.com> + * + * See http://www.asterisk.org for more information about + * the Asterisk project. Please do not directly contact + * any of the maintainers of this project for assistance; + * the project provides a web site, mailing lists and IRC + * channels for your use. + * + * This program is free software, distributed under the terms of + * the GNU General Public License Version 2. See the LICENSE file + * at the top of the source tree. + */ + +/*! + * \file + * \author Russell Bryant <russell@digium.com> + * + * \brief Usage of the SAForum AIS (Application Interface Specification) + * + * \arg http://www.openais.org/ + * + * This file contains the code specific to the use of the CKPT (Checkpoint) + * service. + */ + +#include "asterisk.h" + +ASTERISK_FILE_VERSION(__FILE__, "$Revision$"); + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> + +#include "ais.h" + +#include "asterisk/module.h" +#include "asterisk/utils.h" +#include "asterisk/cli.h" +#include "asterisk/logger.h" + +SaCkptHandleT ckpt_handle; + +static const SaCkptCallbacksT ckpt_callbacks; + +int ast_ais_ckpt_load_module(void) +{ + SaAisErrorT ais_res; + + ais_res = saCkptInitialize(&ckpt_handle, &ckpt_callbacks, &ais_version); + if (ais_res != SA_AIS_OK) { + ast_log(LOG_ERROR, "Could not initialize CKPT service: %s\n", + ais_err2str(ais_res)); + return -1; + } + + return 0; +} + +int ast_ais_ckpt_unload_module(void) +{ + SaAisErrorT ais_res; + + ais_res = saCkptFinalize(amf_handle); + if (ais_res != SA_AIS_OK) { + ast_log(LOG_ERROR, "Problem stopping CKPT service: %s\n", + ais_err2str(ais_res)); + return -1; + } + + return 0; +} |