[asterisk-commits] oej: branch oej/roibos-cng-support-1.8 r412025 - in /team/oej/roibos-cng-supp...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 9 02:39:13 CDT 2014


Author: oej
Date: Wed Apr  9 02:39:02 2014
New Revision: 412025

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=412025
Log:
Cleaning up loose ends and writing some docs

Modified:
    team/oej/roibos-cng-support-1.8/channels/chan_sip.c
    team/oej/roibos-cng-support-1.8/channels/sip/include/sip.h
    team/oej/roibos-cng-support-1.8/configs/sip.conf.sample
    team/oej/roibos-cng-support-1.8/funcs/func_frame_trace.c
    team/oej/roibos-cng-support-1.8/include/asterisk/audiohook.h
    team/oej/roibos-cng-support-1.8/include/asterisk/frame.h
    team/oej/roibos-cng-support-1.8/main/audiohook.c
    team/oej/roibos-cng-support-1.8/main/channel.c
    team/oej/roibos-cng-support-1.8/main/frame.c
    team/oej/roibos-cng-support-1.8/main/silencedetection.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=412025&r1=412024&r2=412025
==============================================================================
--- 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 02:39:02 2014
@@ -7481,8 +7481,8 @@
 }
 
 
-/*! \brief Activates a DSP to detect silence, something we can use to suppress silent RTP packets
-	and send CNG (comfort noise generation) requests instead */
+/*! \brief Activates a DSP to detect silence, and suppress silent frames
+	and send CNG (comfort noise generation) requests at start of silence instead */
 static int activate_silence_detection(struct sip_pvt *dialog)
 {
 	ast_debug(3, "SILDET: Checking if we need silence detection on %s\n", dialog->callid);
@@ -7497,14 +7497,6 @@
 
 		/* We now have a call where we have a DSP. The rest of the magic is happening somewhere else in chan_sip. */
 		ast_debug(3, "SILDET: Activated silence suppression on call %s\n", dialog->callid);
-#ifdef ISTHISNEEDED
-		if ((res = ast_set_read_format(dialog->owner, AST_FORMAT_SLINEAR)) < 0) {
-			/* Put channel in the right codec mode: SLINEAR */
-			ast_log(LOG_WARNING, "Unable to set channel to linear mode, giving up\n");
-			ast_sildet_deactivate(dialog->owner);
-			return FALSE;
-		}
-#endif
 	} else {
 		ast_debug(3, "SILDET: Failed to activate silence detection on call %s\n", dialog->callid);
 	}
@@ -7730,7 +7722,10 @@
 			"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);
 
-	activate_silence_detection(i);
+KSLÖKJAÖLFKJLÖKJ
+	if( SKREP ) {
+		activate_silence_detection(i);
+	}
 
 	return tmp;
 }
