ast_log(LOG_WARNING, "Unable to allocate three-way subchannel\n");
goto winkflashdone;
}
- /* Make new channel */
+
+ /*
+ * Make new channel
+ *
+ * We cannot hold the p or ast locks while creating a new
+ * channel.
+ */
+ ast_mutex_unlock(&p->lock);
+ ast_channel_unlock(ast);
chan = dahdi_new(p, AST_STATE_RESERVED, 0, SUB_THREEWAY, 0, NULL);
+ ast_channel_lock(ast);
+ ast_mutex_lock(&p->lock);
if (p->dahditrcallerid) {
if (!p->origcid_num)
p->origcid_num = ast_strdup(p->cid_num);
}
}
-#if 0
static void analog_unlock_private(struct analog_pvt *p)
{
if (p->calls->unlock_private) {
p->calls->unlock_private(p->chan_pvt);
}
}
-#endif
-#if 0
static void analog_lock_private(struct analog_pvt *p)
{
if (p->calls->lock_private) {
p->calls->lock_private(p->chan_pvt);
}
}
-#endif
/*!
* \internal
ast_log(LOG_WARNING, "Unable to allocate three-way subchannel\n");
goto winkflashdone;
}
- /* Make new channel */
+
+ /*
+ * Make new channel
+ *
+ * We cannot hold the p or ast locks while creating a new
+ * channel.
+ */
+ analog_unlock_private(p);
+ ast_channel_unlock(ast);
chan = analog_new_ast_channel(p, AST_STATE_RESERVED, 0, ANALOG_SUB_THREEWAY, NULL);
+ ast_channel_lock(ast);
+ analog_lock_private(p);
if (!chan) {
ast_log(LOG_WARNING,
"Cannot allocate new call structure on channel %d\n",