diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 49f9d3e711..d14a3bd03e 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -4637,10 +4637,11 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast) int index; void *readbuf; struct ast_frame *f; - - ast_mutex_lock(&p->lock); - + while (ast_mutex_trylock(&p->lock)) { + DEADLOCK_AVOIDANCE(&ast->lock); + } + index = dahdi_get_index(ast, p, 0); /* Hang up if we don't really exist */