In the RTPproxy source code, if you look at rtpp_log.h you really get the impression that syslog() functionality can be dropped in with ease.
I still believe that, and believe it can be elegant, despite the fact that my solution is fairly crappy. But, it's done... so here it is (it relies on dprint.[ch] from the openser1.1 distribution):
After ./configure, do this:
In Makefile, change CFLAGS line like this:
CFLAGS = -g -O2 -DUSESYSLOG -I../openser-1.1.0-tls
(point to wherever you build openser)
In rtpp_log.h, bracket the existing macros with this:
#ifdef USESYSLOG #include "dprint.h"
#define rtpp_log_open(app, call_id, flag) (0) #define rtpp_log_write(level, handle, format, args...) LOG(level, format, ##args) #define rtpp_log_ewrite(level, handle, format, args...) \ do { \ LOG(level, format, ##args); \ LOG(level, ": %s\n", strerror(errno)); \ } while(0); #define rtpp_log_close(handle) while (0) {} #else /* USESYSLOG */ {existing macros starting with rtpp_log_open and including rtpp_log_close} #endif /* USESYSLOG */
and stuff these lines up near the top of main.c, around line 64:
#ifdef USESYSLOG int debug = 1; int log_stderr = 0; int log_facility = LOG_LOCAL7; char* log_name = "foobar"; int pt = 0, process_no = 0; #endif
The link will fail when you do make, but just copy-and-paste the failed link command back into the shell and add ../openser-1.1.0-tls/dprint.o to the end of the line and it'll link, and run, and log.
Also, some OS (Solaris) will require you to open and close the syslog channel. So, if you need to do that, then you need to define the rtpp_log_open and rtpp_log_close macros too. I'm on freebsd, and it seems I don't need to do that.
-mark
P.S. If someone has an elegant solution to this then please post it.
Hi Mark!
What is the problem with original rtpproxy - what is the purpose of your workaround?
thanks klaus
Mark Kent wrote:
In the RTPproxy source code, if you look at rtpp_log.h you really get the impression that syslog() functionality can be dropped in with ease.
I still believe that, and believe it can be elegant, despite the fact that my solution is fairly crappy. But, it's done... so here it is (it relies on dprint.[ch] from the openser1.1 distribution):
After ./configure, do this:
In Makefile, change CFLAGS line like this:
CFLAGS = -g -O2 -DUSESYSLOG -I../openser-1.1.0-tls
(point to wherever you build openser)
In rtpp_log.h, bracket the existing macros with this:
#ifdef USESYSLOG #include "dprint.h"
#define rtpp_log_open(app, call_id, flag) (0) #define rtpp_log_write(level, handle, format, args...) LOG(level, format, ##args) #define rtpp_log_ewrite(level, handle, format, args...) \ do { \ LOG(level, format, ##args); \ LOG(level, ": %s\n", strerror(errno)); \ } while(0); #define rtpp_log_close(handle) while (0) {} #else /* USESYSLOG */ {existing macros starting with rtpp_log_open and including rtpp_log_close} #endif /* USESYSLOG */
and stuff these lines up near the top of main.c, around line 64:
#ifdef USESYSLOG int debug = 1; int log_stderr = 0; int log_facility = LOG_LOCAL7; char* log_name = "foobar"; int pt = 0, process_no = 0; #endif
The link will fail when you do make, but just copy-and-paste the failed link command back into the shell and add ../openser-1.1.0-tls/dprint.o to the end of the line and it'll link, and run, and log.
Also, some OS (Solaris) will require you to open and close the syslog channel. So, if you need to do that, then you need to define the rtpp_log_open and rtpp_log_close macros too. I'm on freebsd, and it seems I don't need to do that.
-mark
P.S. If someone has an elegant solution to this then please post it.
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
What is the problem with original rtpproxy - what is the purpose of your workaround?
I wanted it to log to syslog... I know I can get stderr logging if I keep it in the foreground, but I want it to syslog the beginning and end of calls as a backup to ACC.
Thanks, -mark