apps/app_streamsilence.c
static int remove_streamsilence(struct ast_channel *chan)
{
	struct ast_datastore *datastore = NULL;
	struct ast_silence_generator *g;
	SCOPED_CHANNELLOCK(chan_lock, chan);

	datastore = ast_channel_datastore_find(chan, &streamsilence_datastore, NULL);
	if (!datastore) {
		ast_log(AST_LOG_WARNING, "Cannot remove STREAM_SILENCE from %s: STREAM_SILENCE not currently enabled\n",
		        ast_channel_name(chan));
		return -1;
	}
	g = datastore->data;
	if (g) {
		ast_channel_stop_silence_generator(chan, g);
		/* no need to call ast_free, stop_silence_generator frees g for us */
		g = NULL;
	}
	if (ast_channel_datastore_remove(chan, datastore)) {
		ast_log(AST_LOG_WARNING, "Failed to remove STREAM_SILENCE datastore from channel %s\n",
		        ast_channel_name(chan));
		return -1;
	}
	ast_datastore_free(datastore);

	return 0;
}
/*! \internal \brief Disable silence stream on the channel */
\internal \brief Disable silence stream on the channel
\ internal \ brief Disable silence stream on the channel
static int remove_streamsilence(struct ast_channel *chan)
{
	struct ast_datastore *datastore = NULL;
	struct ast_silence_generator *g;
	SCOPED_CHANNELLOCK(chan_lock, chan);
	datastore = ast_channel_datastore_find(chan, &streamsilence_datastore, NULL);
	if (!datastore) {
		ast_log(AST_LOG_WARNING, "Cannot remove STREAM_SILENCE from %s: STREAM_SILENCE not currently enabled\n",
		        ast_channel_name(chan));
		return -1;
	}
	g = datastore->data;
	if (g) {
		ast_channel_stop_silence_generator(chan, g);
		g = NULL;
	}
	if (ast_channel_datastore_remove(chan, datastore)) {
		ast_log(AST_LOG_WARNING, "Failed to remove STREAM_SILENCE datastore from channel %s\n",
		        ast_channel_name(chan));
		return -1;
	}
	ast_datastore_free(datastore);
	return 0;
}
static int remove_streamsilence ( struct ast_channel * chan ) { struct ast_datastore * datastore = NULL ; struct ast_silence_generator * g ; SCOPED_CHANNELLOCK ( chan_lock , chan ) ; datastore = ast_channel_datastore_find ( chan , & streamsilence_datastore , NULL ) ; if ( ! datastore ) { ast_log ( AST_LOG_WARNING , " \n " , ast_channel_name ( chan ) ) ; return -1 ; } g = datastore -> data ; if ( g ) { ast_channel_stop_silence_generator ( chan , g ) ; g = NULL ; } if ( ast_channel_datastore_remove ( chan , datastore ) ) { ast_log ( AST_LOG_WARNING , " \n " , ast_channel_name ( chan ) ) ; return -1 ; } ast_datastore_free ( datastore ) ; return 0 ; }
\internal \brief Disable silence stream on the channel
\ internal \ brief Disable silence stream on the channel
/* no need to call ast_free, stop_silence_generator frees g for us */