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. 


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@215608 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Doug Bailey 16 years ago
parent 57a9927143
commit eff8dd9a2f

@ -1992,12 +1992,20 @@ static void my_unlock_private(void *pvt)
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 void dahdi_close_ss7_fd(struct dahdi_ss7 *ss7, int fd_num)
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);
}

@ -770,6 +770,7 @@ static int analog_check_confirmanswer(struct analog_pvt *p)
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 @@ static void *__analog_ss_thread(void *data)
/* 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 @@ static void *__analog_ss_thread(void *data)
}
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);

Loading…
Cancel
Save