Re: [SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Vitaliy Aleksandrov
I absolutely forgot about the possibility of embedding scripting 
languages to configuration.

Lua did the trick.

Thanks for the right direction and example.

I can share my solution, using app_python. I'm using this in 
production environment during 2 years.


loadmodule "app_python.so"
modparam("app_python", "script_name", "/opt/kamailio/python/sdp.py")
modparam("app_python", "mod_init_function", "mod_init")
modparam("app_python", "child_init_method", "child_init")

and put in route():
python_exec("ParseSDP", $mb);

Here I shared sdp.py:
http://paste.debian.net/99473/

Note, that it is just for reference only, you need to know what to 
remove/replace. That script is not exactly what are you're looking for!




___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Jorj Bauer
> Can anybody suggest the way to remove a line/attribute from SDP that matches 
> some pattern (regexp), some kind of "grep -v" for SDP ?

Another possibility might be to intentionally mangle an SDP offer so that it's 
unrecognizable.

Background: Asterisk is our VM and Media server. We had a case where we were 
using SRTP between handsets, but Asterisk would crash if a handset offered SRTP 
and Asterisk didn't have the SRTP module loaded. Our temporary workaround was 
to mangle the SDP offer so that Asterisk didn't see the offending SRTP offer.

This route replaces any "RTP/SAVP" with "RTP/GARBAGIO". Which Asterisk doesn't 
recognize, and therefore didn't invoke the bad behavior. We found this easier 
and lighter weight than trying to remove the line entirely, quite suitable for 
the temporary hack we needed.

route[INSECUREFWD]
{
   if (method=="INVITE") {
   subst("/^m=audio(.+)RTP\/SAVP/m=audio\1RTP\/GARBAGIO/");
   }
   route(FORWARD);
}

-- Jorj

-- 
Jorj Bauer
Manager of Engineering, Research and Development
Information Systems and Computing, University of Pennsylvania
215.746.3850
XMPP: j...@upenn.edu


___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Konstantin M.
I can share my solution, using app_python. I'm using this in production
environment during 2 years.

loadmodule "app_python.so"
modparam("app_python", "script_name", "/opt/kamailio/python/sdp.py")
modparam("app_python", "mod_init_function", "mod_init")
modparam("app_python", "child_init_method", "child_init")

and put in route():
python_exec("ParseSDP", $mb);

Here I shared sdp.py:
http://paste.debian.net/99473/

Note, that it is just for reference only, you need to know what to
remove/replace. That script is not exactly what are you're looking for!
___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Alex Balashov

Hi Vitaliy,

On 05/14/2014 06:51 AM, Vitaliy Aleksandrov wrote:


Hello list,

Can anybody suggest the way to remove a line/attribute from SDP that
matches some pattern (regexp), some kind of "grep -v" for SDP ?
I'm trying to remove unnecessary ICE candidates from the SDP body and
only thing I know is the IP address of the candidate I need to remove.

I was trying to use avp_subst() + set_body() or subst_body() but didn't
get valid SDP.


You might be able to pull it off using the various subst and other 
textops functions:


   http://kamailio.org/docs/modules/4.1.x/modules/textops.html

http://kamailio.org/docs/modules/4.1.x/modules/textopsx.html#textopsx.f.remove_body

But those may not be sophisticated enough to do the trick, in which case 
you might just need to pass this SDP body off to a third-party scripting 
language like Perl or Python. There, you can make the modifications you 
want, return a new SDP body to Kamailio, remove the old SDP body, and 
append your new one.


Cheers,

-- Alex

--
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[SR-Users] How to remove attribute from SDP ?

2014-05-14 Thread Vitaliy Aleksandrov

Hello list,

Can anybody suggest the way to remove a line/attribute from SDP that 
matches some pattern (regexp), some kind of "grep -v" for SDP ?
I'm trying to remove unnecessary ICE candidates from the SDP body and 
only thing I know is the IP address of the candidate I need to remove.


I was trying to use avp_subst() + set_body() or subst_body() but didn't 
get valid SDP.


kamailio-3.2.4.

___
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users