[svn-commits] mmichelson: branch group/CCSS r217724 - in /team/group/CCSS: include/asterisk...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Sep 10 14:36:14 CDT 2009
Author: mmichelson
Date: Thu Sep 10 14:36:09 2009
New Revision: 217724
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=217724
Log:
Write function for creating the cc_recall datastore.
This will be used to populate the CC_INTERFACES channel
variable which will be used to determine who to call back.
Modified:
team/group/CCSS/include/asterisk/ccss.h
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=217724&r1=217723&r2=217724
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Thu Sep 10 14:36:09 2009
@@ -750,6 +750,22 @@
/*!
* \since 1.6.4
+ * \brief Set up a CC recall datastore on a channel
+ *
+ * Implementors of protocol-specific CC agents will need to call this
+ * function in order for the channel to have the necessary interfaces
+ * to recall.
+ *
+ * This function must be called by the implementor once it has been detected
+ * that an inbound call is a cc_recall. After allocating the channel, call this
+ * function, followed by ast_cc_set_cc_interfaces. While it would be nice to
+ * be able to have the core do this automatically, it just cannot be done given
+ * the current architecture.
+ */
+int ast_setup_cc_recall_datastore(struct ast_channel *chan, struct ast_cc_agent *agent);
+
+/*!
+ * \since 1.6.4
* \brief Initialize CCSS
*
* XXX This needs to be updated as more functionality is added.
Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=217724&r1=217723&r2=217724
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Sep 10 14:36:09 2009
@@ -771,8 +771,8 @@
char *target;
int reason;
struct ast_channel *chan;
- struct ast_cc_interface *cc_interface;
- char *full_extension;
+ struct ast_cc_interface *cc_interface = AST_LIST_FIRST(agent->interface_tree);
+ char *full_extension = ast_strdupa(cc_interface->name);
char *context;
char *exten;
ast_log(LOG_NOTICE, "Now we should callback %s\n", agent->interface);
@@ -781,9 +781,13 @@
*target++ = '\0';
}
chan = ast_request_and_dial(tech, AST_FORMAT_SLINEAR, NULL, target, 20000, &reason, NULL, NULL);
+ /* We have a channel. It's time now to set up the datastore of recalled CC interfaces.
+ * This will be a common task for all recall functions. If it were possible, I'd have
+ * the core do it automatically, but alas I cannot. Instead, I will provide a public
+ * function to do so.
+ */
+ ast_setup_cc_recall_datastore(chan, agent);
/* Now we can bust apart the outbound name so that the PBX will run. */
- cc_interface = AST_LIST_FIRST(agent->interface_tree);
- full_extension = ast_strdupa(cc_interface->name);
exten = full_extension;
if ((context = strchr(full_extension, '@'))) {
*context++ = '\0';
@@ -1558,6 +1562,42 @@
return ast_taskprocessor_push(cc_core_taskprocessor, cc_devstate_change, monitor);
}
+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_ref(output, +1);
+ return NULL;
+}
+
+static void cc_recall_ds_destroy(void *data)
+{
+ struct ast_cc_interface_tree *interface_tree = data;
+ ao2_ref(interface_tree, -1);
+}
+
+static struct ast_datastore_info recall_ds_info = {
+ .type = "cc_recall",
+ .duplicate = cc_recall_ds_duplicate,
+ .destroy = cc_recall_ds_destroy,
+};
+
+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);
+
+ if (!recall_datastore) {
+ return -1;
+ }
+ ao2_ref(agent->interface_tree, +1);
+ recall_datastore->data = agent->interface_tree;
+ recall_datastore->inheritance = DATASTORE_INHERIT_FOREVER;
+ ast_channel_lock(chan);
+ ast_channel_datastore_add(chan, recall_datastore);
+ ast_channel_unlock(chan);
+ return 0;
+}
+
int ast_cc_init(void)
{
int res;
More information about the svn-commits
mailing list