[SR-Users] SDP c= address as a key for a key-value lookup?

Ovidiu Sas osas at voipembedded.com
Tue Feb 19 17:02:06 CET 2013


On Tue, Feb 19, 2013 at 10:37 AM, Hegner, Travis <THegner at trilliumit.com> wrote:
> Hi All,
>
> I am working on a kamailio proxy with a very specific goal I need to
> accomplish.
>
> What I would like to do is a key-value lookup, utilizing the SDP’s media
> contact (c= line) IP as a key, and have a function return a value for that
> key. It appears that I can possibly accomplish this with the AVPops module,
> combined with DB_TEXT (maybe DB_MYSQL in the future) and a custom table with
> a custom query. The only thing I seem to be missing is the ability to
> extract the c= IP from the SDP, and store it as some kind of variable with
> which to do the lookup.
>
> I’ve looked into the iptrtpproxy module as it seems to have a select:
> @iptrtpproxy.sdp_ip that could work, but that module is extreme overkill for
> my purposes, and I am running into some issues getting it built for my
> platform (Ubuntu server 12.04). Also the documentation for that select
> states: “Return first rewritten IP provided at SDP c= line.” However, I’m
> looking for the original sdp_ip, and have some concern that this won’t
> return an IP that has not yet been re-written.
>
> My environment has a very specific 1:1 ratio of private network, to static
> public IP mappings. I currently have a successful OpenSER (1.3.2) deployment
> within this environment (running 5 years), which uses a hacked version of
> the old “mangler” module, with the function sdp_mangle_ip(<network>, <ip>).
> I could do something similar using textops->search_body() and
> nathelper->fix_nated_sdp(), but the risk of a typo or syntax error in the
> config file every time I have to make a change or add a network is fairly
> high. Less importantly, there is some extra overhead as the proxy will have
> to test for every network on every SDP looking for a match (this is what the
> current deployment does). Eventually I’d like to add a simple frontend to
> add/edit networks on the fly, so that no one is ever touching the config.
>
> What would you folks recommend for this? Should I look at building a custom
> module which only grabs the c= IP and stores it into an AVP? Am I not seeing
> another module that will expose that information for me already? Would it
> simply be easier to work on getting iptrtpproxy built, and utilizing it only
> for the purpose of extracting the information I need from the SDP?


There is the sdpops module:
http://kamailio.org/docs/modules/devel/modules/sdpops.html
You could create a patch to add some AVPs to export the media streams
with it's params.
Take a look at the sdp parser (check print_sdp_session as an example
of what's already available)
Please note that an AVP can store multiple values (but it cannot have
holes in between the values).

Also, a new class of transformations dedicated to SDP would be handy
(combined with the above AVPs).
http://www.kamailio.org/wiki/cookbooks/devel/transformations


Regards,
Ovidiu Sas

-- 
VoIP Embedded, Inc.
http://www.voipembedded.com



More information about the sr-users mailing list