[svn-commits] mattf: branch mattf/bug13495 r160767 - /team/mattf/bug13495/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 3 15:47:41 CST 2008


Author: mattf
Date: Wed Dec  3 15:47:40 2008
New Revision: 160767

URL: http://svn.digium.com/view/asterisk?view=rev&rev=160767
Log:
Remainder of patches attached to #13495 (echo control variables)

Modified:
    team/mattf/bug13495/channels/chan_dahdi.c

Modified: team/mattf/bug13495/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/mattf/bug13495/channels/chan_dahdi.c?view=diff&rev=160767&r1=160766&r2=160767
==============================================================================
--- team/mattf/bug13495/channels/chan_dahdi.c (original)
+++ team/mattf/bug13495/channels/chan_dahdi.c Wed Dec  3 15:47:40 2008
@@ -383,6 +383,8 @@
 
 #define LINKSET_FLAG_EXPLICITACM	(1 << 0)
 #define LINKSET_FLAG_INITIALHWBLO	(1 << 1)
+#define LINKSET_FLAG_USEECHOCONTROL	(1 << 2)
+#define LINKSET_FLAG_DEFAULTECHOCONTROL (1 << 3)
 
 #define SS7_BLOCKED_MAINTENANCE	(1 << 0)
 #define SS7_BLOCKED_HARDWARE	(1 << 1)
@@ -658,6 +660,7 @@
 #if HAVE_SS7
 	unsigned int do_hangup; /* what have to do in chan_dahdi */
 	unsigned int called_complete;
+	unsigned int echocontrol_ind;
 #endif
 	unsigned int use_smdi:1;		/* Whether to use SMDI on this channel */
 	struct mwisend_info mwisend_data;
@@ -2749,6 +2752,8 @@
 			}
 		}
 		
+		isup_set_echocontrol(p->ss7call, (p->ss7->flags & LINKSET_FLAG_DEFAULTECHOCONTROL) ? 1 : 0);
+		
 		ast_channel_unlock(ast);
 
 		isup_iam(p->ss7->ss7, p->ss7call);
@@ -6190,7 +6195,9 @@
 					p->progress = 1;
 					ss7_rel(p->ss7);
 					/* enable echo canceler here on SS7 calls */
-					dahdi_enable_ec(p);
+					if(!p->echocontrol_ind || !(p->ss7->flags & LINKSET_FLAG_USEECHOCONTROL)) {
+						dahdi_enable_ec(p);
+					}
 
 				}
 			}
@@ -9933,6 +9940,8 @@
 	if (res < 0) 
 		ast_log(LOG_WARNING, "Unable to set law on channel %d\n", p->channel);
 	
+	isup_set_echocontrol(p->ss7call, (linkset->flags & LINKSET_FLAG_DEFAULTECHOCONTROL) ? 1 : 0);
+	
 	if (!(linkset->flags & LINKSET_FLAG_EXPLICITACM)) {
 		p->proceeding = 1;
 		isup_acm(ss7, p->ss7call);
@@ -9950,7 +9959,9 @@
 	} else
 		ast_verb(3, "Accepting call to '%s' on CIC %d\n", p->exten, p->cic);
 
-	dahdi_enable_ec(p);
+	 if(!p->echocontrol_ind || !(p->ss7->flags & LINKSET_FLAG_USEECHOCONTROL)) {
+		dahdi_enable_ec(p);
+	 }
 
 	/* We only reference these variables in the context of the ss7_linkset function
 	 * when receiving either and IAM or a COT message.  Since they are only accessed
@@ -10615,6 +10626,7 @@
 				if (e->iam.cot_check_required)
 						dahdi_loopback(p, 1);
 
+				p->echocontrol_ind = e->iam.echocontrol_ind;
 ss7_start_switch:
 				if (option_verbose > 2)
 					ast_verbose("SS7 exten: %s complete: %i\n", p->exten, p->called_complete);
@@ -10645,12 +10657,8 @@
 				if (p->loopedback) {
 					dahdi_loopback(p, 0);
 					/* Don't start call if we didn't get IAM or COT failed! */
-					if (e->cot.got_sent_msg & ISUP_GOT_IAM) {
-						if (e->cot.passed | p->called_complete) {
-							ss7_start_call(p, linkset);
-						}
-					} else
-						isup_clear_callflags(ss7, p->ss7call, ISUP_GOT_IAM); /* We will get a new IAM if COT failed */
+					if ((e->cot.got_sent_msg & ISUP_GOT_IAM) && e->cot.passed && p->called_complete)
+						ss7_start_call(p, linkset);
 				}
 				p->ss7call = isup_free_call_if_clear(ss7, p->ss7call);
 
@@ -10902,13 +10910,15 @@
 				} else {
 					p = linkset->pvts[chanpos];
 					ast_mutex_lock(&p->lock);
-					p->ss7call = (e->e == ISUP_EVENT_ANM) ?  e->anm.call : e->anm.call;
+					p->ss7call = (e->e == ISUP_EVENT_ANM) ?  e->anm.call : e->con.call;
 					p->subs[SUB_REAL].needanswer = 1;
 					if (p->dsp && p->dsp_features) {
 						ast_dsp_set_features(p->dsp, p->dsp_features);
 						p->dsp_features = 0;
 					}
-					dahdi_enable_ec(p);
+					if ((e->e == ISUP_EVENT_ANM) ? !e->anm.echocontrol_ind  : !e->con.echocontrol_ind || !(linkset->flags & LINKSET_FLAG_USEECHOCONTROL)) {
+						dahdi_enable_ec(p);
+					}
 					ast_mutex_unlock(&p->lock);
 				}
 				break;
@@ -14932,6 +14942,7 @@
 	if (linksets[linkset-1].ss7)
 		ss7 = &linksets[linkset-1];
 
+	ast_cli(a->fd, "SS7 flags: 0x%x\n", ss7->flags);
 	ast_cli(a->fd, "SS7 linkset %d status: %s\n", linkset, (ss7->state == LINKSET_STATE_UP) ? "Up" : "Down");
 	ast_cli(a->fd, "SS7 calling nai: %i\n", ss7->calling_nai);
 	ast_cli(a->fd, "SS7 called nai: %i\n", ss7->called_nai);
@@ -16236,6 +16247,24 @@
 				}
 				if (ast_true(v->value))
 					link->flags |= LINKSET_FLAG_INITIALHWBLO;
+			} else if (!strcasecmp(v->name, "ss7_use_echocontrol")) {
+				struct dahdi_ss7 *link;
+				link = ss7_resolve_linkset(cur_linkset);
+				if (!link) {
+					ast_log(LOG_ERROR, "Invalid linkset number.  Must be between 1 and %d\n", NUM_SPANS + 1);
+					return -1;
+				}
+				if (ast_true(v->value))
+					link->flags |= LINKSET_FLAG_USEECHOCONTROL;
+			} else if (!strcasecmp(v->name, "ss7_default_echocontrol")) {
+				struct dahdi_ss7 *link;
+				link = ss7_resolve_linkset(cur_linkset);
+				if (!link) {
+					ast_log(LOG_ERROR, "Invalid linkset number.  Must be between 1 and %d\n", NUM_SPANS + 1);
+					return -1;
+				}
+				if (ast_true(v->value))
+					link->flags |= LINKSET_FLAG_DEFAULTECHOCONTROL;
 			} else if (!strncasecmp(v->name, "isup_timer", 10)) {
 				struct dahdi_ss7 *link;
 				link = ss7_resolve_linkset(cur_linkset);




More information about the svn-commits mailing list