[asterisk-commits] mmichelson: branch group/CCSS r242406 - in /team/group/CCSS: include/asterisk...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Jan 22 12:26:42 CST 2010
Author: mmichelson
Date: Fri Jan 22 12:26:38 2010
New Revision: 242406
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242406
Log:
Add new way to set the CC_INTERFACES channel variable.
This is a much more convenient way for this to be done in
a channel driver during a recall.
Modified:
team/group/CCSS/include/asterisk/ccss.h
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/include/asterisk/ccss.h?view=diff&rev=242406&r1=242405&r2=242406
==============================================================================
--- team/group/CCSS/include/asterisk/ccss.h (original)
+++ team/group/CCSS/include/asterisk/ccss.h Fri Jan 22 12:26:38 2010
@@ -1404,7 +1404,8 @@
/*!
* \since 1.8
- * \brief Set the CC_INTERFACES channel variable for a channel
+ * \brief Set the CC_INTERFACES channel variable for a channel using an
+ * agent as input
*
* \note
* Implementers of protocol-specific CC agents should call this function after
@@ -1413,6 +1414,22 @@
* \details
* The CC_INTERFACES channel variable will have the interfaces that should be
* called back for a specific PBX instance.
+ *
+ * \param chan The channel to set the CC_INTERFACES variable on
+ * \param agent The agent in use for the CC transaction
+ */
+int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan, struct ast_cc_agent *agent);
+
+/*!
+ * \since 1.8
+ * \brief Set the CC_INTERFACES channel variable for a channel using an
+ * extension at context as a starting point
+ *
+ * \details
+ * The CC_INTERFACES channel variable will have the interfaces that should be
+ * called back for a specific PBX instance. This version of the function is used
+ * mainly by chan_local, wherein we need to set CC_INTERFACES based on an extension
+ * and context that appear in the middle of the tree of dialed interfaces
*
* \param chan The channel to set the CC_INTERFACES variable on
* \param extension The name of the extension for which we're setting the variable.
Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=242406&r1=242405&r2=242406
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Jan 22 12:26:38 2010
@@ -2925,6 +2925,45 @@
return 0;
}
+int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan, struct ast_cc_agent *agent)
+{
+ struct ast_datastore *recall_datastore;
+ struct ast_cc_interface_tree *interface_tree;
+ struct cc_tree_item *tree_item_iter;
+ struct cc_recall_ds_data *recall_data;
+ struct ast_str *var_value = ast_str_create(64);
+ int multi = 0;
+ char previous_dialable_name[AST_CHANNEL_NAME] = "";
+ int top_level_id;
+
+ ast_channel_lock(chan);
+ if (!(recall_datastore = ast_channel_datastore_find(chan, &recall_ds_info, NULL))) {
+ ast_channel_unlock(chan);
+ ast_free(var_value);
+ return -1;
+ }
+
+ recall_data = recall_datastore->data;
+ interface_tree = recall_data->interface_tree;
+ tree_item_iter = AST_LIST_FIRST(interface_tree);
+ top_level_id = tree_item_iter->id;
+
+ while ((tree_item_iter = AST_LIST_NEXT(tree_item_iter, next))) {
+ if (tree_item_iter->parent_id == top_level_id && strcmp(tree_item_iter->dialable_name, previous_dialable_name)) {
+ char *dialable_name = tree_item_iter->dialable_name;
+ ast_str_append(&var_value, 0, "%s%s", multi ? "&" : "", dialable_name);
+ multi = 1;
+ ast_copy_string(previous_dialable_name, dialable_name, sizeof(previous_dialable_name));
+ }
+ }
+
+ pbx_builtin_setvar_helper(chan, "CC_INTERFACES", ast_str_buffer(var_value));
+ ast_log_dynamic_level(cc_logger_level, "CC_INTERFACES set to %s\n", ast_str_buffer(var_value));
+ ast_channel_unlock(chan);
+ ast_free(var_value);
+ return 0;
+}
+
int ast_set_cc_interfaces_chanvar(struct ast_channel *chan, const char * const extension)
{
struct ast_datastore *recall_datastore;
More information about the asterisk-commits
mailing list