aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortzafrir <tzafrir@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-21 18:22:25 +0000
committertzafrir <tzafrir@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-21 18:22:25 +0000
commitfad7bde3563ada4766a5fb0d1a73a81541293973 (patch)
treeda225ed971076584bd7b0779cf5615fde61b271c
parent7de0c0b692f7714dd375ddc1d7110568c7e4bc7e (diff)
Fix invalid test for rxisoffhook in FXO channels
This fixes some cases of no outgoing calls on FXO before an incoming call. Remove an unnecessary testing of an "off-hook" bit from DAHDI for FXO (KS/GS) channels.In some cases the bit would not be initialized properly before the first inbound call and thus prevent an outgoing call. If those tests are actually required by anybody, they should define DAHDI_CHECK_HOOKSTATE in channels/sig_analog.c . (closes issue #14577) Reported by: jkroon Patches: asterisk_chan_dahdi_hookstate_fix.diff uploaded by frawd (license 610) Tested by: frawd Review: https://reviewboard.asterisk.org/r/699/ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@278524 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_dahdi.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 244a156e4..760cee23d 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -10812,10 +10812,10 @@ static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t g
return 1;
}
#endif
- if (!(p->radio || (p->oprmode < 0)))
+
+ /* Trust hook state */
+ if (p->sig && !(p->radio || (p->oprmode < 0)))
{
- if (!p->sig || (p->sig == SIG_FXSLS))
- return 1;
/* Check hook state */
if (p->subs[SUB_REAL].dfd > -1) {
memset(&par, 0, sizeof(par));
@@ -10825,28 +10825,30 @@ static inline int available(struct dahdi_pvt *p, int channelmatch, ast_group_t g
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... */
+ }
+ else if ((p->sig != SIG_FXSKS) && (p->sig != SIG_FXSGS) && (p->sig != SIG_FXSLS)) {
+ 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 */
+ return 0;
+ }
+ }
+#ifdef DAHDI_CHECK_HOOKSTATE
+ } else { /* FXO channel case (SIG_FXS--) */
+ /* Channel bank (using CAS), "onhook" does not necessarily means out of service, so return 1 */
if (par.rxbits > -1)
return 1;
+ /* TDM FXO card, "onhook" means out of service (no battery on the line) */
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
- }
}
+
return 1;
}