From 4e76aa4920e9cbbad1a591726cb652110b3554ec Mon Sep 17 00:00:00 2001
From: Alec L Davis <sivad.a@paradise.net.nz>
Date: Tue, 20 Nov 2012 17:37:28 +0000
Subject: [PATCH] Reduce CLI spam of "Extension Changed" device state messages.

Asterisk 11 follows RFC3265 that states that after every subscribe or resubscribe a notify should be sent.
Thus the console if filled continuously with the following after every subscribe;
  == Extension Changed 8512[phones] new state IDLE for Notify User cisco1

In Asterisk 1.8 only changes would be sent. Thus only when a device state changed was anything emitted to the console.

fix:
Only print to console when device state isn't forced.

(closes issue ASTERISK-20706)
Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)



git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@376540 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 channels/chan_sip.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index f2afb66d1f..cf12d55eac 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -16419,8 +16419,11 @@ static int extensionstate_update(const char *context, const char *exten, struct
 			ast_set_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE);
 		}
 	}
-	ast_verb(2, "Extension Changed %s[%s] new state %s for Notify User %s %s\n", exten, context, ast_extension_state2str(data->state), p->username,
-			ast_test_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE) ? "(queued)" : "");
+
+	if (!force) {
+		ast_verb(2, "Extension Changed %s[%s] new state %s for Notify User %s %s\n", exten, context, ast_extension_state2str(data->state), p->username,
+				ast_test_flag(&p->flags[1], SIP_PAGE2_STATECHANGEQUEUE) ? "(queued)" : "");
+	}
 
 	sip_pvt_unlock(p);
 
-- 
GitLab