[Freeswitch-users] console siptrace filtering

David Villasmil david.villasmil.work at gmail.com
Mon Aug 29 01:27:41 MSD 2016


Great, thanks mike.

David
ᐧ

On Fri, Aug 26, 2016 at 10:06 PM, Michael Jerris <mike at jerris.com> wrote:

> sorry for the delay.. take a look in sofia.c
>
> static void logger(void *logarg, char const *fmt, va_list ap)
> {
>     if (!fmt) return;
>
>     switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN,
> mod_sofia_globals.tracelevel, fmt, ap);
> }
>
> and also in
>
> switch_status_t sofia_init(void)
>
> where it binds the logger function
>
> su_log_redirect(tport_log, logger, NULL);
>
> Mike
>
>
> On Aug 26, 2016, at 11:33 AM, David Villasmil <david.villasmil.work at gmail.
> com> wrote:
>
> Nice, thanks
>>
> On Fri, Aug 26, 2016 at 5:26 PM, Michael Jerris <mike at jerris.com> wrote:
>
>> give me a few minutes to finish my meeting and I'll get you that
>>
>>
>> On Friday, August 26, 2016, David Villasmil <
>> david.villasmil.work at gmail.com> wrote:
>>
>>> Hello Michael,
>>>
>>> Agreed, i just couldn't find the related code. It's important to note
>>> i'm no expert :)
>>>
>>> Regards,
>>>
>>> David
>>>>>>
>>> On Fri, Aug 26, 2016 at 5:14 PM, Michael Jerris <mike at jerris.com> wrote:
>>>
>>>> this is interesting but I'm much more interested in this in mod_sofia
>>>> at the callback we get for sip tracing.  I think this is interesting too
>>>> but maybe better to do down one level in logger so you can do this to log
>>>> files and other things too.
>>>>
>>>>
>>>> On Friday, August 26, 2016, David Villasmil <
>>>> david.villasmil.work at gmail.com> wrote:
>>>>
>>>>> Hello guys,
>>>>>
>>>>> You can get all SIP messages coming and going to a specific profile by
>>>>> typing on the console:
>>>>> “sofia profile [PROFILE] siptrace on”
>>>>>
>>>>> But if you have traffic on the box, this is a NIGHTMARE, as you get
>>>>> ALL messages…
>>>>>
>>>>> So I made a modification to mod_console.c to add a filtering for
>>>>> siptraces.
>>>>>
>>>>> By enabling the filter like so:
>>>>>
>>>>> “console filter [expression]”
>>>>>
>>>>> Where “expression” can be anything present in the packets you want to
>>>>> get, be it username, dialed number, whatever. Only those messages on which
>>>>> the expression was found will be shown:
>>>>>
>>>>> freeswitch at MacBookPro-David> console
>>>>>
>>>>> USAGE:
>>>>> --------------------------------------------------------------------------------
>>>>> console help
>>>>> console loglevel [[0-7] | <loglevel_string>]
>>>>> console filter <filter-expression>  <<<——— NEW functionality
>>>>> console colorize [on|off|toggle]
>>>>> ————————————————————————————————————————
>>>>>
>>>>> freeswitch at MacBookPro-David> console filter
>>>>>
>>>>> USAGE:
>>>>> --------------------------------------------------------------------------------
>>>>> console filter <filter-expression|off>
>>>>>
>>>>> Enable, disable filtering, Only messages containing the 'filer-expression' will be printed out.
>>>>> set 'filter-expression' to 'off' to stop filtering
>>>>> ————————————————————————————————————————
>>>>>
>>>>> Typing:
>>>>> console filter 1001
>>>>>
>>>>> Would result in only seeing messages which include 1001
>>>>>
>>>>> EXPRESSION (1001) FOUND IN:
>>>>>  <<<recv 1255 bytes from tcp/[127.0.0.1]:52917 at 21:43:11.739980:
>>>>>    ------------------------------------------------------------------------
>>>>>    INVITE sip:1001 at 127.0.0.1 SIP/2.0
>>>>>    Call-ID: 6f9cdc511446251e254e9e617d26647c at 0:0:0:0:0:0:0:0
>>>>>    CSeq: 2 INVITE
>>>>>    From: "1000" <sip:1000 at 127.0.0.1>;tag=45dd865b
>>>>>    To: <sip:1001 at 127.0.0.1>
>>>>>    Max-Forwards: 70
>>>>>    Contact: "1000" <sip:1000 at 127.0.0.1:52917;transport=tcp;registering_acc=127_0_0_1>
>>>>>    User-Agent: Jitsi2.8.5426Mac OS X
>>>>>    Content-Type: application/sdp
>>>>>    Via: SIP/2.0/TCP 127.0.0.1:52917;branch=z9hG4bK-343435-1dc76531757a26482fa8ff1bac9acf3b
>>>>>    Proxy-Authorization: Digest username="1000",realm="127.0.0.1",nonce="1a2be9b9-fa12-4763-b00c-dfeacc79f9fd",uri="sip:1001 at 127.0.0.1",response="fce7bf74772a149fe39ec7e50ec61c69",algorithm=MD5,qop=auth,cnonce="xyz",nc=00000001
>>>>>    Content-Length: 566
>>>>>
>>>>>    v=0
>>>>>    o=1000-jitsi.org 0 0 IN IP4 127.0.0.1
>>>>>    s=-
>>>>>    c=IN IP4 127.0.0.1
>>>>>    t=0 0
>>>>>    m=audio 5119 RTP/AVP 96
>>>>>    a=rtpmap:96 opus/48000/2
>>>>>    a=fmtp:96 usedtx=1
>>>>>    a=extmap:1 urn:ietf:params:rtp-hdrext:csrc-audio-level
>>>>>    a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level
>>>>>    a=rtcp-xr:voip-metrics
>>>>>    m=video 5121 RTP/AVP 97 99
>>>>>    a=recvonly
>>>>>    a=rtpmap:97 H264/90000
>>>>>    a=fmtp:97 profile-level-id=4DE01f;packetization-mode=1
>>>>>    a=imageattr:97 send * recv [x=[0-1920],y=[0-1200]]
>>>>>    a=rtpmap:99 H264/90000
>>>>>    a=fmtp:99 profile-level-id=4DE01f
>>>>>    a=imageattr:99 send * recv [x=[0-1920],y=[0-1200]]
>>>>>    ------------------------------------------------------------------------
>>>>>
>>>>> >>>
>>>>>
>>>>> My goal is to extend this to also filter other messages, like call
>>>>> processing, etc. (ERR messages would not be filtered out)
>>>>>
>>>>> I’m wondering whether it is possible to do a pull request on this?
>>>>>
>>>>> Regards,
>>>>>
>>>>> David
>>>>>>>>>>>>>>>
>>>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://confluence.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20160828/12a30be8/attachment-0001.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list