From shaheryarkh@gmail.com Sat Aug 2 03:33:28 2014 From: Muhammad Shahzad To: sr-dev@lists.kamailio.org Subject: Re: [sr-dev] [SR-Users] Obscuring SIP traffic and using with NoSIP Date: Sat, 02 Aug 2014 06:33:01 +0500 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2083561786==" --===============2083561786== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable OK, i realize my mistake, SREV_NET_DATA_IN event is processed before msg->rcv info is set. This is kind of nice since we get completely raw message direct from receive socket. :) Thank you. On Fri, Aug 1, 2014 at 5:49 AM, Muhammad Shahzad wrote: > OK, so writing kamailio module was fun and easy. All thanks to > Daniel-Constantin for providing very useful hints, it took hardly 2-3 hours > to write up a functional module that exposes data received on kamailio > socket and data that is about to be sent out, in an event route, where it > can be manipulated e.g. to encode and decode per custom encryption > algorithms defined by script writer. Here is bleeding edge code, > > http://webrtc.voip-demos.com/obfuscate.c.txt > > Most of the code is borrowed from topoh, nosip and msrp modules and works > fine. There is just one little problem, that is unlike nosip module, the > event route for obfuscate module gives error when i try to print source > address using $si and $sp variables. > > Here is an example kamailio.cfg > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > loadmodule "nosip.so" > loadmodule "obfuscate.so" > > ... > > event_route[nosip:msg] { > xlog("L_INFO", "[$pr:$si:$sp]: Received nosip message '$mb' \n"); > } > > event_route[obfuscate:msg] { > if (is_msg_obfuscated()) { > xlog("L_INFO", "[$pr:$si:$sp]: Received obfuscated message '$mb' > \n"); > $avp(msg) =3D $mb; > } else { > xlog("L_INFO", "[$pr:$dd:$dp]: Sending obfuscated message '$mb' > \n"); > $avp(msg) =3D $mb; > }; > } > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > using telnet when i send some random junk i get following in kamailio logs, > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > webrtc[13284]: : pv [../../parser/../ip_addr.h:669]: ip_addr2sbuf(): BUG: > ip_addr2sbuf: unknown address family 0 > webrtc[13284]: INFO: