[Users] rtpproxy or RTPProxy, where to download or checkout--found it:). Re: Users Digest, Vol 15, Issue 61

Mark Kent mark at noc.mainstreet.net
Wed Aug 23 07:55:54 CEST 2006


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.
     




More information about the Users mailing list