summaryrefslogtreecommitdiff
path: root/main/bridging.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2012-06-26 21:45:22 +0000
committerJonathan Rose <jrose@digium.com>2012-06-26 21:45:22 +0000
commit5eb94d7ebbc2c29d4de8201103bcb62ae8afcd31 (patch)
tree454a727e077efa3f74ea80469d0f863066f59c13 /main/bridging.c
parentee1111869585af74ea79a0bf45edcee49c00508b (diff)
Unique Call ID logging Phases III and IV
Adds call ID logging changes to specific channel drivers that weren't handled handled in phase II of Call ID Logging. Also covers logging for threads for threads created by systems that may be involved with many different calls. Extra special thanks to Richard for rigorous review of chan_dahdi and its various signalling modules. review: https://reviewboard.asterisk.org/r/1927/ review: https://reviewboard.asterisk.org/r/1950/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridging.c')
-rw-r--r--main/bridging.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/main/bridging.c b/main/bridging.c
index 54ce9aebc..8bb13f916 100644
--- a/main/bridging.c
+++ b/main/bridging.c
@@ -376,6 +376,10 @@ static void *bridge_thread(void *data)
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 */
@@ -536,6 +540,10 @@ int ast_bridge_destroy(struct ast_bridge *bridge)
ao2_lock(bridge);
+ if (bridge->callid) {
+ bridge->callid = ast_callid_unref(bridge->callid);
+ }
+
bridge->stop = 1;
bridge_poke(bridge);
@@ -931,6 +939,10 @@ static enum ast_bridge_channel_state bridge_channel_join(struct ast_bridge_chann
ao2_lock(bridge_channel->bridge);
+ if (!bridge_channel->bridge->callid) {
+ bridge_channel->bridge->callid = ast_read_threadstorage_callid();
+ }
+
state = bridge_channel->state;
/* Add channel into the bridge */
@@ -1059,6 +1071,10 @@ static void bridge_channel_destroy(void *obj)
{
struct ast_bridge_channel *bridge_channel = obj;
+ if (bridge_channel->callid) {
+ bridge_channel->callid = ast_callid_unref(bridge_channel->callid);
+ }
+
if (bridge_channel->bridge) {
ao2_ref(bridge_channel->bridge, -1);
bridge_channel->bridge = NULL;
@@ -1122,6 +1138,10 @@ static void *bridge_channel_thread(void *data)
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 */
@@ -1144,6 +1164,7 @@ static void *bridge_channel_thread(void *data)
int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struct ast_channel *swap, struct ast_bridge_features *features, int allow_hangup)
{
struct ast_bridge_channel *bridge_channel = bridge_channel_alloc(bridge);
+
/* Try to allocate a structure for the bridge channel */
if (!(bridge_channel)) {
return -1;
@@ -1154,7 +1175,7 @@ int ast_bridge_impart(struct ast_bridge *bridge, struct ast_channel *chan, struc
bridge_channel->swap = swap;
bridge_channel->features = features;
bridge_channel->allow_impart_hangup = allow_hangup;
-
+ bridge_channel->callid = ast_read_threadstorage_callid();
/* Actually create the thread that will handle the channel */
if (ast_pthread_create(&bridge_channel->thread, NULL, bridge_channel_thread, bridge_channel)) {