[asterisk-commits] mmichelson: branch group/CCSS r219941 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 23 15:22:21 CDT 2009
Author: mmichelson
Date: Wed Sep 23 15:22:17 2009
New Revision: 219941
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=219941
Log:
Add the core_id to the recall_datastore.
app_dial's going to need this when it requests the
state transition to CC_COMPLETE
Modified:
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=219941&r1=219940&r2=219941
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Wed Sep 23 15:22:17 2009
@@ -1766,18 +1766,29 @@
return ast_taskprocessor_push(cc_core_taskprocessor, cc_devstate_change, monitor);
}
+struct cc_recall_ds_data {
+ int core_id;
+ struct ast_cc_interface_tree *interface_tree;
+};
+
static void *cc_recall_ds_duplicate(void *data)
{
- struct ast_cc_interface_tree *interface_tree = data;
- struct ast_cc_interface_tree *output = interface_tree;
- ao2_t_ref(output, +1, "Bump refcount of interface tree for recall");
- return NULL;
+ struct cc_recall_ds_data *old_data = data;
+ struct cc_recall_ds_data *new_data = ast_calloc(1, sizeof(*new_data));
+
+ if (!new_data) {
+ return NULL;
+ }
+ ao2_t_ref(old_data->interface_tree, +1, "Bump refcount of interface tree for recall");
+ memcpy(new_data, old_data, sizeof(*new_data));
+ return new_data;
}
static void cc_recall_ds_destroy(void *data)
{
- struct ast_cc_interface_tree *interface_tree = data;
- ao2_t_ref(interface_tree, -1, "Unref recall interface tree");
+ struct cc_recall_ds_data *recall_data = data;
+ ao2_t_ref(recall_data->interface_tree, -1, "Unref recall interface tree");
+ ast_free(recall_data);
}
static struct ast_datastore_info recall_ds_info = {
@@ -1789,12 +1800,21 @@
int ast_setup_cc_recall_datastore(struct ast_channel *chan, struct ast_cc_agent *agent)
{
struct ast_datastore *recall_datastore = ast_datastore_alloc(&recall_ds_info, NULL);
+ struct cc_recall_ds_data *recall_data;
if (!recall_datastore) {
return -1;
}
+
+ if (!(recall_data = ast_calloc(1, sizeof(*recall_data)))) {
+ ast_datastore_free(recall_datastore);
+ return -1;
+ }
+
ao2_t_ref(agent->interface_tree, +1, "Bump refcount for interface tree for agent");
- recall_datastore->data = agent->interface_tree;
+ recall_data->core_id = agent->core_id;
+ recall_data->interface_tree = agent->interface_tree;
+ recall_datastore->data = recall_data;
recall_datastore->inheritance = DATASTORE_INHERIT_FOREVER;
ast_channel_lock(chan);
ast_channel_datastore_add(chan, recall_datastore);
@@ -1807,6 +1827,7 @@
struct ast_datastore *recall_datastore;
struct ast_cc_interface_tree *interface_tree;
struct ast_cc_tree_item *tree_item_iter;
+ struct cc_recall_ds_data *recall_data;
unsigned int exten_id = 0;
struct ast_str *var_value = ast_str_create(64);
int multi = 0;
@@ -1817,7 +1838,8 @@
return -1;
}
- interface_tree = recall_datastore->data;
+ recall_data = recall_datastore->data;
+ interface_tree = recall_data->interface_tree;
AST_LIST_TRAVERSE(interface_tree, tree_item_iter, next) {
if (!strcmp(tree_item_iter->interface->name, extension)) {
More information about the asterisk-commits
mailing list