<para>Reset the call detail record (CDR) for this call.</para>
</option>
<option name="c">
- <para>If the Dial() application cancels this call, always set the flag to tell the channel
- driver that the call is answered elsewhere.</para>
+ <para>If the Dial() application cancels this call, always set HANGUPCAUSE to 'answered elsewhere'</para>
</option>
<option name="d">
<para>Allow the calling user to dial a 1 digit extension while waiting for
/* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) {
if (answered_elsewhere) {
- /* The flag is used for local channel inheritance and stuff */
- ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
/* This is for the channel drivers */
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
if (outbound_group)
ast_app_group_set_channel(tc, outbound_group);
/* If the calling channel has the ANSWERED_ELSEWHERE flag set, inherit it. This is to support local channels */
- if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE))
- ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
+ if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE)
+ ast_channel_hangupcause_set(tc, AST_CAUSE_ANSWERED_ELSEWHERE);
/* Check if we're forced by configuration */
if (ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE))
- ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_channel_hangupcause_set(tc, AST_CAUSE_ANSWERED_ELSEWHERE);
/* Inherit context and extension */
}
ast_channel_early_bridge(chan, NULL);
- hanguptree(&out_chans, NULL, 0); /* In this case, there's no answer anywhere */
+ hanguptree(&out_chans, NULL, ast_channel_hangupcause(chan)==AST_CAUSE_ANSWERED_ELSEWHERE ? 1 : 0 ); /* forward 'answered elsewhere' if we received it */
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
senddialendevent(chan, pa.status);
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
-
+
if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_INCOMPLETE)) {
if (!ast_tvzero(calldurationlimit))
memset(ast_channel_whentohangup(chan), 0, sizeof(*ast_channel_whentohangup(chan)));
/* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) {
if (exception || cancel_answered_elsewhere) {
- ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
ast_hangup(outgoing->chan);
}
ast_channel_lock_both(tmp->chan, qe->chan);
if (qe->cancel_answered_elsewhere) {
- ast_set_flag(ast_channel_flags(tmp->chan), AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_channel_hangupcause_set(tmp->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
ast_channel_appl_set(tmp->chan, "AppQueue");
ast_channel_data_set(tmp->chan, "(Outgoing Line)");
qe->cancel_answered_elsewhere = 1;
}
- /* if the calling channel has the ANSWERED_ELSEWHERE flag set, make sure this is inherited.
+ /* if the calling channel has AST_CAUSE_ANSWERED_ELSEWHERE set, make sure this is inherited.
(this is mainly to support chan_local)
*/
- if (ast_test_flag(ast_channel_flags(qe->chan), AST_FLAG_ANSWERED_ELSEWHERE)) {
+ if (ast_channel_hangupcause(qe->chan) == AST_CAUSE_ANSWERED_ELSEWHERE) {
qe->cancel_answered_elsewhere = 1;
}
#include <sys/signal.h>
#include "asterisk/lock.h"
+#include "asterisk/causes.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
ast_channel_cc_params_init(chan, ast_channel_get_cc_config_params(owner));
- /* Make sure we inherit the ANSWERED_ELSEWHERE flag if it's set on the queue/dial call request in the dialplan */
- if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE)) {
- ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE);
+ /* Make sure we inherit the AST_CAUSE_ANSWERED_ELSEWHERE if it's set on the queue/dial call request in the dialplan */
+ if (ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
+ ast_channel_hangupcause_set(chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
/* copy the channel variables from the incoming channel to the outgoing channel */
isoutbound = IS_OUTBOUND(ast, p); /* just comparing pointer of ast */
- if (p->chan && ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE)) {
- ast_set_flag(ast_channel_flags(p->chan), AST_FLAG_ANSWERED_ELSEWHERE);
- ast_debug(2, "This local call has the ANSWERED_ELSEWHERE flag set.\n");
+ if (p->chan && ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
+ ast_channel_hangupcause_set(p->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
+ ast_debug(2, "This local call has AST_CAUSE_ANSWERED_ELSEWHERE set.\n");
}
if (isoutbound) {
ast_debug(1, "Asked to hangup channel that was not connected\n");
return 0;
}
- if (ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE) || ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
+ if (ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
ast_debug(1, "This call was answered elsewhere\n");
- if (ast_channel_hangupcause(ast) == AST_CAUSE_ANSWERED_ELSEWHERE) {
- ast_debug(1, "####### It's the cause code, buddy. The cause code!!!\n");
- }
append_history(p, "Cancel", "Call answered elsewhere");
p->answered_elsewhere = TRUE;
}
refresh_all_favorite(s); /* Update favicons in case of DND keys */
if (s->state == STATE_RINGING && sub->subtype == SUB_RING) {
send_no_ring(s);
- if (!ast_test_flag(ast_channel_flags(ast), AST_FLAG_ANSWERED_ELSEWHERE) && ast_channel_hangupcause(ast) != AST_CAUSE_ANSWERED_ELSEWHERE) {
+ if (ast_channel_hangupcause(ast) != AST_CAUSE_ANSWERED_ELSEWHERE) {
d->missed_call++;
write_history(s, 'i', 1);
}
/*! This is set to tell the channel not to generate DTMF begin frames, and
* to instead only generate END frames. */
AST_FLAG_END_DTMF_ONLY = (1 << 14),
- /*! Flag to show channels that this call is hangup due to the fact that the call
+ /* OBSOLETED in favor of AST_CAUSE_ANSWERED_ELSEWHERE
+ Flag to show channels that this call is hangup due to the fact that the call
was indeed answered, but in another channel */
- AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15),
+ /* AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15), */
/*! This flag indicates that on a masquerade, an active stream should not
* be carried over */
AST_FLAG_MASQ_NOSTREAM = (1 << 16),
ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF));
ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF));
ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY));
- ast_data_add_bool(tree, "ANSWERED_ELSEWHERE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE));
ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM));
ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN));
ast_data_add_bool(tree, "BRIDGE_HANGUP_DONT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_DONT));
ast_channel_queue_connected_line_update(chan, &connected_caller, NULL);
- /* setting this flag to generate a reason header in the cancel message to the ringing channel */
- ast_set_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE);
+ /* setting the HANGUPCAUSE so the ringing channel knows this call was not a missed call */
+ ast_channel_hangupcause_set(chan, AST_CAUSE_ANSWERED_ELSEWHERE);
if (ast_channel_masquerade(target, chan)) {
ast_log(LOG_WARNING, "Unable to masquerade '%s' into '%s'\n", chan_name,