From 5f7ebe98daafd31a8111b0e10d31b1828e20d113 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Thu, 29 Nov 2012 12:24:52 -0600 Subject: [PATCH] dahdi: Only watch transitions of ABIT when using E&M signalling. This resolves an issue with a Glenayre GL3000 Paging Terminal with v8.000 software. The Glenayre would change both A and B bits to signal on/off hook states, but there were a couple of milliseconds between when those bits changed. This resulted in DAHDI generating an on-hook event to Asterisk before generating the off-hook event and therefore Asterisk terminated the call prematurely. Looking the A and B bits before this patch: Asterisk (AB) Glenayre (AB) 00 00 Both sides on-hook 11 00 Asterisk goes off hook to sieze line. 11 01 Glenayre starts going-offhook. On-hook event sent to Asterisk from drivers since bits changed but ABIT was still 0. 11 11 Glenayre finishes going off-hook. Off-hook event sent to Asterisk since ABIT changed from 0 to 1. 00 11 Asterisk, processes on-hook event and goes on-hook itself to release line. 00 00 Glenayre releases line. Call fails. After this patch: Asterisk (AB) Glenayre (AB) 00 00 Both sides on-hook 11 00 Asterisk initiates call 11 01 Glenayre starts handling call. No event is sent to Asterisk since only ABIT is checked. 11 11 Glanayre finishes going off-hook. Call proceeds normally. Internal-Issue-ID: DAHDI-1009 Signed-off-by: Shaun Ruffell Signed-off-by: Russ Meyerriecks --- drivers/dahdi/dahdi-base.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 1a6b5d5..d518710 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -8353,7 +8353,6 @@ void dahdi_rbsbits(struct dahdi_chan *chan, int cursig) break; } /* Fall through */ - case DAHDI_SIG_EM: /* E and M */ case DAHDI_SIG_EM_E1: case DAHDI_SIG_FXOLS: /* FXO Loopstart */ case DAHDI_SIG_FXOKS: /* FXO Kewlstart */ @@ -8362,7 +8361,13 @@ void dahdi_rbsbits(struct dahdi_chan *chan, int cursig) else /* on hook */ __dahdi_hooksig_pvt(chan,DAHDI_RXSIG_ONHOOK); break; - + case DAHDI_SIG_EM: /* E and M */ + /* Watch only the ABIT for changes. */ + if ((cursig & DAHDI_ABIT) == (chan->rxsig & DAHDI_ABIT)) + break; + __dahdi_hooksig_pvt(chan, (cursig & DAHDI_ABIT) ? + DAHDI_RXSIG_OFFHOOK : DAHDI_RXSIG_ONHOOK); + break; case DAHDI_SIG_FXSKS: /* FXS Kewlstart */ case DAHDI_SIG_FXSGS: /* FXS Groundstart */ /* Fall through */