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@MacBookPro-David> console
USAGE:
--------------------------------------------------------------------------------
console help
console loglevel [[0-7] | <loglevel_string>]
console filter <filter-expression> <<<——— NEW functionality
console colorize [on|off|toggle]
————————————————————————————————————————
freeswitch@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@127.0.0.1 SIP/2.0
Call-ID: 6f9cdc511446251e254e9e617d26647c@0:0:0:0:0:0:0:0
CSeq: 2 INVITE
From: "1000" <sip:1000@127.0.0.1>;tag=45dd865b
To: <sip:1001@127.0.0.1>
Max-Forwards: 70
Contact: "1000" <sip:1000@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@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