race condition: ast_dial_join() may not cancel outgoing call, if
function is called just after called party answer and before
application execution (bit is_running_app not yet set).
This fix adds ast_softhangup() calls in addition to existing
pthread_kill() when is_running_app is not set.
ASTERISK-30258
Change-Id: Idbdd5c15122159661aa8e996a42d5800083131e4
ast_channel_unlock(chan);
}
} else {
+ struct ast_dial_channel *channel = NULL;
+
/* Now we signal it with SIGURG so it will break out of it's waitfor */
pthread_kill(thread, SIGURG);
+
+ /* pthread_kill may not be enough, if outgoing channel has already got an answer (no more in waitfor) but is not yet running an application. Force soft hangup. */
+ AST_LIST_TRAVERSE(&dial->channels, channel, list) {
+ if (channel->owner) {
+ ast_softhangup(channel->owner, AST_SOFTHANGUP_EXPLICIT);
+ }
+ }
}
AST_LIST_UNLOCK(&dial->channels);