[asterisk-commits] oej: branch oej/silence-detection-games-1.8 r411910 - in /team/oej/silence-de...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Apr 8 01:21:37 CDT 2014
Author: oej
Date: Tue Apr 8 01:21:33 2014
New Revision: 411910
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=411910
Log:
We just love debugging. More debugging. Fil them log files.
Modified:
team/oej/silence-detection-games-1.8/channels/chan_sip.c
team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h
Modified: team/oej/silence-detection-games-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/silence-detection-games-1.8/channels/chan_sip.c?view=diff&rev=411910&r1=411909&r2=411910
==============================================================================
--- team/oej/silence-detection-games-1.8/channels/chan_sip.c (original)
+++ team/oej/silence-detection-games-1.8/channels/chan_sip.c Tue Apr 8 01:21:33 2014
@@ -7465,28 +7465,26 @@
static int activate_silence_detection(struct sip_pvt *dialog)
{
int res = 0;
- ast_debug(3, "Checking if we need silence detection on %s\n", dialog->callid);
+ ast_debug(3, "SILDET: Checking if we need silence detection on %s\n", dialog->callid);
/* 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: Do not need silence detection on %s\n", dialog->callid);
return FALSE;
}
- /* Allocate a new DSP */
-
- /* Create the silence detector */
- /* Put channel in the right codec mode: SLINEAR
- This is for this first version. Later on we'll introduce a framehook that listens
- to a converted frame stream. After that we want the codecs themselves (when involved)
- to be able to tell us if something is silent without having to transcode first.
- */
- if ((res = ast_set_read_format(dialog->owner, AST_FORMAT_SLINEAR)) < 0) {
- ast_log(LOG_WARNING, "Unable to set channel to linear mode, giving up\n");
- return FALSE;
- }
- ast_sildet_activate(dialog->owner, dialog->silencelevel, dialog->silenceframes);
-
- /* 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, "Activated silence detection on call %s\n", dialog->callid);
+
+ if(ast_sildet_activate(dialog->owner, dialog->silencelevel, dialog->silenceframes)) {
+
+ /* 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 detection on call %s\n", dialog->callid);
+ 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");
+ return FALSE;
+ }
+ } else {
+ ast_debug(3, "SILDET: Failed to activate silence detection on call %s\n", dialog->callid);
+ }
return TRUE;
}
Modified: team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h?view=diff&rev=411910&r1=411909&r2=411910
==============================================================================
--- team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h (original)
+++ team/oej/silence-detection-games-1.8/include/asterisk/silencedetection.h Tue Apr 8 01:21:33 2014
@@ -31,7 +31,7 @@
\param silencelevel Audio treshold for silence
\param silenceframes Number of frames before we react
*/
-int ast_sildet_activate(struct ast_channel *chan, int silencelevel, int silenceframes);
+int ast_sildet_activate(struct ast_channel *chan, unsigned int silencelevel, unsigned int silenceframes);
#if defined(__cplusplus) || defined(c_plusplus)
}
More information about the asterisk-commits
mailing list