diff --git a/apps/app_dial.c b/apps/app_dial.c index 6f7c307..40594a6 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -945,12 +945,27 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, case AST_CONTROL_ANSWER: /* This is our guy if someone answered. */ if (!peer) { + struct ast_datastore *datastore = NULL; + ast_verb(3, "%s answered %s\n", c->name, in->name); peer = c; if (peer->cdr) { peer->cdr->answer = ast_tvnow(); peer->cdr->disposition = AST_CDR_ANSWERED; } + + /* Erase the datastore containing the list of already dialed interfaces */ + ast_channel_lock(in); + datastore = ast_channel_datastore_find(in, &dialed_interface_info, NULL); + if (datastore) { + ast_debug(3, "Deleting the dialed interfaces datastore on channel %s\n", in->name); + + ast_channel_datastore_remove(in, datastore); + ast_datastore_free(datastore); + datastore = NULL; + } + ast_channel_unlock(in); + ast_copy_flags64(peerflags, o, OPT_CALLEE_TRANSFER | OPT_CALLER_TRANSFER | OPT_CALLEE_HANGUP | OPT_CALLER_HANGUP | diff --git a/main/features.c b/main/features.c index fc9ef55..b7d339e 100644 --- a/main/features.c +++ b/main/features.c @@ -4284,6 +4284,7 @@ static int action_bridge(struct mansession *s, const struct message *m) struct ast_channel *chana = NULL, *chanb = NULL; struct ast_channel *tmpchana = NULL, *tmpchanb = NULL; struct ast_bridge_thread_obj *tobj = NULL; + struct ast_datastore *datastore = NULL; /* make sure valid channels were specified */ if (ast_strlen_zero(channela) || ast_strlen_zero(channelb)) { @@ -4310,6 +4311,14 @@ static int action_bridge(struct mansession *s, const struct message *m) if (chana->_state != AST_STATE_UP) ast_answer(chana); + /* Delete the dialed list for this channel */ + datastore = ast_channel_datastore_find(chana, &dialed_interface_info, NULL); + if (datastore) { + ast_channel_datastore_remove(chana, datastore); + ast_datastore_free(datastore); + datastore = NULL; + } + /* create the placeholder channels and grab the other channels */ if (!(tmpchana = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, 0, "Bridge/%s", chana->name))) { @@ -4337,6 +4346,15 @@ static int action_bridge(struct mansession *s, const struct message *m) if (chanb->_state != AST_STATE_UP) ast_answer(chanb); + /* Delete the dialed list for this channel */ + datastore = ast_channel_datastore_find(chanb, &dialed_interface_info, NULL); + if (datastore) { + ast_channel_datastore_remove(chanb, datastore); + ast_datastore_free(datastore); + datastore = NULL; + } + + /* create the placeholder channels and grab the other channels */ if (!(tmpchanb = ast_channel_alloc(0, AST_STATE_DOWN, NULL, NULL, NULL, NULL, NULL, 0, "Bridge/%s", chanb->name))) { @@ -4377,7 +4395,7 @@ static int action_bridge(struct mansession *s, const struct message *m) ast_log(LOG_WARNING, "Failed to play a courtesy tone on chan %s\n", tmpchanb->name); } } - + bridge_call_thread_launch(tobj); astman_send_ack(s, m, "Launched bridge thread with success");