[asterisk-commits] mmichelson: branch group/CCSS r213085 - in /team/group/CCSS: include/asterisk...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 19 13:13:47 CDT 2009
Author: mmichelson
Date: Wed Aug 19 13:13:44 2009
New Revision: 213085
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=213085
Log:
Add means of placing CCSS configuration parameters on a channel.
Using a datastore right now so that there is no ABI breakage.
Modified:
team/group/CCSS/include/asterisk/channel.h
team/group/CCSS/main/channel.c
Modified: team/group/CCSS/include/asterisk/channel.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/channel.h?view=diff&rev=213085&r1=213084&r2=213085
==============================================================================
--- team/group/CCSS/include/asterisk/channel.h (original)
+++ team/group/CCSS/include/asterisk/channel.h Wed Aug 19 13:13:44 2009
@@ -148,6 +148,7 @@
#include "asterisk/linkedlists.h"
#include "asterisk/stringfields.h"
#include "asterisk/datastore.h"
+#include "asterisk/ccss.h"
#define DATASTORE_INHERIT_FOREVER INT_MAX
@@ -2667,6 +2668,22 @@
* '0'
*/
int ast_channel_connected_line_macro(struct ast_channel *autoservice_chan, struct ast_channel *macro_chan, const void *connected_info, int caller, int frame);
+
+/*!
+ * \since 1.6.4
+ * \brief Set up datastore with CCSS parameters for a channel
+ *
+ * Note that if base_params is NULL, the channel will get the default
+ * values for all CCSS parameters.
+ *
+ * \param chan The channel to create the datastore on
+ * \param base_params CCSS parameters we wish to copy into the channel
+ * \retval 0 Success
+ * \retval -1 Failure
+ */
+int ast_channel_cc_params_init(struct ast_channel *chan,
+ const struct ast_cc_config_params *base_params);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
Modified: team/group/CCSS/main/channel.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/channel.c?view=diff&rev=213085&r1=213084&r2=213085
==============================================================================
--- team/group/CCSS/main/channel.c (original)
+++ team/group/CCSS/main/channel.c Wed Aug 19 13:13:44 2009
@@ -7062,6 +7062,52 @@
return retval;
}
+static void *channel_cc_params_copy(void *data)
+{
+ const struct ast_cc_config_params *src = data;
+ struct ast_cc_config_params *dest = ast_cc_config_params_init();
+ if (!dest) {
+ return NULL;
+ }
+ ast_cc_copy_config_params(dest, src);
+ return dest;
+}
+
+static void channel_cc_params_destroy(void *data)
+{
+ struct ast_cc_config_params *cc_params = data;
+ ast_cc_config_params_destroy(cc_params);
+}
+
+static const struct ast_datastore_info cc_channel_datastore_info = {
+ .type = "Call Completion",
+ .duplicate = channel_cc_params_copy,
+ .destroy = channel_cc_params_destroy,
+};
+
+int ast_channel_cc_params_init(struct ast_channel *chan,
+ const struct ast_cc_config_params *base_params)
+{
+ struct ast_cc_config_params *cc_params = ast_cc_config_params_init();
+ struct ast_datastore *cc_datastore;
+
+ if (!(cc_params = ast_cc_config_params_init())) {
+ return -1;
+ }
+
+ if (!(cc_datastore = ast_datastore_alloc(&cc_channel_datastore_info, NULL))) {
+ ast_cc_config_params_destroy(cc_params);
+ return -1;
+ }
+
+ if (base_params) {
+ ast_cc_copy_config_params(cc_params, base_params);
+ }
+ cc_datastore->data = cc_params;
+ ast_channel_datastore_add(chan, cc_datastore);
+ return 0;
+}
+
/* DO NOT PUT ADDITIONAL FUNCTIONS BELOW THIS BOUNDARY
*
* ONLY FUNCTIONS FOR PROVIDING BACKWARDS ABI COMPATIBILITY BELONG HERE
More information about the asterisk-commits
mailing list