[asterisk-commits] mmichelson: branch group/CCSS r246541 - /team/group/CCSS/apps/app_dial.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Feb 12 14:41:49 CST 2010
Author: mmichelson
Date: Fri Feb 12 14:41:45 2010
New Revision: 246541
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=246541
Log:
Fix logic with regards to ringing and CC in app_dial.
The large XXX comment in the source sums it up well, but
here's the short version. Basically, we can't send a ringing
frame to the caller unless we have either received a CC frame
from one of the called parties, all called parties have sent
ringing frames, or CC is disabled for the call.
Modified:
team/group/CCSS/apps/app_dial.c
Modified: team/group/CCSS/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=246541&r1=246540&r2=246541
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Fri Feb 12 14:41:45 2010
@@ -924,6 +924,8 @@
struct ast_str *featurecode = ast_str_alloca(FEATURE_MAX_LEN + 1);
int cc_recall_core_id;
int is_cc_recall;
+ int cc_frame_received = 0;
+ int num_ringing = 0;
ast_party_connected_line_init(&connected_caller);
if (single) {
@@ -1109,20 +1111,18 @@
handle_cause(AST_CAUSE_CONGESTION, &num);
break;
case AST_CONTROL_RINGING:
- /* XXX TODO This is a tricky area to get right when using a native
+ /* XXX This is a tricky area to get right when using a native
* CC agent. The reason is that we do the best we can to send only a
- * single ringing notification to the caller. The logic here now will
- * send the first ringing notification to the caller and drop all
- * others.
+ * single ringing notification to the caller. *
*
- * This may not work so well when CC is involved. CCNR is typically
+ * Call completion complicates the logic used here. CCNR is typically
* offered during a ringing message. Let's say that party A calls
* parties B, C, and D. B and C do not support CC requests, but D
* does. If we were to receive a ringing notification from B before
* the others, then we would end up sending a ringing message to
* A with no CCNR offer present.
*
- * The approach that should be taken is that if we receive a ringing
+ * The approach that we have taken is that if we receive a ringing
* response from a party and no CCNR offer is present, we need to
* wait. Specifically, we need to wait until either a) a called party
* offers CCNR in its ringing response or b) all called parties have
@@ -1132,14 +1132,20 @@
* response or, god forbid, one just plain doesn't respond to our
* outgoing call, then this will result in a significant delay between
* when the caller places the call and hears ringback.
+ *
+ * Note also that if CC is disabled for this call, then it is perfectly
+ * fine for ringing frames to get sent through.
*/
- ast_verb(3, "%s is ringing\n", c->name);
- /* Setup early media if appropriate */
- if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
- ast_channel_early_bridge(in, c);
- if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK) && ast_strlen_zero(opt_args[OPT_ARG_RINGBACK])) {
- ast_indicate(in, AST_CONTROL_RINGING);
- pa->sentringing++;
+ ++num_ringing;
+ if (ignore_cc || cc_frame_received || num_ringing == numlines) {
+ ast_verb(3, "%s is ringing\n", c->name);
+ /* Setup early media if appropriate */
+ if (single && CAN_EARLY_BRIDGE(peerflags, in, c))
+ ast_channel_early_bridge(in, c);
+ if (!(pa->sentringing) && !ast_test_flag64(outgoing, OPT_MUSICBACK) && ast_strlen_zero(opt_args[OPT_ARG_RINGBACK])) {
+ ast_indicate(in, AST_CONTROL_RINGING);
+ pa->sentringing++;
+ }
}
break;
case AST_CONTROL_PROGRESS:
@@ -1211,6 +1217,7 @@
case AST_CONTROL_CC:
if (!ignore_cc) {
ast_handle_cc_control_frame(in, c, f->data.ptr);
+ cc_frame_received = 1;
}
break;
case -1:
More information about the asterisk-commits
mailing list