diff options
author | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-06-06 02:47:53 +0000 |
---|---|---|
committer | markster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2003-06-06 02:47:53 +0000 |
commit | 21224b4ad18a623fbfc481242048e28fdbfaea86 (patch) | |
tree | 9648dec8ba91fdb90a2df80b781226c0a3516d94 /zaptel.c | |
parent | b4b9c88ccd625d7840111159f42b72bcda883227 (diff) |
FXS fixes, ring debounce
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@191 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-x | zaptel.c | 29 |
1 files changed, 11 insertions, 18 deletions
@@ -4467,8 +4467,6 @@ static inline void rbs_otimer_expire(struct zt_chan *chan) static void zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig) { - int oldrxsig = chan->rxhooksig; - /* State machines for receive hookstate transitions */ if ((chan->rxhooksig) == rxsig) return; @@ -4497,29 +4495,14 @@ static void zt_hooksig_pvt(struct zt_chan *chan, zt_rxsig_t rxsig) break; } break; - case ZT_SIG_FXSLS: /* FXS loopstart */ - if ((oldrxsig == ZT_RXSIG_RING) && - (rxsig == ZT_RXSIG_OFFHOOK)) { - if (!chan->ringdebtimer) qevent(chan,ZT_EVENT_RINGOFFHOOK); - } - break; case ZT_SIG_FXSKS: /* FXS Kewlstart */ - if ((oldrxsig == ZT_RXSIG_RING) && - (rxsig == ZT_RXSIG_OFFHOOK)) { - if (!chan->ringdebtimer) qevent(chan,ZT_EVENT_RINGOFFHOOK); - break; - } /* ignore a bit poopy if loop not closed and stable */ if (chan->txstate != ZT_TXSTATE_OFFHOOK) break; /* fall through intentionally */ case ZT_SIG_FXSGS: /* FXS Groundstart */ - if ((oldrxsig == ZT_RXSIG_RING) && - (rxsig == ZT_RXSIG_OFFHOOK)) { - if (!chan->ringdebtimer) qevent(chan,ZT_EVENT_RINGOFFHOOK); - break; - } if (rxsig == ZT_RXSIG_ONHOOK) { chan->ringdebtimer = RING_DEBOUNCE_TIME; + chan->ringtrailer = 0; if (chan->txstate != ZT_TXSTATE_DEBOUNCE) { chan->gotgs = 0; qevent(chan,ZT_EVENT_ONHOOK); @@ -5436,6 +5419,16 @@ int zt_receive(struct zt_span *span) } if (span->chans[x].ringdebtimer) span->chans[x].ringdebtimer--; + if (span->chans[x].sig & __ZT_SIG_FXS) { + if (span->chans[x].rxhooksig == ZT_RXSIG_RING) + span->chans[x].ringtrailer = ZT_RINGTRAILER; + else if (span->chans[x].ringtrailer) { + span->chans[x].ringtrailer-= ZT_CHUNKSIZE; + /* See if RING trailer is expired */ + if (!span->chans[x].ringtrailer && !span->chans[x].ringdebtimer) + qevent(&span->chans[x],ZT_EVENT_RINGOFFHOOK); + } + } if (span->chans[x].pulsetimer) { span->chans[x].pulsetimer--; |