diff --git a/main/features.c b/main/features.c index 166b24ec3a..8ce02bb755 100644 --- a/main/features.c +++ b/main/features.c @@ -2193,14 +2193,15 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast ast_copy_string(chan->exten, "h", sizeof(chan->exten)); chan->priority = 1; ast_channel_unlock(chan); - while ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num, &found, 1))) { + while ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->cid.cid_num, &found, 1)) == 0) { chan->priority++; } - if (found && res) - { + if (found && res) { /* Something bad happened, or a hangup has been requested. */ ast_debug(1, "Spawn extension (%s,%s,%d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s'\n", chan->context, chan->exten, chan->priority, chan->name); + } else if (!found && res) { + res = 0; } /* swap it back */ ast_channel_lock(chan);