< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index  

Re: [reSIProcate] app callback for close-to-the-wire message traces


Hi John,

Thanks again.  I just finished adding support for this exact same thing to SVN mainline.  Here is the posting titled "Transport logging patch" describing this work:

Hi Palladin,

I have taken this patch, modified it and committed it.  Thanks for contributing.  Here's a I highlight of what I changed:
-removed use of the term Decorator in the name - these callbacks are for logging only, not message modification - renamed to SipMessageLoggingHandler
-renamed the virtual print methods to be more descriptive: outboundMessage and inboundMessage
-added source and destination parameters to inbound messages to be consistent
-made SipMessage arguments const - to indicate you cannot modify the SipMessages - only examine / log them
-removed static use - each Transport now can carry it's own handler.  You can set a single handle in SipStack::setTransportSipMessageLoggingHandler
  - this implementation is flexible and allows a single handler per stack instance or handler per transport instance - it is not locked to one handler for all stack instances
-added ability to turn on INFO level SipMessage logging to repro configuration

Regards,
Scott

-added ability to install a SipMessageLoggingHandler that will get called for every inbound and outbound
  SIP Message on a particular transport - work started by Palladin
 -added SipStack::setTransportSipMessageLoggingHandler to set logger on all added transports 
 -added new Repro setting EnableSipMessageLogging to enable INFO level SipMessage logging
 




On Tue, May 20, 2014 at 11:22 AM, John Gregg <jgregg@xxxxxxxxx> wrote:

Our device uses resiprocate and has a debug mode in which we want to dump into our log a trace of every message we send or receive, as close to the wire as possible. Basically, the next best thing to wireshark. Sometimes resiprocate itself discards received messages or generates messages without telling the app above it, so we found it necessary to give resiprocate a callback that takes a const * SipMessage and a direction flag:

typedef void (*msgTraceCb_t)(const SipMessage * msg, bool inNotOut);

We simply put a pointer to this callback in the Transport object as a public member variable so the app manipulates it directly; I suppose if we wanted to be nice we would have wrapped it in an accessor method. Anyway, every time the stack receives a SipMessage off the wire, and every time it is about to send one on the wire, it calls the callback (if not NULL), and the app can then do whatever logging or accounting it wants, in whatever format it likes, without actually changing the message at all. Five files changed, but relatively trivial changes. All based on 1.9.6 sources.

-John Gregg


_______________________________________________
resiprocate-devel mailing list
resiprocate-devel@xxxxxxxxxxxxxxx
https://list.resiprocate.org/mailman/listinfo/resiprocate-devel