@@ -18897,7 +18892,6 @@
 				"Disabled");
 	ast_cli(a->fd, "  Videosupport:           %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT)));
 	ast_cli(a->fd, "  Textsupport:            %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT)));
-	ast_cli(a->fd, "  Comfort Noise:          %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOW_CN)));
 	ast_cli(a->fd, "  Ignore SDP sess. ver.:  %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_IGNORESDPVERSION)));
 	ast_cli(a->fd, "  AutoCreate Peer:        %s\n", AST_CLI_YESNO(sip_cfg.autocreatepeer));
 	ast_cli(a->fd, "  Match Auth Username:    %s\n", AST_CLI_YESNO(global_match_auth_username));
@@ -19056,9 +19050,10 @@
 	ast_cli(a->fd, "  DTMF:                   %s\n", dtmfmode2str(ast_test_flag(&global_flags[0], SIP_DTMF)));
 	ast_cli(a->fd, "  Qualify:                %d\n", default_qualify);
 	ast_cli(a->fd, "  Use ClientCode:         %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_USECLIENTCODE)));
-	ast_cli(a->fd, "  Silence detection:      %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[2], SIP_PAGE3_SILENCE_DETECTION)));
-	ast_cli(a->fd, "  Silence level: 	  %d\n", sip_cfg.silencelevel);
-	ast_cli(a->fd, "  Silence frames: 	  %d\n", sip_cfg.silenceframes);
+	ast_cli(a->fd, "  Comfort Noise:          %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[1], SIP_PAGE2_ALLOW_CN)));
+	ast_cli(a->fd, "  Silence suppression:    %s\n", AST_CLI_YESNO(ast_test_flag(&global_flags[2], SIP_PAGE3_SILENCE_DETECTION)));
+	ast_cli(a->fd, "  Silence threshold:      %d\n", sip_cfg.silencelevel);
+	ast_cli(a->fd, "  Silence frames:         %d\n", sip_cfg.silenceframes);
 	ast_cli(a->fd, "  Progress inband:        %s\n", (ast_test_flag(&global_flags[0], SIP_PROG_INBAND) == SIP_PROG_INBAND_NEVER) ? "Never" : (AST_CLI_YESNO(ast_test_flag(&global_flags[0], SIP_PROG_INBAND) != SIP_PROG_INBAND_NO)));
 	ast_cli(a->fd, "  Language:               %s\n", default_language);
 	ast_cli(a->fd, "  MOH Interpret:          %s\n", default_mohinterpret);
@@ -27862,7 +27857,7 @@
 	} else if (!strcasecmp(v->name, "buggymwi")) {
 		ast_set_flag(&mask[1], SIP_PAGE2_BUGGY_MWI);
 		ast_set2_flag(&flags[1], ast_true(v->value), SIP_PAGE2_BUGGY_MWI);
- 	} else if (!strcasecmp(v->name, "silencedetection")) {
+ 	} else if (!strcasecmp(v->name, "silencesuppression")) {
  		ast_set_flag(&mask[2], SIP_PAGE3_SILENCE_DETECTION);
  		ast_set2_flag(&flags[2], ast_true(v->value), SIP_PAGE3_SILENCE_DETECTION);
 	} else if (!strcasecmp(v->name, "comfort-noise")) {

Modified: team/oej/roibos-cng-support-1.8/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/channels/sip/include/sip.h?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/channels/sip/include/sip.h (original)
+++ team/oej/roibos-cng-support-1.8/channels/sip/include/sip.h Wed Apr  9 02:39:02 2014
@@ -62,7 +62,7 @@
 #define DEFAULT_AUTHLIMIT            100
 #define DEFAULT_AUTHTIMEOUT          30
 #define DEFAULT_SILENCELEVEL	     100
-#define DEFAULT_SILENCEFRAMES	     7   /* Number of frames of silence to let through before we start suppressing it */
+#define DEFAULT_SILENCEFRAMES	     10   /* Number of frames of silence to let through before we start suppressing it */
 
 /* guard limit must be larger than guard secs */
 /* guard min must be < 1000, and should be >= 250 */

Modified: team/oej/roibos-cng-support-1.8/configs/sip.conf.sample
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/configs/sip.conf.sample?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/configs/sip.conf.sample (original)
+++ team/oej/roibos-cng-support-1.8/configs/sip.conf.sample Wed Apr  9 02:39:02 2014
@@ -300,12 +300,6 @@
 ;allow=ulaw                     ; Allow codecs in order of preference
 ;allow=ilbc                     ; see https://wiki.asterisk.org/wiki/display/AST/RTP+Packetization
 				; for framing options
-;comfort-noise=yes		; Enable Comfort Noise generation on RTP streams
-;				; Available per device too
-;				; Generating comfort noise is a burden to your CPU
-;				; This should not be enabled on low-end devices.
-;				; You should not enable this unless you have internal
-;				; timing support enabled in asterisk.conf
 ;autoframing=yes		; Set packetization based on the remote endpoint's (ptime)
 				; preferences. Defaults to no.
 ;
@@ -548,16 +542,29 @@
 ; The silence detection assigns a software DSP to each channel and converts all audio into
 ; signed linear in order to be able to detect silence. This will require a lot of CPU
 ; per channel including transcoding. 
-; This is only settable in [general] right now, but should be settable per channel
-;silencedetection = YES		; Enable silence detection - by default turned off.
+;
+; You can decide to enable comfort-noise and disable silencesuppression. In this case, Asterisk
+; will negotitate comfort noise and accept it coming in, but since there is no DSP on the channel
+; Asterisk will never send any CN packet and suppress audio.
+;
+; Enabling silencesuppression and comfort noise will save a lot of bandwidth in your calls. There
+; will only be RTP flows when someone is speaking.
+;
+;silencesuppression = YES	; Enable silence suppression - by default turned off.
 ;				; settable per device too
-;				; You want to enable comfort noise too
-;silencelevel = 850		; Silence detection noise level - below this is considered silent.
-				; Default = 850
-;silenceperiod = 2		; How many frames of silence should we get before we supress
+;				; You want to enable comfort noise too. Default is off.
+;silencelevel = 100		; Silence detection noise level - below this is considered silent.
+				; Default = 100
+;silenceperiod = 10		; How many frames of silence should we get before we supress
 				; audio. Consider packetization. A normal ALAW stream has 20 ms audio
-				; per RTP packet. 2 means we will start sending CNG at the third silent
-				; packet, after 40 ms of silence.
+				; per RTP packet. A value of 2 means we will start sending CNG at the third silent
+				; packet, after 40 ms of silence. Default is 10 frames.
+;comfort-noise=yes		; Enable Comfort Noise generation on RTP streams.
+;				; Default is off
+;				; Available per device too
+;				; Generating comfort noise is a burden to your CPU
+;				; This should not be enabled on low-end devices.
+;				; You should not enable this unless you have a timer.
 
 ;--------------------------- SIP Session-Timers (RFC 4028)------------------------------------
 ; SIP Session-Timers provide an end-to-end keep-alive mechanism for active SIP sessions.

Modified: team/oej/roibos-cng-support-1.8/funcs/func_frame_trace.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/funcs/func_frame_trace.c?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/funcs/func_frame_trace.c (original)
+++ team/oej/roibos-cng-support-1.8/funcs/func_frame_trace.c Wed Apr  9 02:39:02 2014
@@ -357,9 +357,6 @@
 	case AST_FRAME_MODEM:
 		ast_verbose("FrameType: MODEM\n");
 		break;
-	case AST_FRAME_DROP:
-		ast_verbose("FrameType: DROP\n");
-		break;
 	case AST_FRAME_DTMF_BEGIN:
 		ast_verbose("FrameType: DTMF BEGIN\n");
 		ast_verbose("Digit: %d\n", frame->subclass.integer);

Modified: team/oej/roibos-cng-support-1.8/include/asterisk/audiohook.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/include/asterisk/audiohook.h?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/include/asterisk/audiohook.h (original)
+++ team/oej/roibos-cng-support-1.8/include/asterisk/audiohook.h Wed Apr  9 02:39:02 2014
@@ -37,7 +37,6 @@
 	AST_AUDIOHOOK_TYPE_SPY = 0,    /*!< Audiohook wants to receive audio */
 	AST_AUDIOHOOK_TYPE_WHISPER,    /*!< Audiohook wants to provide audio to be mixed with existing audio */
 	AST_AUDIOHOOK_TYPE_MANIPULATE, /*!< Audiohook wants to manipulate the audio */
-	AST_AUDIOHOOK_TYPE_SILDET,     /*!< Audiohook to detect silence. That's all */
 };
 
 enum ast_audiohook_status {

Modified: team/oej/roibos-cng-support-1.8/include/asterisk/frame.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/include/asterisk/frame.h?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/include/asterisk/frame.h (original)
+++ team/oej/roibos-cng-support-1.8/include/asterisk/frame.h Wed Apr  9 02:39:02 2014
@@ -124,8 +124,6 @@
 	AST_FRAME_MODEM,	
 	/*! DTMF begin event, subclass is the digit */
 	AST_FRAME_DTMF_BEGIN,
-	/*! A frame that needs to be killed, dropped or just silently ignored */
-	AST_FRAME_DROP,
 };
 #define AST_FRAME_DTMF AST_FRAME_DTMF_END
 

Modified: team/oej/roibos-cng-support-1.8/main/audiohook.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/main/audiohook.c?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/main/audiohook.c (original)
+++ team/oej/roibos-cng-support-1.8/main/audiohook.c Wed Apr  9 02:39:02 2014
@@ -712,7 +712,7 @@
 				 * be taken here to exit early. */
 			}
 			ast_audiohook_unlock(audiohook);
-			if (middle_frame->frametype == AST_FRAME_DROP) {
+			if (middle_frame->frametype == AST_FRAME_NULL) {
 				/* This frame is going nowhere after this */
 				needsdrop = 1;
 			}

Modified: team/oej/roibos-cng-support-1.8/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/main/channel.c?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/main/channel.c (original)
+++ team/oej/roibos-cng-support-1.8/main/channel.c Wed Apr  9 02:39:02 2014
@@ -1836,7 +1836,6 @@
 	case AST_FRAME_IAX:
 	case AST_FRAME_CNG:
 	case AST_FRAME_MODEM:
-	case AST_FRAME_DROP:
 		return 0;
 	}
 	return 0;
@@ -3059,7 +3058,6 @@
 				case AST_FRAME_IAX:
 				case AST_FRAME_NULL:
 				case AST_FRAME_CNG:
-				case AST_FRAME_DROP:
 					break;
 				}
 

Modified: team/oej/roibos-cng-support-1.8/main/frame.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/main/frame.c?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/main/frame.c (original)
+++ team/oej/roibos-cng-support-1.8/main/frame.c Wed Apr  9 02:39:02 2014
@@ -127,6 +127,7 @@
 	{ AST_FORMAT_TESTLAW, "testlaw", 8000, "G.711 test-law", 80, 10, 150, 10, 20 },                        /*!< codec_ulaw.c */
 	{ AST_FORMAT_G719, "g719", 48000, "ITU G.719", 160, 20, 80, 20, 20 },
 	{ AST_FORMAT_CN, "cn", 8000, "Comfort Noise"},
+	/* We will need cn in 16000, 8000, 32000 and 48000 hertz too. */
 };
 
 struct ast_frame ast_null_frame = { AST_FRAME_NULL, };

Modified: team/oej/roibos-cng-support-1.8/main/silencedetection.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/roibos-cng-support-1.8/main/silencedetection.c?view=diff&rev=412025&r1=412024&r2=412025
==============================================================================
--- team/oej/roibos-cng-support-1.8/main/silencedetection.c (original)
+++ team/oej/roibos-cng-support-1.8/main/silencedetection.c Wed Apr  9 02:39:02 2014
@@ -60,9 +60,9 @@
 	struct ast_audiohook audiohook;
 	struct ast_dsp *dsp;			/*!< DSP used for silence detection */
 	unsigned int silencelevel;		/*!< Silence treshold */
-        unsigned int silenceframes;		/*!< How many frames to wait for silence before activating silence
-							support and sending CNG */
-        unsigned int silencecounter;		/*!< Frame Counter used for silence detection. */
+	unsigned int silenceframes;		/*!< How many frames to wait for silence before activating silence
+						support and sending CNG */
+	unsigned int silencecounter;		/*!< Frame Counter used for silence detection. */
 	int detect;				/*!< Silence detected */
 	int active;
 };
@@ -155,7 +155,7 @@
         				frame->samples = 0;
 					frame->datalen = 0;
 					
-					frame->frametype = AST_FRAME_DROP;
+					frame->frametype = AST_FRAME_NULL;
 					ast_channel_unlock(chan);
 					return 0;	/* Return TRUE since we manipulated the frame */
 				}




More information about the asterisk-commits mailing list