summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index d669baf85..418e6a772 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1017,6 +1017,12 @@ __ast_channel_alloc_ap(int needqueue, int state, const char *cid_num, const char
ast_channel_internal_finalize(tmp);
ast_atomic_fetchadd_int(&chancount, +1);
+
+ /* You might scream "locking inversion" at seeing this but it is actually perfectly fine.
+ * Since the channel was just created nothing can know about it yet or even acquire it.
+ */
+ ast_channel_lock(tmp);
+
ao2_link(channels, tmp);
/*