Summary:ASTERISK-23462: Cannot disable SIP debugging via CLI after enabling with conf file option - also 'sip set debug off' reports debugging disabled, when it really isn't
Reporter:Rusty Newton (rnewton)Labels:patch
Date Opened:2014-03-11 15:53:04Date Closed:2017-10-19 07:46:20
Status:Closed/CompleteComponents:Channels/chan_sip/General Core/Logging
Versions:SVN 12.1.0 Frequency of
Environment:Attachments:( 0) chan_sip-sipdebug-better-output.patch
Description:This is trivial, but annoying.

h1. Problem:

With "sipdebug=yes" set in sip.conf, SIP debugging is enabled to the console.

Running "sip set debug off" reports:
newtonr-laptop*CLI> sip set debug off
SIP Debugging Disabled
However, SIP debugging continues to show up.

h1. Thoughts:

Ideally, "sipdebug=yes" would only affect the initial state of SIP debugging when Asterisk parses the config file and loads chan_sip. Then I would expect that you could affect the state of debugging with CLI commands while working on the CLI later on. Instead it appears to override the CLI commands completely.

If we leave this behavior we should note it in the sip.conf and on the wiki, though I'd consider it a bug that the CLI command is reporting the state falsely.

1. Fix it so that the CLI commands can change the SIP debugging state despite the initial state upon load.
2. Or, document the behavior of sipdebug=yes acting as a permanent override and fix the false report from the CLI command.
Comments:By: Corey Farrell (coreyfarrell) 2014-06-11 00:19:55.945-0500

If we fix this so CLI can disable SIP debugging after it's enabled by sip.conf, what happens with a "sip reload" after "sip set debug off"?  Assume sip.conf changed but still has sipdebug=yes.  Should the reload turn debugging back on or continue to respect the CLI command to disable debugging?

By: Rusty Newton (rnewton) 2014-06-12 14:21:51.815-0500

I'd expect it to turn debugging back on after parsing the config file again. I think having it respect the CLI command through reloads would make things too confusing. At least, that behavior would make sense.

At a minimum, it would be cool if the command didn't report "SIP Debugging Disabled" when it really isn't disabled.

If you happen to work on any of this, thanks in advance.  I think this issue is more of an annoyance than anything else.

By: Corey Farrell (coreyfarrell) 2014-06-13 00:49:32.481-0500

So internally sipdebug is a bitfield, where it can be enabled by config or CLI, but to be disabled it has to be disabled in both places.  The attached patch should give better output by informing the CLI user when "sip set debug off" is blocked by sipdebug=yes in sip.conf.  I welcome your input on better wording, my C is better than my English.

By: Friendly Automation (friendly-automation) 2017-10-19 07:46:20.989-0500

Change 6829 merged by Joshua Colp:
chan_sip: Fix output of 'sip set debug off'.


By: Friendly Automation (friendly-automation) 2017-10-19 08:01:19.422-0500

Change 6828 merged by Jenkins2:
chan_sip: Fix output of 'sip set debug off'.


By: Friendly Automation (friendly-automation) 2017-10-19 08:15:04.907-0500

Change 6827 merged by Joshua Colp:
chan_sip: Fix output of 'sip set debug off'.