[asterisk-commits] mmichelson: branch group/CCSS r216592 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 4 14:08:44 CDT 2009
Author: mmichelson
Date: Fri Sep 4 14:08:43 2009
New Revision: 216592
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=216592
Log:
Fill in the pass_state_up function.
Modified:
team/group/CCSS/main/ccss.c
Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=216592&r1=216591&r2=216592
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Sep 4 14:08:43 2009
@@ -1012,10 +1012,45 @@
* means that the state change has been screened to the point that
* the core should be alerted of it. The root monitor will request a
* core state machine change to the CC_CALLEE_READY state
+ *
+ * Note of course that only state changes for AVAILABILITY are passed
+ * upstream. There is no need to pass along the fact that a phone has
+ * become busy.
*/
static int pass_state_up(struct ast_cc_monitor *monitor, enum ast_device_state state, int core_id)
{
- /* STUB */
+ struct cc_core_instance *core_instance;
+ struct cc_core_instance finder = { .core_id = core_id };
+ ast_assert(monitor->monitor_class == AST_CC_EXTENSION_MONITOR ||
+ monitor->monitor_class == AST_CC_ROOT_MONITOR);
+
+ if (!(core_instance = ao2_find(cc_core_instances, &finder, OBJ_POINTER))) {
+ return -1;
+ }
+
+ if (monitor->monitor_class == AST_CC_ROOT_MONITOR) {
+ ast_cc_request_state_change(CC_CALLEE_READY, core_id, "Device being monitored has become available");
+ }
+
+ /* Oh, so you're an extension monitor, are you?!
+ *
+ * Extension monitors may have multiple children with the same core_id,
+ * but they SHOULD have only a single parent with that core_id.
+ */
+ AST_LIST_TRAVERSE(monitor->parent_links, link, next_parent) {
+ if (link->core_id == core_id) {
+ break;
+ }
+ }
+
+ if (!link) {
+ ast_log(LOG_WARNING, "Monitor %s has no parent link with core_id %d but it had a child. That should be impossible\n",
+ monitor->name, core_id);
+ return -1;
+ }
+
+ pass_state_up(link->parent, state, core_id);
+
return 0;
}
More information about the asterisk-commits
mailing list