Module: sems
Branch: master
Commit: 0e529cad19d017f337b11696f7bac734cd8de70d
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=0e529cad19d017f337b11696f7bac734cd8de70d

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Mon Nov  3 17:46:54 2014 +0100

core:zrtp: make ZRTP debug logging configurable

---

 core/AmConfig.cpp         |    4 ++++
 core/AmConfig.h           |    1 +
 core/AmZRTP.cpp           |    3 +++
 core/etc/sems.conf.sample |    4 ++++
 doc/src/doc_zrtp.h        |   14 +++++++++++++-
 5 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/core/AmConfig.cpp b/core/AmConfig.cpp
index 094bcfb..fc56ded 100644
--- a/core/AmConfig.cpp
+++ b/core/AmConfig.cpp
@@ -106,6 +106,7 @@ int          AmConfig::UnhandledReplyLoglevel  = 0;
 
 #ifdef WITH_ZRTP
 bool         AmConfig::enable_zrtp             = true;
+bool         AmConfig::enable_zrtp_debuglog    = true;
 #endif
 
 unsigned int AmConfig::SessionLimit            = 0;
@@ -595,6 +596,9 @@ int AmConfig::readConfiguration()
 #ifdef WITH_ZRTP
   enable_zrtp = cfg.getParameter("enable_zrtp", "yes") == "yes";
   INFO("ZRTP %sabled\n", enable_zrtp ? "en":"dis");
+
+  enable_zrtp_debuglog = cfg.getParameter("enable_zrtp_debuglog", "yes") == 
"yes";
+  INFO("ZRTP debug log %sabled\n", enable_zrtp_debuglog ? "en":"dis");
 #endif
 
   if(cfg.hasParameter("session_limit")){ 
diff --git a/core/AmConfig.h b/core/AmConfig.h
index f0f1471..f1b7508 100644
--- a/core/AmConfig.h
+++ b/core/AmConfig.h
@@ -222,6 +222,7 @@ struct AmConfig
 
 #ifdef WITH_ZRTP
   static bool enable_zrtp;
+  static bool enable_zrtp_debuglog;
 #endif
 
   static unsigned int SessionLimit;
diff --git a/core/AmZRTP.cpp b/core/AmZRTP.cpp
index 59bb60e..a12f7b8 100644
--- a/core/AmZRTP.cpp
+++ b/core/AmZRTP.cpp
@@ -54,6 +54,9 @@ void zrtp_log(int level, char *data, int len, int offset) {
   else if (level==1)
     sems_lvl = L_INFO; // ??
   
+  if (sems_lvl==L_DBG && !AmConfig::enable_zrtp_debuglog)
+    return;
+
   _LOG(sems_lvl, "%.*s", len, data);
 }
 
diff --git a/core/etc/sems.conf.sample b/core/etc/sems.conf.sample
index 001a172..bb15cb1 100644
--- a/core/etc/sems.conf.sample
+++ b/core/etc/sems.conf.sample
@@ -379,6 +379,10 @@ loglevel=2
 # if build with ZRTP support (see Makefile.defs)
 # enable ZRTP support in endpoint calls:
 #enable_zrtp=yes (default: yes)
+#
+
+# enable ZRTP debug log? (prints lots of info)
+#enable_zrtp_debuglog=no (default: yes)
 
 ############################################################
 # tuning
diff --git a/doc/src/doc_zrtp.h b/doc/src/doc_zrtp.h
index 7e2aa46..2c0d94d 100644
--- a/doc/src/doc_zrtp.h
+++ b/doc/src/doc_zrtp.h
@@ -36,13 +36,25 @@
  *   <pre> $ make WITH_ZRTP=yes</pre>
  *  </p>
  * 
+  <p>ZRTP can be enabled in sems.conf by the enable_zrtp config parameter, 
e.g. enable_zrtp=yes.</p>
+
+  <p>ZRTP debug logging (lots of info in the log) can be disabled in sems.conf 
by setting enable_zrtp_debuglog=no</p>
+
+  <p>ZRTP is NOT supported by the sbc application. I.e. if you want to 
transcrypt cleartext calls into ZRTP encrypted calls,
+     you need to use an endpoint application like the webconference module, 
the conference module, or better yet a
+     DSM application. If you want to make a plain-RTP to ZRTP gateway, have a 
look at the b2b_connect_audio DSM example,
+    which can be found in doc/dsm/examples/b2b_connect_audio.
+  </p>
+
+  <p> There is support for some utility functions in a DSM module (see \ref 
dsm_mod_zrtp). </p>
+
  *  <p>The <em>conference</em> application is enabled to tell the caller the 
SAS phrase
  *  if it is compiled with WITH_SAS_TTS option, set in 
apps/conference/Makefile. For this to work,
  *  the <a href="http://cmuflite.org";>flite text-to-speech synthesizer</a> 
version 1.2 or 1.3 is needed.</p>
  *  
  *  \section zinyourapp How to use ZRTP in your application 
  *
- *  Have a look at the conference application on how to add ZRTP support in 
your application. There is a 
+ *  Have a look at the dsm or the conference application on how to add ZRTP 
support in your application. There is a 
  *  <code>void AmSession::onZRTPEvent(zrtp_event_t event, zrtp_stream_ctx_t 
*stream_ctx)</code> 
  *  event that is called with the appropriate ZRTP event type and the zrtp 
stream context, if the state
  *  of the ZRTP encryption changes. The zrtp_event are defined in the Zfone 
SDK, e.g. ZRTP_EVENT_IS_SECURE.

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to