Skip to content

Instantly share code, notes, and snippets.

@marcelog
Last active August 27, 2015 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcelog/47ef364b43c67f9f359d to your computer and use it in GitHub Desktop.
Save marcelog/47ef364b43c67f9f359d to your computer and use it in GitHub Desktop.
This is a patch to add an argument to webrtc2sip to optionally disable the console. After patching, recompile and start it with the argument --without-console
Index: mp_mediaproxy.cc
===================================================================
--- mp_mediaproxy.cc (revision 141)
+++ mp_mediaproxy.cc (working copy)
@@ -21,6 +21,7 @@
#include <libxml/tree.h>
+static int with_console = 1;
static char* sConfigXmlPath = NULL;
#define kSQLiteConnectionInfo "./c2c_sqlite.db"
#define kSQLiteName "sqlite"
@@ -447,6 +448,9 @@
}
mp_strn_update(&sConfigXmlPath, value, value_size);
}
+ else if(tsk_strniequals("--without-console", name, name_size)){
+ with_console = 0;
+ }
else if(tsk_strniequals("--help", name, name_size)){
printUsage();
exit(-1);
@@ -493,11 +497,17 @@
exit (-1);
}
- while (fgets(command, sizeof(command), stdin) != NULL) {
- if (tsk_strnicmp(command, "quit", 4) == 0) {
- printf("+++ quit() +++");
- break;
- }
+ while (true) {
+ if(with_console) {
+ if(fgets(command, sizeof(command), stdin) == NULL) {
+ break;
+ } else {
+ if (tsk_strnicmp(command, "quit", 4) == 0) {
+ printf("+++ quit() +++");
+ break;
+ }
+ }
+ }
// FIXME: https://code.google.com/p/webrtc2sip/issues/detail?id=96
tsk_thread_sleep(1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment