wctdm24xxp: Only two polarity reversals are needed to validate RING on FXO ports.
This fixes a regression introduced in commit r10186 "wctdm24xxp: Use time
interval for debouncing FXO ring detect." [1] which was first released in
DAHDI-Linux 2.6.0. This only affects users with analog trunks whose providers do
not present 4 polarity reversals on the ring signals. The reporter of this issue
is based in South Africa.
[1] http://svnview.digium.com/svn/dahdi?view=revision&revision=10168
In prior versions, the ring detector did not check for polarity reversals, only
the presence of ringing voltage unless fwringdetect or neonmwi_monitor mode was
set, and even when one of those modes were set, the driver only needed two
reversals to validate a ring. This commit allows the driver to always stay in
fwringdetect mode but restores the requirement for only two reversals.
Also included in this commit is a change to ensure that ringing is not reported
when debouncing lost battery which can happen when voltage is swinging through
0.
Reported-and-Tested-by: Jaco Kroon <jaco@uls.co.za>
Internal-Issue-ID: DAHLIN-298
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10719 a0bf4364-ded3-4de4-8d8a-66a801d63aff
(cherry picked from commit 84e70cdac5
)
This commit is contained in:
parent
179a48862d
commit
f6511b1040
@ -1833,19 +1833,22 @@ static void wctdm_qrvdri_check_hook(struct wctdm *wc, int card)
|
||||
static inline bool is_fxo_ringing(const struct fxo *const fxo)
|
||||
{
|
||||
return ((fxo->hook_ring_shadow & 0x60) &&
|
||||
(fxo->battery_state == BATTERY_PRESENT));
|
||||
((fxo->battery_state == BATTERY_PRESENT) ||
|
||||
(fxo->battery_state == BATTERY_DEBOUNCING_LOST)));
|
||||
}
|
||||
|
||||
static inline bool is_fxo_ringing_positive(const struct fxo *const fxo)
|
||||
{
|
||||
return (((fxo->hook_ring_shadow & 0x60) == 0x20) &&
|
||||
(fxo->battery_state == BATTERY_PRESENT));
|
||||
((fxo->battery_state == BATTERY_PRESENT) ||
|
||||
(fxo->battery_state == BATTERY_DEBOUNCING_LOST)));
|
||||
}
|
||||
|
||||
static inline bool is_fxo_ringing_negative(const struct fxo *const fxo)
|
||||
{
|
||||
return (((fxo->hook_ring_shadow & 0x60) == 0x40) &&
|
||||
(fxo->battery_state == BATTERY_PRESENT));
|
||||
((fxo->battery_state == BATTERY_PRESENT) ||
|
||||
(fxo->battery_state == BATTERY_DEBOUNCING_LOST)));
|
||||
}
|
||||
|
||||
static inline void set_ring(struct fxo *fxo, enum ring_detector_state new)
|
||||
@ -1856,19 +1859,21 @@ static inline void set_ring(struct fxo *fxo, enum ring_detector_state new)
|
||||
static void wctdm_fxo_ring_detect(struct wctdm *wc, struct wctdm_module *mod)
|
||||
{
|
||||
struct fxo *const fxo = &mod->mod.fxo;
|
||||
static const unsigned int POLARITY_CHANGES_NEEDED = 2;
|
||||
|
||||
/* Look for ring status bits (Ring Detect Signal Negative and Ring
|
||||
* Detect Signal Positive) to transition back and forth some number of
|
||||
* times to indicate that a ring is occurring. Provide some number of
|
||||
* samples to allow for the transitions to occur before giving up.
|
||||
* NOTE: neon mwi voltages will trigger one of these bits to go active
|
||||
* but not to have transitions between the two bits (i.e. no negative
|
||||
* to positive or positive to negative traversals) */
|
||||
* Detect Signal Positive) to transition back and forth
|
||||
* POLARITY_CHANGES_NEEDED times to indicate that a ring is occurring.
|
||||
* Provide some number of samples to allow for the transitions to occur
|
||||
* before giving up. NOTE: neon mwi voltages will trigger one of these
|
||||
* bits to go active but not to have transitions between the two bits
|
||||
* (i.e. no negative to positive or positive to negative traversals) */
|
||||
|
||||
switch (fxo->ring_state) {
|
||||
case DEBOUNCING_RINGING_POSITIVE:
|
||||
if (is_fxo_ringing_negative(fxo)) {
|
||||
if (++fxo->ring_polarity_change_count > 4) {
|
||||
if (++fxo->ring_polarity_change_count >
|
||||
POLARITY_CHANGES_NEEDED) {
|
||||
mod_hooksig(wc, mod, DAHDI_RXSIG_RING);
|
||||
set_ring(fxo, RINGING);
|
||||
if (debug) {
|
||||
@ -1886,7 +1891,8 @@ static void wctdm_fxo_ring_detect(struct wctdm *wc, struct wctdm_module *mod)
|
||||
break;
|
||||
case DEBOUNCING_RINGING_NEGATIVE:
|
||||
if (is_fxo_ringing_positive(fxo)) {
|
||||
if (++fxo->ring_polarity_change_count > 4) {
|
||||
if (++fxo->ring_polarity_change_count >
|
||||
POLARITY_CHANGES_NEEDED) {
|
||||
mod_hooksig(wc, mod, DAHDI_RXSIG_RING);
|
||||
set_ring(fxo, RINGING);
|
||||
if (debug) {
|
||||
|
Loading…
Reference in New Issue
Block a user