[asterisk-commits] branch oej/test-this-branch r15317 - in /team/oej/test-this-branch: ./ channe...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 27 14:07:25 MST 2006


Author: oej
Date: Mon Mar 27 15:07:23 2006
New Revision: 15317

URL: http://svn.digium.com/view/asterisk?rev=15317&view=rev
Log:
Issue 6793 - Gain functions in the CHANNEL dialplan function (bweschke)

Modified:
    team/oej/test-this-branch/README.test-this-branch
    team/oej/test-this-branch/README.test-this-branch.html
    team/oej/test-this-branch/channels/chan_zap.c
    team/oej/test-this-branch/funcs/func_channel.c

Modified: team/oej/test-this-branch/README.test-this-branch
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README.test-this-branch?rev=15317&r1=15316&r2=15317&view=diff
==============================================================================
--- team/oej/test-this-branch/README.test-this-branch (original)
+++ team/oej/test-this-branch/README.test-this-branch Mon Mar 27 15:07:23 2006
@@ -37,6 +37,8 @@
 - filenamelen: Some code changes for file name lengths (oej)
 - t38passthrough: Support for Fax passthrough in SIP (#5090, Steve Underwood)
 - rtptiming: Support for timed RTP (#5374, cmantunes/DEA/sokhapkin)
+- gain_functions: Support for gain adjustments in the CHANNEL function 
+  (#6793, bweschke)
 
 And the following stand-alone patches
 - Additional options for the CHANNEL dialplan function (oej, #6670)

Modified: team/oej/test-this-branch/README.test-this-branch.html
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/README.test-this-branch.html?rev=15317&r1=15316&r2=15317&view=diff
==============================================================================
--- team/oej/test-this-branch/README.test-this-branch.html (original)
+++ team/oej/test-this-branch/README.test-this-branch.html Mon Mar 27 15:07:23 2006
@@ -37,7 +37,10 @@
 <li> filenamelen: Some code changes for file name lengths (oej)<br />
 <li> t38passthrough: Support for Fax passthrough in SIP (<a href="http://bugs.digium.com/view.php?id=5090">#5090</a>, Steve Underwood)<br />
 See <a href="http://svn.digium.com/view/asterisk/team/oej/test-this-branch/doc/sipt38support.txt?view=markup">doc/sipt38support.txt</a>
-<li> rtptiming: Support for timed RTP (<a href="http://bugs.digium.com/view.php?idi=5374">#5374</a>, cmantunes/DEA/sokhapkin)
+<li> rtptiming: Support for timed RTP 
+(<a href="http://bugs.digium.com/view.php?idi=5374">#5374</a>, cmantunes/DEA/sokhapkin)</li>
+<li>gain_functions: Support for gain adjustments in the CHANNEL function 
+(<a href="http://bugs.digium.com/view.php?idi=6793">#6793</a>, bweschke)</li>
 </ul>
 </p>
 <i>And the following stand-alone patches:</i><p>

Modified: team/oej/test-this-branch/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_zap.c?rev=15317&r1=15316&r2=15317&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_zap.c (original)
+++ team/oej/test-this-branch/channels/chan_zap.c Mon Mar 27 15:07:23 2006
@@ -742,6 +742,7 @@
 static int zt_indicate(struct ast_channel *chan, int condition);
 static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen);
+static int zt_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len); 
 
 static const struct ast_channel_tech zap_tech = {
 	.type = "Zap",
@@ -760,6 +761,7 @@
 	.indicate = zt_indicate,
 	.fixup = zt_fixup,
 	.setoption = zt_setoption,
+	.func_channel_read = zt_func_read,
 };
 
 #ifdef ZAPATA_PRI
@@ -3022,6 +3024,25 @@
 
 	return 0;
 }
+
+static int zt_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
+{
+	struct zt_pvt *p = chan->tech_pvt;
+	
+	if (!strcasecmp(data, "rxgain")) {
+		ast_mutex_lock(&p->lock);
+		snprintf(buf, len, "%f", p->rxgain);
+		ast_mutex_unlock(&p->lock);	
+	} else if (!strcasecmp(data, "txgain")) {
+		ast_mutex_lock(&p->lock);
+		snprintf(buf, len, "%f", p->txgain);
+		ast_mutex_unlock(&p->lock);	
+	} else {
+		ast_copy_string(buf, "", len);
+	}
+	return 0;
+}
+
 
 static void zt_unlink(struct zt_pvt *slave, struct zt_pvt *master, int needlock)
 {

Modified: team/oej/test-this-branch/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/funcs/func_channel.c?rev=15317&r1=15316&r2=15317&view=diff
==============================================================================
--- team/oej/test-this-branch/funcs/func_channel.c (original)
+++ team/oej/test-this-branch/funcs/func_channel.c Mon Mar 27 15:07:23 2006
@@ -23,6 +23,7 @@
  */
 
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
 
@@ -93,6 +94,7 @@
 			      char *data, const char *value)
 {
 	int ret = 0;
+	signed char gainset;
 
 	if (!strcasecmp(data, "language"))
 		locked_string_field_set(chan, language, value);
@@ -100,7 +102,13 @@
 		locked_string_field_set(chan, musicclass, value);
 	else if (!strcasecmp(data, "callgroup"))
 		chan->callgroup = ast_get_group(data);
-	else if (!chan->tech->func_channel_write
+	else if (!strcasecmp(data, "txgain")) {
+		sscanf(value, "%hhd", &gainset);
+		ast_channel_setoption(chan, AST_OPTION_TXGAIN, &gainset, sizeof(gainset), 0);
+	} else if (!strcasecmp(data, "rxgain")) {
+		sscanf(value, "%hhd", &gainset);
+		ast_channel_setoption(chan, AST_OPTION_RXGAIN, &gainset, sizeof(gainset), 0);	
+	} else if (!chan->tech->func_channel_write
 		 || chan->tech->func_channel_write(chan, function, data, value)) {
 		ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n",
 				data);
@@ -123,8 +131,10 @@
 		"R/O	channeltype		technology used for channel\n"
 		"R/W	language 		language for sounds played\n"
 		"R/W	musicclass 		class (from musiconhold.conf) for hold music\n"
+		"R/W	rxgain			set rxgain level on channel techs that support it\n"
 		"R/O	state			state for channel\n"
 		"R/O	tonezone 		zone for indications played\n"
+		"R/W	txgain			set txgain level on channel techs that support it\n"
 		"R/O	videonativeformat 	format used natively for video\n"
 		"\n"
 		"Additional items may be available from the channel driver providing\n"



More information about the asterisk-commits mailing list