[asterisk-commits] kmoore: trunk r368519 - in /trunk: apps/ channels/ include/asterisk/ main/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 5 09:41:56 CDT 2012
Author: kmoore
Date: Tue Jun 5 09:41:43 2012
New Revision: 368519
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368519
Log:
Convert AST_FLAG_ANSWERED_ELSEWHERE usage to AST_CAUSE_ANSWERED_ELSEWHERE
This was essentially duplicated functionality where normal channels used
AST_CAUSE_ANSWERED_ELSEWHERE while local channels and queues used
AST_FLAG_ANSWERED_ELSEWHERE. This removes the flag and converts that usage
into AST_CAUSE_ANSWERED_ELSEWHER usage.
Review: https://reviewboard.asterisk.org/r/1944
Patch-by: Birger Harzenetter
Modified:
trunk/apps/app_dial.c
trunk/apps/app_queue.c
trunk/channels/chan_local.c
trunk/channels/chan_sip.c
trunk/channels/chan_unistim.c
trunk/include/asterisk/channel.h
trunk/main/channel_internal_api.c
trunk/main/features.c
Modified: trunk/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_dial.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Tue Jun 5 09:41:43 2012
@@ -133,8 +133,7 @@
<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
@@ -727,8 +726,6 @@
/* 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);
}
@@ -2515,12 +2512,12 @@
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 */
@@ -3079,11 +3076,11 @@
}
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)));
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Tue Jun 5 09:41:43 2012
@@ -3103,7 +3103,7 @@
/* 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);
}
@@ -3357,7 +3357,7 @@
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)");
@@ -4825,10 +4825,10 @@
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;
}
Modified: trunk/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_local.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Tue Jun 5 09:41:43 2012
@@ -37,6 +37,7 @@
#include <sys/signal.h>
#include "asterisk/lock.h"
+#include "asterisk/causes.h"
#include "asterisk/channel.h"
#include "asterisk/config.h"
#include "asterisk/module.h"
@@ -909,9 +910,9 @@
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 */
@@ -1028,9 +1029,9 @@
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) {
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jun 5 09:41:43 2012
@@ -6369,11 +6369,8 @@
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;
}
Modified: trunk/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_unistim.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/channels/chan_unistim.c (original)
+++ trunk/channels/chan_unistim.c Tue Jun 5 09:41:43 2012
@@ -4856,7 +4856,7 @@
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);
}
Modified: trunk/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/channel.h?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/include/asterisk/channel.h (original)
+++ trunk/include/asterisk/channel.h Tue Jun 5 09:41:43 2012
@@ -835,9 +835,10 @@
/*! 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),
Modified: trunk/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel_internal_api.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/main/channel_internal_api.c (original)
+++ trunk/main/channel_internal_api.c Tue Jun 5 09:41:43 2012
@@ -250,7 +250,6 @@
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));
Modified: trunk/main/features.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/features.c?view=diff&rev=368519&r1=368518&r2=368519
==============================================================================
--- trunk/main/features.c (original)
+++ trunk/main/features.c Tue Jun 5 09:41:43 2012
@@ -7690,8 +7690,8 @@
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,
More information about the asterisk-commits
mailing list