[asterisk-commits] wdoekes: branch 1.8 r413949 - in /branches/1.8: ./ apps/ channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 15 10:32:49 CDT 2014


Author: wdoekes
Date: Thu May 15 10:32:35 2014
New Revision: 413949

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=413949
Log:
chan_local+app_dial: Propagagate call answered elsewhere over local channels.

AST_FLAG_ANSWERED_ELSEWHERE was not propagated back from local channels.
It is now. That means that when a call is picked up from a callgroup of
local channels, the other channels will now properly see it as "picked up".

This occurs when you use a construct like Dial(Local/a at context&Local/b at context)
where a at context and b at context dial two chan_sip devices respectively. If one
device picks up, the other will not see "1 missed call" anymore. In this
respect, it now behaves the same as when doing Dial(SIP/a&SIP/b).

Review: https://reviewboard.asterisk.org/r/3540/

Modified:
    branches/1.8/UPGRADE.txt
    branches/1.8/apps/app_dial.c
    branches/1.8/channels/chan_local.c

Modified: branches/1.8/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/UPGRADE.txt?view=diff&rev=413949&r1=413948&r2=413949
==============================================================================
--- branches/1.8/UPGRADE.txt (original)
+++ branches/1.8/UPGRADE.txt Thu May 15 10:32:35 2014
@@ -21,6 +21,9 @@
 from 1.8.27.0 to 1.8.28.0:
 * The asterisk command line -I option and the asterisk.conf internal_timing
   option are removed and always enabled if any timing module is loaded.
+* SIP (chan_sip) accounts dialed through a Local channel will now properly
+  hide the "1 missed call" if one of the other dialed accounts picks up the
+  call.
 
 from 1.8.26.0 to 1.8.27.0:
 * res_fax now returns the correct rates for V.27ter (4800 or 9600 bit/s).

Modified: branches/1.8/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_dial.c?view=diff&rev=413949&r1=413948&r2=413949
==============================================================================
--- branches/1.8/apps/app_dial.c (original)
+++ branches/1.8/apps/app_dial.c Thu May 15 10:32:35 2014
@@ -3025,7 +3025,9 @@
 	}
 
 	ast_channel_early_bridge(chan, NULL);
-	hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
+	/* When dialing local channels, the hangupcause of the parent channel
+	 * tells us whether the call was answered elsewhere. */
+	hanguptree(outgoing, NULL, chan->hangupcause == AST_CAUSE_ANSWERED_ELSEWHERE ? 1 : 0);
 	pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
 	senddialendevent(chan, pa.status);
 	ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);

Modified: branches/1.8/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_local.c?view=diff&rev=413949&r1=413948&r2=413949
==============================================================================
--- branches/1.8/channels/chan_local.c (original)
+++ branches/1.8/channels/chan_local.c Thu May 15 10:32:35 2014
@@ -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"
@@ -1018,6 +1019,7 @@
 	struct ast_frame f = { AST_FRAME_CONTROL, { AST_CONTROL_HANGUP }, .data.uint32 = ast->hangupcause };
 	struct ast_channel *owner = NULL;
 	struct ast_channel *chan = NULL;
+	int answered_elsewhere = 0;
 
 	if (!p) {
 		return -1;
@@ -1040,6 +1042,7 @@
 	isoutbound = IS_OUTBOUND(ast, p); /* just comparing pointer of ast */
 
 	if (p->chan && ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
+		answered_elsewhere = 1;
 		ast_set_flag(p->chan, AST_FLAG_ANSWERED_ELSEWHERE);
 		ast_debug(2, "This local call has the ANSWERED_ELSEWHERE flag set.\n");
 	}
@@ -1056,7 +1059,13 @@
 		p->chan = NULL;
 	} else {
 		if (p->chan) {
-			ast_queue_hangup(p->chan);
+			/* Use the hangupcause to propagate the fact that the
+			 * call was answered somewhere. */
+			if (answered_elsewhere) {
+				ast_queue_hangup_with_cause(p->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
+			} else {
+				ast_queue_hangup(p->chan);
+			}
 		}
 		p->owner = NULL;
 	}




More information about the asterisk-commits mailing list