[asterisk-commits] dbailey: trunk r215608 - in /trunk/channels: chan_dahdi.c sig_analog.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 2 14:49:47 CDT 2009
Author: dbailey
Date: Wed Sep 2 14:49:43 2009
New Revision: 215608
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215608
Log:
Fix issue where DTMF CID detect was placing channels into signed linear mode
made analog_set_linear_mode return back the mode that was being overwritten
so it could be restored later.
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/sig_analog.c
Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=215608&r1=215607&r2=215608
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Sep 2 14:49:43 2009
@@ -1992,12 +1992,20 @@
ast_mutex_unlock(&p->lock);
}
+/* linear_mode = 0 - turn linear mode off, >0 - turn linear mode on
+* returns the last value of the linear setting
+*/
static int my_set_linear_mode(void *pvt, int idx, int linear_mode)
{
struct dahdi_pvt *p = pvt;
- if (!linear_mode)
- linear_mode = p->subs[idx].linear;
- return dahdi_setlinear(p->subs[idx].dfd, linear_mode);
+ int oldval;
+
+ if (0 > linear_mode || !dahdi_setlinear(p->subs[idx].dfd, linear_mode)) {
+ return -1;
+ }
+ oldval = p->subs[idx].linear;
+ p->subs[idx].linear = linear_mode;
+ return oldval;
}
static int get_alarms(struct dahdi_pvt *p);
@@ -3494,11 +3502,7 @@
static int dahdi_setlinear(int dfd, int linear)
{
- int res;
- res = ioctl(dfd, DAHDI_SETLINEAR, &linear);
- if (res)
- return res;
- return 0;
+ return ioctl(dfd, DAHDI_SETLINEAR, &linear);
}
Modified: trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.c?view=diff&rev=215608&r1=215607&r2=215608
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Wed Sep 2 14:49:43 2009
@@ -770,6 +770,7 @@
static int analog_set_linear_mode(struct analog_pvt *p, int index, int linear_mode)
{
if (p->calls->set_linear_mode) {
+ /* Return provides old linear_mode setting or error indication */
return p->calls->set_linear_mode(p->chan_pvt, index, linear_mode);
}
return -1;
@@ -2035,11 +2036,12 @@
/* If set to use DTMF CID signalling, listen for DTMF */
if (p->cid_signalling == CID_SIG_DTMF) {
int i = 0;
+ int oldlinearity;
cs = NULL;
ast_debug(1, "Receiving DTMF cid on "
"channel %s\n", chan->name);
- analog_set_linear_mode(p, index, 0);
+ oldlinearity = analog_set_linear_mode(p, index, 0);
res = 2000;
for (;;) {
@@ -2066,7 +2068,7 @@
}
dtmfbuf[i] = '\0';
- analog_set_linear_mode(p, index, 1);
+ analog_set_linear_mode(p, index, oldlinearity);
/* Got cid and ring. */
ast_debug(1, "CID got string '%s'\n", dtmfbuf);
More information about the asterisk-commits
mailing list