diff --git a/channels/chan_zap.c b/channels/chan_zap.c index f3815e38e02609939d7a992d7232f84ebe2b9859..db3ef8b39af474329c31899ed128847c201275b3 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -3475,7 +3475,11 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann return AST_BRIDGE_FAILED_NOWARN; ast_channel_lock(c0); - ast_channel_lock(c1); + while (ast_channel_trylock(c1)) { + ast_channel_unlock(c0); + usleep(1); + ast_channel_lock(c0); + } p0 = c0->tech_pvt; p1 = c1->tech_pvt; @@ -3641,8 +3645,13 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann /* Here's our main loop... Start by locking things, looking for private parts, and then balking if anything is wrong */ + ast_channel_lock(c0); - ast_channel_lock(c1); + while (ast_channel_trylock(c1)) { + ast_channel_unlock(c0); + usleep(1); + ast_channel_lock(c0); + } p0 = c0->tech_pvt; p1 = c1->tech_pvt;