[asterisk-commits] mmichelson: branch group/CCSS r248753 - /team/group/CCSS/main/ccss.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Feb 25 11:03:34 CST 2010
Author: mmichelson
Date: Thu Feb 25 11:03:31 2010
New Revision: 248753
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=248753
Log:
Address interface tree referencing as pointed out by Richard's comments on ReviewBoard.
Also removed some no longer used code after the latest changes regarding extension
monitor child dialstring storage.
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=248753&r1=248752&r2=248753
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Feb 25 11:03:31 2010
@@ -1546,13 +1546,6 @@
*/
char is_original_caller;
/*!
- * When nested dials occur (i.e. dialing local channels), the invocation
- * of the Local channel may have modifiers like /n or /b on the channel name.
- * This needs to be preserved as the dialable name on an extension monitor
- * which may be created for the local channel.
- */
- char *current_extension_dialstring;
- /*!
* Reference-counted "tree" of interfaces.
*/
struct cc_monitor_tree *interface_tree;
@@ -1574,7 +1567,6 @@
{
struct dialed_cc_interfaces *cc_interfaces = data;
cc_unref(cc_interfaces->interface_tree, "Unref dial's ref to monitor tree");
- ast_free(cc_interfaces->current_extension_dialstring);
ast_free(cc_interfaces);
}
@@ -1649,7 +1641,7 @@
}
cc_interfaces = cc_datastore->data;
- interface_tree = cc_ref(cc_interfaces->interface_tree, "Gaining reference to tree so we can unlock the channel");
+ interface_tree = cc_interfaces->interface_tree;
id = cc_interfaces->dial_parent_id;
ast_channel_unlock(incoming);
@@ -1662,14 +1654,12 @@
if (!monitor) {
AST_LIST_UNLOCK(interface_tree);
- cc_unref(interface_tree, "Done with monitor tree");
return;
}
extension_pvt = monitor->private_data;
if (!(child_dialstring = ast_calloc(1, sizeof(*child_dialstring)))) {
AST_LIST_UNLOCK(interface_tree);
- cc_unref(interface_tree, "Done with monitor tree");
return;
}
ast_copy_string(child_dialstring->original_dialstring, dialstring, sizeof(child_dialstring->original_dialstring));
@@ -1677,7 +1667,6 @@
child_dialstring->is_valid = 1;
AST_LIST_INSERT_TAIL(&extension_pvt->child_dialstrings, child_dialstring, next);
AST_LIST_UNLOCK(interface_tree);
- cc_unref(interface_tree, "Done with monitor tree");
}
static void cc_extension_monitor_change_is_valid(struct cc_core_instance *core_instance, unsigned int parent_id, const char * const device_name, int is_valid)
@@ -2005,7 +1994,6 @@
}
}
- cc_ref(cc_interfaces->interface_tree, "Bumping CC interface tree ref in case channel is hung up");
ast_channel_unlock(inbound);
/* Yeah this kind of sucks, but luckily most people
@@ -2021,17 +2009,15 @@
core_instance->core_id, device_name);
AST_LIST_UNLOCK(cc_interfaces->interface_tree);
cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame. Unref core_instance");
- cc_unref(cc_interfaces->interface_tree, "Returning early from ast_handle_cc_control_frame. Unref CC interface tree");
call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return;
}
}
AST_LIST_UNLOCK(cc_interfaces->interface_tree);
- if (!(monitor = cc_device_monitor_init(device_name, dialstring, cc_data, cc_interfaces->core_id))) {
+ if (!(monitor = cc_device_monitor_init(device_name, dialstring, cc_data, core_instance->core_id))) {
ast_log(LOG_WARNING, "Unable to create CC device interface for '%s'. CC services will be unavailable on this interface.\n", device_name);
cc_unref(core_instance, "Returning early from ast_handle_cc_control_frame. Unref core_instance");
- cc_unref(cc_interfaces->interface_tree, "Returning early from ast_handle_cc_control_frame. Unref CC interface tree");
call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return;
}
@@ -2052,7 +2038,6 @@
cc_unref(core_instance, "Done with core_instance after handling CC control frame");
cc_unref(monitor, "Unref reference from allocating monitor");
- cc_unref(cc_interfaces->interface_tree, "Done with CC interface tree after handling CC control frame.");
}
int ast_cc_call_init(struct ast_channel *chan, int *ignore_cc)
@@ -2104,27 +2089,20 @@
return cc_interfaces_datastore_init(chan);
}
interfaces = cc_interfaces_datastore->data;
- cc_ref(interfaces->interface_tree, "Bump refcount on interface tree before unlocking channel");
ast_channel_unlock(chan);
if (interfaces->ignore) {
/* Situation 3 has occurred */
*ignore_cc = 1;
ast_log_dynamic_level(cc_logger_level, "Datastore is present with ignore flag set. Ignoring CC offers on this call\n");
- cc_unref(interfaces->interface_tree, "Drop refcount on interface tree");
return 0;
}
/* Situation 2 has occurred */
if (!(monitor = cc_extension_monitor_init(S_OR(chan->macroexten, chan->exten),
S_OR(chan->macrocontext, chan->context), interfaces->dial_parent_id))) {
- cc_unref(interfaces->interface_tree, "Drop refcount on interface tree");
- return -1;
- }
- /* In situation 2, chan_local will have set the extension's dialable name
- * on the datastore, so we need to copy that into this monitor.
- */
- monitor->dialstring = ast_strdup(interfaces->current_extension_dialstring);
+ return -1;
+ }
monitor->core_id = interfaces->core_id;
AST_LIST_LOCK(interfaces->interface_tree);
cc_ref(monitor, "monitor tree's reference to the monitor");
@@ -2132,7 +2110,6 @@
AST_LIST_UNLOCK(interfaces->interface_tree);
interfaces->dial_parent_id = monitor->id;
cc_unref(monitor, "Unref monitor's allocation reference");
- cc_unref(interfaces->interface_tree, "Drop refcount on interface tree");
return 0;
}
More information about the asterisk-commits
mailing list