Index: drivers/dahdi/wctdm.c =================================================================== --- drivers/dahdi/wctdm.c (revision 6689) +++ drivers/dahdi/wctdm.c (working copy) @@ -1038,20 +1038,33 @@ wc->mod[x].fxs.idletxhookstate = 0x2; } else { if (wc->mod[x].fxs.ohttimer) { - wc->mod[x].fxs.ohttimer-= DAHDI_CHUNKSIZE; - if (!wc->mod[x].fxs.ohttimer) { - if (reversepolarity) + if (!wc->mod[x].fxs.oldrxhook) { + /*On Hook*/ + + wc->mod[x].fxs.ohttimer-= DAHDI_CHUNKSIZE; + if (!wc->mod[x].fxs.ohttimer) { + printk(KERN_INFO "wctdm: ohttimer expired while OnHook\n"); + if (reversepolarity) + wc->mod[x].fxs.idletxhookstate = 0x5; /* Switch to active */ + else + wc->mod[x].fxs.idletxhookstate = 0x1; + if ((wc->mod[x].fxs.lasttxhook == 0x2) || (wc->mod[x].fxs.lasttxhook == 0x6)) { + /* Apply the change if appropriate */ + if (reversepolarity) + wc->mod[x].fxs.lasttxhook = 0x5; + else + wc->mod[x].fxs.lasttxhook = 0x1; + wctdm_setreg(wc, x, 64, wc->mod[x].fxs.lasttxhook); + } + } + } else { + /*Off Hook*/ + printk(KERN_INFO "wctdm: ohttimer expire avoided after OffHook\n"); + wc->mod[x].fxs.ohttimer = 0; + if (reversepolarity) wc->mod[x].fxs.idletxhookstate = 0x5; /* Switch to active */ else wc->mod[x].fxs.idletxhookstate = 0x1; - if ((wc->mod[x].fxs.lasttxhook == 0x2) || (wc->mod[x].fxs.lasttxhook == 0x6)) { - /* Apply the change if appropriate */ - if (reversepolarity) - wc->mod[x].fxs.lasttxhook = 0x5; - else - wc->mod[x].fxs.lasttxhook = 0x1; - wctdm_setreg(wc, x, 64, wc->mod[x].fxs.lasttxhook); - } } } }