[svn-commits] oej: branch oej/roibos-cng-support-1.8 r412026 - /team/oej/roibos-cng-support...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Apr 9 03:08:53 CDT 2014


Author: oej
Date: Wed Apr  9 03:08:44 2014
New Revision: 412026

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412026
Log:
Activate silence suppression on channels that are active with an owner.
Deactivate when reinvite says so.

Modified:
    team/oej/roibos-cng-support-1.8/channels/chan_sip.c

Modified: team/oej/roibos-cng-support-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/channels/chan_sip.c?view=diff&rev=412026&r1=412025&r2=412026
==============================================================================
--- team/oej/roibos-cng-support-1.8/channels/chan_sip.c (original)
+++ team/oej/roibos-cng-support-1.8/channels/chan_sip.c Wed Apr  9 03:08:44 2014
@@ -6913,6 +6913,9 @@
 		ast_rtp_instance_update_source(p->rtp);
 		res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, oldsdp, TRUE);
 		ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
+		/* If we've agreed on CN for this channel, try activating silence detection and suppression on it */
+		activate_silence_detection(p);
+	
 	}
 	sip_pvt_unlock(p);
 	return res;
@@ -7487,6 +7490,16 @@
 {
 	ast_debug(3, "SILDET: Checking if we need silence detection on %s\n", dialog->callid);
 
+	if (! dialog->jointnoncodeccapability & AST_RTP_CN) {
+		ast_debug(4, "SILDET: Channel does not support Comfort Noise on %s\n", dialog->callid);
+		/* If this is a re-invite that turns CN off, deactivate it. */
+		if (dialog->owner) {
+			ast_sildet_deactivate(dialog->owner);
+		}
+		return FALSE;
+	}
+
+
 	/* Check if we really want silence suppression */
 	if (!dialog || !dialog->rtp || !dialog->owner || !ast_test_flag(&dialog->flags[2], SIP_PAGE3_SILENCE_DETECTION)) {
 		ast_debug(3, "SILDET: Channel does not need silence suppression on %s\n", dialog->callid);
@@ -7722,10 +7735,6 @@
 			"Channel: %s\r\nUniqueid: %s\r\nChanneltype: %s\r\nSIPcallid: %s\r\nSIPfullcontact: %s\r\n",
 			tmp->name, tmp->uniqueid, "SIP", i->callid, i->fullcontact);
 
-KSLÖKJAÖLFKJLÖKJ
-	if( SKREP ) {
-		activate_silence_detection(i);
-	}
 
 	return tmp;
 }
@@ -9768,7 +9777,7 @@
 		struct ast_str *s2 = ast_str_alloca(SIPBUFSIZE);
 		struct ast_str *s3 = ast_str_alloca(SIPBUFSIZE);
 
-		ast_verbose("Non-codec capabilities (dtmf): us - %s, peer - %s, combined - %s\n",
+		ast_verbose("Non-codec capabilities (dtmf, cn): us - %s, peer - %s, combined - %s\n",
 			    ast_rtp_lookup_mime_multiple2(s1, p->noncodeccapability, 0, 0),
 			    ast_rtp_lookup_mime_multiple2(s2, peernoncodeccapability, 0, 0),
 			    ast_rtp_lookup_mime_multiple2(s3, newnoncodeccapability, 0, 0));
@@ -19413,7 +19422,7 @@
 			ast_cli(a->fd, "  Call-ID:                %s\n", cur->callid);
 			ast_cli(a->fd, "  Owner channel ID:       %s\n", cur->owner ? cur->owner->name : "<none>");
 			ast_cli(a->fd, "  Our Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->capability));
-			ast_cli(a->fd, "  Non-Codec Capability (DTMF):   %d\n", cur->noncodeccapability);
+			ast_cli(a->fd, "  Non-Codec Capability (DTMF, CN):   %d\n", cur->noncodeccapability);
 			ast_cli(a->fd, "  Their Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->peercapability));
 			ast_cli(a->fd, "  Joint Codec Capability:   %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->jointcapability));
 			ast_cli(a->fd, "  Format:                 %s\n", ast_getformatname_multiple(formatbuf, sizeof(formatbuf), cur->owner ? cur->owner->nativeformats : 0) );
@@ -21025,6 +21034,8 @@
 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
 			}
 			ast_rtp_instance_activate(p->rtp);
+			/* If we've agreed on CN for this channel, try activating silence detection and suppression on it */
+			activate_silence_detection(p);
 		} else {
 			/* Alcatel PBXs are known to send 183s with no SDP after sending
 			 * a 100 Trying response. We're just going to treat this sort of thing
@@ -21055,6 +21066,8 @@
 				}
 			}
 			ast_rtp_instance_activate(p->rtp);
+			/* If we've agreed on CN for this channel, try activating silence detection and suppression on it */
+			activate_silence_detection(p);
 		} else if (!reinvite) {
 			struct ast_sockaddr remote_address = {{0,}};
 
@@ -23880,6 +23893,7 @@
 			c_state = AST_STATE_UP;
 		}
 
+
 		switch(c_state) {
 		case AST_STATE_DOWN:
 			ast_debug(2, "%s: New call is still down.... Trying... \n", c->name);
@@ -26197,6 +26211,7 @@
 				if (ast_test_flag(&p->flags[0], SIP_DIRECT_MEDIA)) {
 					ast_queue_control(p->owner, AST_CONTROL_SRCCHANGE);
 				}
+SKREP
 			}
 			check_pendings(p);
 		} else if (p->glareinvite == seqno) {




More information about the svn-commits mailing list