diff --git a/src/channels/chan_voicemngr.c b/src/channels/chan_voicemngr.c index e358744838d1c728de9406ca31afaf828d16c81e..923ff898c37f8c51d8909124e02cb79a9f8c411e 100644 --- a/src/channels/chan_voicemngr.c +++ b/src/channels/chan_voicemngr.c @@ -5770,10 +5770,12 @@ static int chan_voicemngr_close_connection(struct chan_voicemngr_subchannel *sub struct chan_voicemngr_pvt *p = sub->parent; if (sub->connection_init) { - if (!chan_voicemngr_in_onhold(p) && !chan_voicemngr_in_call(p) && !chan_voicemngr_in_dialing(p) && !chan_voicemngr_in_ringback(p) && - !chan_voicemngr_in_callwaiting(p) && !chan_voicemngr_in_transferring(p)) { // Does the line have another call? - ast_debug(1, "Closing real endpoint connection line_id: %d, connection_id=%d, call_id: %d\n", p->line_id, sub->connection_id, sub->call_id); - endpt_connection(p->line_id, sub->call_id, "destroy"); + if (!chan_voicemngr_in_onhold(p) && !chan_voicemngr_in_call(p) && !chan_voicemngr_in_dialing(p) && + !chan_voicemngr_in_ringback(p) && !chan_voicemngr_in_callwaiting(p) && !chan_voicemngr_in_transferring(p)) { + // There is no other call on the line + ast_debug(1, "Closing real endpoint connection line_id: %d, connection_id=%d\n", + p->line_id, sub->connection_id); + endpt_connection(p->line_id, -1, "destroy"); } else { ast_debug(1, "Releasing connection for pvt line_id=%i connection_id=%d, call_id: %d\n", sub->parent->line_id, sub->connection_id, sub->call_id);