[asterisk-commits] oej: branch oej/cancel_answer_elsewhere r66436 -
in /team/oej/cancel_answer_e...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue May 29 09:39:41 MST 2007
Author: oej
Date: Tue May 29 11:39:41 2007
New Revision: 66436
URL: http://svn.digium.com/view/asterisk?view=rev&rev=66436
Log:
First try... May, but only may, work with SNOM phones...
Modified:
team/oej/cancel_answer_elsewhere/apps/app_dial.c
team/oej/cancel_answer_elsewhere/channels/chan_sip.c
team/oej/cancel_answer_elsewhere/include/asterisk/channel.h
Modified: team/oej/cancel_answer_elsewhere/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/cancel_answer_elsewhere/apps/app_dial.c?view=diff&rev=66436&r1=66435&r2=66436
==============================================================================
--- team/oej/cancel_answer_elsewhere/apps/app_dial.c (original)
+++ team/oej/cancel_answer_elsewhere/apps/app_dial.c Tue May 29 11:39:41 2007
@@ -302,14 +302,17 @@
};
-static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception)
+static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception, int answered_elsewhere)
{
/* Hang up a tree of stuff */
struct chanlist *oo;
while (outgoing) {
/* Hangup any existing lines we have open */
- if (outgoing->chan && (outgoing->chan != exception))
+ if (outgoing->chan && (outgoing->chan != exception)) {
+ if (answered_elsewhere)
+ ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
ast_hangup(outgoing->chan);
+ }
oo = outgoing;
outgoing=outgoing->next;
free(oo);
@@ -1510,7 +1513,7 @@
/* Ah ha! Someone answered within the desired timeframe. Of course after this
we will always return with -1 so that it is hung up properly after the
conversation. */
- hanguptree(outgoing, peer);
+ hanguptree(outgoing, peer, 1);
outgoing = NULL;
/* If appropriate, log that we have a destination channel */
if (chan->cdr)
@@ -1560,7 +1563,7 @@
ast_parseable_goto(peer, opt_args[OPT_ARG_GOTO]);
peer->priority++;
ast_pbx_start(peer);
- hanguptree(outgoing, NULL);
+ hanguptree(outgoing, NULL, 0);
if (continue_exec)
*continue_exec = 1;
res = 0;
@@ -1721,7 +1724,7 @@
ast_indicate(chan, -1);
}
ast_channel_early_bridge(chan, NULL);
- hanguptree(outgoing, NULL);
+ hanguptree(outgoing, NULL, 0);
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
senddialendevent(chan, pa.status);
if (option_debug)
Modified: team/oej/cancel_answer_elsewhere/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/cancel_answer_elsewhere/channels/chan_sip.c?view=diff&rev=66436&r1=66435&r2=66436
==============================================================================
--- team/oej/cancel_answer_elsewhere/channels/chan_sip.c (original)
+++ team/oej/cancel_answer_elsewhere/channels/chan_sip.c Tue May 29 11:39:41 2007
@@ -3691,6 +3691,11 @@
ast_log(LOG_DEBUG, "Asked to hangup channel that was not connected\n");
return 0;
}
+ if (ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
+ if (option_debug)
+ ast_log(LOG_DEBUG, "This call was answered elsewhere");
+ append_history(p, "Cancel", "Call answered elsewhere");
+ }
if (ast_test_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER)) {
if (ast_test_flag(&p->flags[0], SIP_INC_COUNT)) {
@@ -8206,6 +8211,9 @@
p->invitestate = INV_CONFIRMED;
reqprep(&resp, p, sipmethod, seqno, newbranch);
+ if (sipmethod == SIP_CANCEL && p->owner && ast_test_flag(p->owner, AST_FLAG_ANSWERED_ELSEWHERE))
+ add_header(&resp, "Reason:", "SIP;cause=200;text=\"Call completed elsewhere\"");
+
add_header_contentLength(&resp, 0);
return send_request(p, &resp, reliable, seqno ? seqno : p->ocseq);
}
Modified: team/oej/cancel_answer_elsewhere/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/cancel_answer_elsewhere/include/asterisk/channel.h?view=diff&rev=66436&r1=66435&r2=66436
==============================================================================
--- team/oej/cancel_answer_elsewhere/include/asterisk/channel.h (original)
+++ team/oej/cancel_answer_elsewhere/include/asterisk/channel.h Tue May 29 11:39:41 2007
@@ -539,6 +539,9 @@
/*! 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
+ was indeed anwered, but in another channel */
+ AST_FLAG_ANSWERED_ELSEWHERE = (1 << 15),
};
/*! \brief ast_bridge_config flags */
More information about the asterisk-commits
mailing list