Asterisk
  1. Asterisk
  2. ASTERISK-13673

[patch] FXO channels "hookstate" incorrect on startup

    Details

    • Type: Bug Bug
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: Channels/chan_dahdi
    • Labels:
      None

      Description

      Referencing bug 13786 (http://bugs.digium.com/view.php?id=13786) which attempts to work around an underlying problem in userspace (chan_dahdi). The issue seems to be (as described by tzafrir):

      It seems to expose a bug in zaptel/dahdi where chan->rxhooksig is set to RX_HOOKSIG_INITIAL at the end of chanconfig() which leaves the channel's state there "uninitialized" and even if the channel driver knows better it cannot override this decision. But I'm not sure what's the intended behaviour, so I avoid a seperate bug report on that for now.

      This is manifested in that I cannot make outbound calls on an FXO card (Using FXSKS signalling) until I've received an incoming call resetting the hookstate to offhook (A single ring is good enough), or alternatively, disconnecting and reconnecting the telephone line.

                • ADDITIONAL INFORMATION ******

      I say attempt because the patch really is wrong imho, looking at chan_dahdi.c for asterisk 1.6.0.3 the patch resulted in this code (trimmed on tabs on the left, line 8729 onwards):

      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... */
      if (par.rxbits > -1)
      return 1;
      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
      }

      For an FXO channel using FXSKS or FXSGS signalling the code will not reach the #ifdef part of the code, instead they'll be grabbed by the snippet just above it, and indeed, changing the return 0 on line 8740 resolves the problem for me.

      Currently I can work around this bug by changing the return statement, or by using fxsls signalling.

      IMHO this (as tzafrir implied) is in fact a ZAPTEL/DAHDI bug that should be fixed. In the meantime I'm working around the issue by using loopstart signalling instead.

        Issue Links

          Activity

          Hide
          frawd added a comment -

          Attached basically the same patch except for:

          • Includes ANALOG_SIG_FXSLS to the check (I don't see why it should be left out)
          • No need for any type of check if DAHDI_CHECK_HOOKSTATE is defined
          • Simplified comments.
          Show
          frawd added a comment - Attached basically the same patch except for: Includes ANALOG_SIG_FXSLS to the check (I don't see why it should be left out) No need for any type of check if DAHDI_CHECK_HOOKSTATE is defined Simplified comments.
          Hide
          Tilghman Lesher added a comment -

          Since there are 9 patches here, could someone please summarize which patches are to be tested and committed and which patches need to be deleted?

          Show
          Tilghman Lesher added a comment - Since there are 9 patches here, could someone please summarize which patches are to be tested and committed and which patches need to be deleted?
          Hide
          Tzafrir Cohen added a comment -

          asterisk_chan_dahdi_hookstate_fix_trunk_new.diff is the one included in the review (for trunk).

          asterisk_chan_dahdi_hookstate_fix.diff is intended for 1.6.2 .

          Show
          Tzafrir Cohen added a comment - asterisk_chan_dahdi_hookstate_fix_trunk_new.diff is the one included in the review (for trunk). asterisk_chan_dahdi_hookstate_fix.diff is intended for 1.6.2 .
          Hide
          Digium Subversion added a comment -

          Repository: asterisk
          Revision: 278501

          U trunk/channels/chan_dahdi.c
          U trunk/channels/sig_analog.c

          ------------------------------------------------------------------------
          r278501 | tzafrir | 2010-07-21 12:44:19 -0500 (Wed, 21 Jul 2010) | 19 lines

          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 ASTERISK-13673)
          Reported by: jkroon
          Patches:
          asterisk_chan_dahdi_hookstate_fix_trunk_new.diff uploaded by frawd (license 610)
          Tested by: frawd

          Review: https://reviewboard.asterisk.org/r/699/

          ------------------------------------------------------------------------

          http://svn.digium.com/view/asterisk?view=rev&revision=278501

          Show
          Digium Subversion added a comment - Repository: asterisk Revision: 278501 U trunk/channels/chan_dahdi.c U trunk/channels/sig_analog.c ------------------------------------------------------------------------ r278501 | tzafrir | 2010-07-21 12:44:19 -0500 (Wed, 21 Jul 2010) | 19 lines 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 ASTERISK-13673 ) Reported by: jkroon Patches: asterisk_chan_dahdi_hookstate_fix_trunk_new.diff uploaded by frawd (license 610) Tested by: frawd Review: https://reviewboard.asterisk.org/r/699/ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=278501
          Hide
          Digium Subversion added a comment -

          Repository: asterisk
          Revision: 278524

          U branches/1.6.2/channels/chan_dahdi.c

          ------------------------------------------------------------------------
          r278524 | tzafrir | 2010-07-21 13:22:24 -0500 (Wed, 21 Jul 2010) | 21 lines

          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 ASTERISK-13673)
          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/

          ------------------------------------------------------------------------

          http://svn.digium.com/view/asterisk?view=rev&revision=278524

          Show
          Digium Subversion added a comment - Repository: asterisk Revision: 278524 U branches/1.6.2/channels/chan_dahdi.c ------------------------------------------------------------------------ r278524 | tzafrir | 2010-07-21 13:22:24 -0500 (Wed, 21 Jul 2010) | 21 lines 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 ASTERISK-13673 ) 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/ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=278524

            People

            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development