[asterisk-commits] jrose: branch jrose/call_identifiers r360030 - in /team/jrose/call_identifier...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 20 14:21:16 CDT 2012
Author: jrose
Date: Tue Mar 20 14:21:12 2012
New Revision: 360030
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=360030
Log:
adding threadassociation with bridging and ccss... not sure if both of these are proper to do...
Modified:
team/jrose/call_identifiers/include/asterisk/bridging.h
team/jrose/call_identifiers/include/asterisk/ccss.h
team/jrose/call_identifiers/main/bridging.c
team/jrose/call_identifiers/main/ccss.c
Modified: team/jrose/call_identifiers/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/include/asterisk/bridging.h?view=diff&rev=360030&r1=360029&r2=360030
==============================================================================
--- team/jrose/call_identifiers/include/asterisk/bridging.h (original)
+++ team/jrose/call_identifiers/include/asterisk/bridging.h Tue Mar 20 14:21:12 2012
@@ -165,6 +165,8 @@
struct ast_bridge_tech_optimizations tech_args;
/*! Queue of DTMF digits used for DTMF streaming */
char dtmf_stream_q[8];
+ /*! Call ID associated with bridge channel */
+ struct ast_callid *callid;
/*! Linked list information */
AST_LIST_ENTRY(ast_bridge_channel) entry;
};
@@ -243,9 +245,11 @@
size_t array_num;
/*! Number of channels the array can handle */
size_t array_size;
+ /*! Call ID associated with the bridge */
+ struct ast_callid *callid;
/*! Linked list of channels participating in the bridge */
AST_LIST_HEAD_NOLOCK(, ast_bridge_channel) channels;
-};
+ };
/*! \brief Create a new bridge
*
Modified: team/jrose/call_identifiers/include/asterisk/ccss.h
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/include/asterisk/ccss.h?view=diff&rev=360030&r1=360029&r2=360030
==============================================================================
--- team/jrose/call_identifiers/include/asterisk/ccss.h (original)
+++ team/jrose/call_identifiers/include/asterisk/ccss.h Tue Mar 20 14:21:12 2012
@@ -873,6 +873,11 @@
* represents/communicates with
*/
char device_name[1];
+ /*! If a thread is created for this cc_agent by another call
+ * related thread, it will be attached to a callid.
+ */
+ struct ast_callid *callid;
+
};
enum ast_cc_agent_response_reason {
Modified: team/jrose/call_identifiers/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/main/bridging.c?view=diff&rev=360030&r1=360029&r2=360030
==============================================================================
--- team/jrose/call_identifiers/main/bridging.c (original)
+++ team/jrose/call_identifiers/main/bridging.c Tue Mar 20 14:21:12 2012
@@ -372,6 +372,10 @@
ao2_lock(bridge);
+ if (bridge->callid) {
+ ast_callid_threadassoc_add(bridge->callid);
+ }
+
ast_debug(1, "Started bridge thread for %p\n", bridge);
/* Loop around until we are told to stop */
@@ -541,6 +545,10 @@
/* Drop every bridged channel, the last one will cause the bridge thread (if it exists) to exit */
AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_END);
+ }
+
+ if (bridge->callid) {
+ ast_callid_unref(bridge->callid);
}
ao2_unlock(bridge);
@@ -971,6 +979,11 @@
/* If the technology requires a thread and one is not running, start it up */
if (bridge_channel->bridge->thread == AST_PTHREADT_NULL && (bridge_channel->bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD)) {
bridge_channel->bridge->stop = 0;
+
+ if ((bridge_channel->bridge->callid = ast_read_threadstorage_callid())) {
+ ast_callid_ref(bridge_channel->bridge->callid);
+ }
+
ast_debug(1, "Starting a bridge thread for bridge %p\n", bridge_channel->bridge);
ao2_ref(bridge_channel->bridge, +1);
if (ast_pthread_create(&bridge_channel->bridge->thread, NULL, bridge_thread, bridge_channel->bridge)) {
@@ -1059,6 +1072,11 @@
ao2_ref(bridge_channel->bridge, -1);
bridge_channel->bridge = NULL;
}
+
+ if (bridge_channel->callid) {
+ ast_callid_unref(bridge_channel->callid);
+ }
+
/* Destroy elements of the bridge channel structure and the bridge channel structure itself */
ast_cond_destroy(&bridge_channel->cond);
}
@@ -1118,6 +1136,10 @@
struct ast_bridge_channel *bridge_channel = data;
enum ast_bridge_channel_state state;
+ if (bridge_channel->callid) {
+ ast_callid_threadassoc_add(bridge_channel->callid);
+ }
+
state = bridge_channel_join(bridge_channel);
/* If no other thread is going to take the channel then hang it up, or else we would have to service it until something else came along */
@@ -1151,6 +1173,9 @@
bridge_channel->features = features;
bridge_channel->allow_impart_hangup = allow_hangup;
+ if ((bridge_channel->callid = ast_read_threadstorage_callid())) {
+ ast_callid_ref(bridge_channel->callid);
+ }
/* Actually create the thread that will handle the channel */
if (ast_pthread_create(&bridge_channel->thread, NULL, bridge_channel_thread, bridge_channel)) {
Modified: team/jrose/call_identifiers/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/call_identifiers/main/ccss.c?view=diff&rev=360030&r1=360029&r2=360030
==============================================================================
--- team/jrose/call_identifiers/main/ccss.c (original)
+++ team/jrose/call_identifiers/main/ccss.c Tue Mar 20 14:21:12 2012
@@ -2410,6 +2410,10 @@
if (agent->callbacks) {
agent->callbacks->destructor(agent);
}
+ if (agent->callid) {
+ ast_callid_unref(agent->callid);
+ }
+
ast_cc_config_params_destroy(agent->cc_params);
}
@@ -2685,6 +2689,10 @@
struct ast_format tmp_fmt;
struct ast_format_cap *tmp_cap = ast_format_cap_alloc_nolock();
+ if (agent->callid) {
+ ast_callid_threadassoc_add(agent->callid);
+ }
+
if (!tmp_cap) {
return NULL;
}
@@ -2757,6 +2765,11 @@
ast_cc_agent_caller_busy(agent->core_id, "Generic agent caller %s is busy", agent->device_name);
return 0;
}
+
+ if ((agent->callid = ast_read_threadstorage_callid())) {
+ ast_callid_ref(agent->callid);
+ }
+
ast_pthread_create_detached_background(&clotho, NULL, generic_recall, agent);
return 0;
}
More information about the asterisk-commits
mailing list