Indeed, after sending my original message I noticed the avpops->avp_subst() function. I
could use a combination of sdp_get() and avp_subst() to get what I need.
Perhaps a helpful set of functions for anyone would be a way to run a regex search against
the message or sdp, and store any back-reference values directly to a set of AVPs.
Thanks for the tips you've all been most helpful,
Travis
-----Original Message-----
From: sr-users-bounces(a)lists.sip-router.org [mailto:sr-users-bounces@lists.sip-router.org]
On Behalf Of Carsten Bock
Sent: Tuesday, February 19, 2013 11:04 AM
To: SIP Router - Kamailio (OpenSER) and SIP Express Router (SER) - Users Mailing List
Subject: [DKIM Failure] Re: [SR-Users] SDP c= address as a key for a key-value lookup?
Hi,
you could simply retrieve the SDP-Body using the function from SDPOps Module:
sdp_get("$avp(sdp)");
And then search the according C-Line with a regular expression.
Or you could use the internal API, see print_sdp_session.
Kind regards,
Carsten
2013/2/19 Hegner, Travis <THegner(a)trilliumit.com>om>:
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
nathelper->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?
Any insight would be most greatly appreciated.
Thanks,
Travis Hegner
________________________________
The information contained in this communication is confidential and is
intended only for the use of the named recipient. Unauthorized use,
disclosure, or copying is strictly prohibited and may be unlawful. If
you have received this communication in error, you should know that
you are bound to confidentiality, and should please immediately notify
the sender or our IT Department at 866.459.4599.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
list sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Carsten Bock
CEO (Geschäftsführer)
=============================================================
Die ng-voice GmbH ist auf der Kamailio World 2013, 16./17. April 2013 =>
http://conference.kamailio.com/k01/
=============================================================
ng-voice GmbH
Schomburgstr. 80
D-22767 Hamburg / Germany
http://www.ng-voice.com
mailto:carsten@ng-voice.com
Office +49 40 34927219
Fax +49 40 34927220
Sitz der Gesellschaft: Hamburg
Registergericht: Amtsgericht Hamburg, HRB 120189
Geschäftsführer: Carsten Bock
Ust-ID: DE279344284
Hier finden Sie unsere handelsrechtlichen Pflichtangaben:
http://www.ng-voice.com/imprint/
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
The information contained in this communication is confidential and is intended only for
the use of the named recipient. Unauthorized use, disclosure, or copying is strictly
prohibited and may be unlawful. If you have received this communication in error, you
should know that you are bound to confidentiality, and should please immediately notify
the sender or our IT Department at 866.459.4599.