aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-25 02:12:49 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-25 02:12:49 +0000
commit42a54aeede4c7265aa33fd61494969acf5c4e079 (patch)
tree9ab4997d63b716d552db924717bdf4edca951730 /channels
parent24d59fbd9b195bc720aa5702b493c174a082a14c (diff)
fix 'sip debug' vs. reload properly
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6397 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 2fd0b5cdb..553ceb876 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -358,6 +358,8 @@ static struct in_addr __ourip;
static struct sockaddr_in outboundproxyip;
static int ourport;
+#define SIP_DEBUG_CONFIG 1 << 0
+#define SIP_DEBUG_CONSOLE 1 << 1
static int sipdebug = 0;
static struct sockaddr_in debugaddr;
@@ -7944,7 +7946,7 @@ static int sip_do_debug_ip(int fd, int argc, char *argv[])
ast_cli(fd, "SIP Debugging Enabled for IP: %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), debugaddr.sin_addr));
else
ast_cli(fd, "SIP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), debugaddr.sin_addr), port);
- sipdebug = 1;
+ sipdebug |= SIP_DEBUG_CONSOLE;
return RESULT_SUCCESS;
}
@@ -7962,7 +7964,7 @@ static int sip_do_debug_peer(int fd, int argc, char *argv[])
memcpy(&debugaddr.sin_addr, &peer->addr.sin_addr, sizeof(debugaddr.sin_addr));
debugaddr.sin_port = peer->addr.sin_port;
ast_cli(fd, "SIP Debugging Enabled for IP: %s:%d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), debugaddr.sin_addr), ntohs(debugaddr.sin_port));
- sipdebug = 1;
+ sipdebug |= SIP_DEBUG_CONSOLE;
} else
ast_cli(fd, "Unable to get IP address of peer '%s'\n", argv[3]);
ASTOBJ_UNREF(peer,sip_destroy_peer);
@@ -7974,7 +7976,7 @@ static int sip_do_debug_peer(int fd, int argc, char *argv[])
/*--- sip_do_debug: Turn on SIP debugging (CLI command) */
static int sip_do_debug(int fd, int argc, char *argv[])
{
- int oldsipdebug = sipdebug;
+ int oldsipdebug = sipdebug & SIP_DEBUG_CONSOLE;
if (argc != 2) {
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -7984,7 +7986,7 @@ static int sip_do_debug(int fd, int argc, char *argv[])
return sip_do_debug_peer(fd, argc, argv);
else return RESULT_SHOWUSAGE;
}
- sipdebug = 1;
+ sipdebug |= SIP_DEBUG_CONSOLE;
memset(&debugaddr, 0, sizeof(debugaddr));
if (oldsipdebug)
ast_cli(fd, "SIP Debugging re-enabled\n");
@@ -8078,7 +8080,7 @@ static int sip_no_debug(int fd, int argc, char *argv[])
{
if (argc != 3)
return RESULT_SHOWUSAGE;
- sipdebug = 0;
+ sipdebug &= ~SIP_DEBUG_CONSOLE;
ast_cli(fd, "SIP Debugging Disabled\n");
return RESULT_SUCCESS;
}
@@ -11128,6 +11130,7 @@ static int reload_config(void)
memset(&localaddr, 0, sizeof(localaddr));
memset(&externip, 0, sizeof(externip));
memset(&prefs, 0 , sizeof(prefs));
+ sipdebug &= ~SIP_DEBUG_CONFIG;
/* Initialize some reasonable defaults at SIP reload */
ast_copy_string(default_context, DEFAULT_CONTEXT, sizeof(default_context));
@@ -11268,7 +11271,8 @@ static int reload_config(void)
if (default_expiry < 1)
default_expiry = DEFAULT_DEFAULT_EXPIRY;
} else if (!strcasecmp(v->name, "sipdebug")) {
- sipdebug = ast_true(v->value);
+ if (ast_true(v->value))
+ sipdebug |= SIP_DEBUG_CONFIG;
} else if (!strcasecmp(v->name, "dumphistory")) {
dumphistory = ast_true(v->value);
} else if (!strcasecmp(v->name, "recordhistory")) {