[asterisk-bugs] [Asterisk 0014577]: [patch] FXO channels "hookstate" incorrect on startup
Asterisk Bug Tracker
noreply at bugs.digium.com
Sat Mar 21 16:50:57 CDT 2009
A NOTE has been added to this issue.
======================================================================
http://bugs.digium.com/view.php?id=14577
======================================================================
Reported By: jkroon
Assigned To:
======================================================================
Project: Asterisk
Issue ID: 14577
Category: Channels/chan_dahdi
Reproducibility: always
Severity: major
Priority: normal
Status: confirmed
Asterisk Version: 1.6.0.6
Regression: No
SVN Branch (only for SVN checkouts, not tarball releases): N/A
SVN Revision (number only!):
Request Review:
======================================================================
Date Submitted: 2009-03-01 16:16 CST
Last Modified: 2009-03-21 16:50 CDT
======================================================================
Summary: [patch] FXO channels "hookstate" incorrect on
startup
Description:
Referencing bug 13786 (http://bugs.digium.com/view.php?id=13786) which
attempts to work around an underlying problem in userspace (chan_dahdi).
The issue seems to be (as described by tzafrir):
It seems to expose a bug(?) in zaptel/dahdi where chan->rxhooksig is set
to RX_HOOKSIG_INITIAL at the end of chanconfig() which leaves the channel's
state there "uninitialized" and even if the channel driver knows better it
cannot override this decision. But I'm not sure what's the intended
behaviour, so I avoid a seperate bug report on that for now.
This is manifested in that I cannot make outbound calls on an FXO card
(Using FXSKS signalling) until I've received an incoming call resetting the
hookstate to offhook (A single ring is good enough), or alternatively,
disconnecting and reconnecting the telephone line.
======================================================================
----------------------------------------------------------------------
(0102049) tzafrir (manager) - 2009-03-21 16:50
http://bugs.digium.com/view.php?id=14577#c102049
----------------------------------------------------------------------
The issue is still present in trunk.
Compare code in trunk to code in 1.4. The code in 1.4 seems pretty much
like the code in 1.4.21 and like the code of 1.6.0-beta9. On 1.4 it may
only return 0 ("not available") from the code ifdef-ed by
DAHDI_CHECK_HOOKSTATE. In 1.6 this is not the case.
This leads me to suspect that this whole code should be put inside #ifdef
DAHDI_CHECK_HOOKSTATE, as I see no use for that ioctl.
(hint: in firefox mark the part of the text and use "view selection
source" to see it properly indented)
Code in trunk (and 1.6.x branches):
-----------------------------------
if (!p->sig || (p->sig == SIG_FXSLS))
return 1;
/* Check hook state */
if (p->subs[SUB_REAL].dfd > -1)
res = ioctl(p->subs[SUB_REAL].dfd,
DAHDI_GET_PARAMS, &par);
else {
/* Assume not off hook on CVRS */
res = 0;
par.rxisoffhook = 0;
}
if (res) {
ast_log(LOG_WARNING, "Unable to check hook
state on channel %d: %s\n", p->channel, strerror(errno));
} else if ((p->sig == SIG_FXSKS) || (p->sig ==
SIG_FXSGS)) {
/* When "onhook" that means no battery on
the line, and thus
it is out of service..., if it's on a
TDM card... If it's a channel
bank, there is no telling... */
if (par.rxbits > -1)
return 1;
if (par.rxisoffhook)
return 1;
else
return 0;
} else if (par.rxisoffhook) {
ast_debug(1, "Channel %d off hook, can't
use\n", p->channel);
/* Not available when the other end is off
hook */
#ifdef DAHDI_CHECK_HOOKSTATE
return 0;
#else
return 1;
#endif
}
code in 1.4:
------------
if (!p->sig || (p->sig == SIG_FXSLS))
return 1;
/* Check hook state */
if (p->subs[SUB_REAL].dfd > -1)
res = ioctl(p->subs[SUB_REAL].dfd,
DAHDI_GET_PARAMS, &par);
else {
/* Assume not off hook on CVRS */
res = 0;
par.rxisoffhook = 0;
}
if (res) {
ast_log(LOG_WARNING, "Unable to check hook
state on channel %d: %s\n", p->channel, strerror(errno));
} else if ((p->sig == SIG_FXSKS) || (p->sig ==
SIG_FXSGS)) {
/* When "onhook" that means no battery on
the line, and thus
it is out of service..., if it's on a
TDM card... If it's a channel
bank, there is no telling... */
if (par.rxbits > -1)
return 1;
if (par.rxisoffhook)
return 1;
else
#ifdef DAHDI_CHECK_HOOKSTATE
return 0;
#else
return 1;
#endif
} else if (par.rxisoffhook) {
ast_log(LOG_DEBUG, "Channel %d off hook,
can't use\n", p->channel);
/* Not available when the other end is off
hook */
return 0;
}
Issue History
Date Modified Username Field Change
======================================================================
2009-03-21 16:50 tzafrir Note Added: 0102049
======================================================================
More information about the asterisk-bugs
mailing list