[SR-Users] Modify IP address in SDP

Olle E. Johansson oej at edvina.net
Wed Jan 23 08:10:48 CET 2013


23 jan 2013 kl. 05:48 skrev Austin Einter <austin.einter at gmail.com>:

> Dear Ole
> I am not finding any example how to do it (changing a fqdn with ipaddress in sdp).
> Using sdp_get i can get the sdp.
> But how i can use transformation function pls let me know.
Check the transformations cookbok!
http://www.kamailio.org/wiki/cookbooks/devel/transformations#line_transformations

> 
> The sdpops link does not give much info how to modify any line.
You asked for changing the IP and you do that easiest with the function created to do just that in mangler.

In SDPops you get the attachment, the SDP, into the AVP. Then change it using string operations and transformations and add it back to the message - request or response.

It's pretty normal scripting. Use the transformation to get the number of lines in the avp, use a while loop and pick out each line, do the changes if needed. When you are done, use the set_body() function in the textops module to add the new SDP to the message. In the textops you also have a function named replace_body_stonce() that can do the trick for you. In short, there are many ways to do it, but you will have to read documentation :-)

http://kamailio.org/docs/modules/3.3.x/modules_k/textops.html#id2498509

/O

----
Get updated! Attend the SIP Update class in Stockholm, March 2013! 
http://edvina.net/blog/2013/01/sip-update/

> 
> Best regards
> austin
> 
> 
> On Tue, Jan 22, 2013 at 6:41 PM, Olle E Johanson <olle at ozone.webway.se> wrote:
> 
> 22 jan 2013 kl. 14:07 skrev Austin Einter <austin.einter at gmail.com>:
> 
> > Dear All
> > When 200 OK to INVITE passes through Kamailio proxy , I want to change the IP address in SDP to a specific IP address.
> >
> > Can this be done by just modifying configuration files or do I need to modify in source code.
> >
> > In case I need to modify source code, which files I need to look at.
> >
> > Kindly provide pointers for said problem.
> 
> You can modify ANYTHING in a text based attachment like an SDP in the configuration script.
> To make it a bit simple for you, we have two modules that work with specific parts:
> 
> - SDPops http://kamailio.org/docs/modules/devel/modules/sdpops.html
> - MANGLER http://kamailio.org/docs/modules/devel/modules/mangler.html
> 
> In the Mangler module there's a function called "sdp_mangle_ip()" that will make you happy.
> 
> You can always copy the whole SDP into an AVP with SDP_GET, use the transformations to read one line at a time and modify it.
> 
> /O
> 
> ----
> Update yourself to Kamailio 4 and new things in SIP - http://edvina.net/training/sip-update-2013/
> New training class - three days in Stockholm - march 6-8! Register today!
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130123/3a62968a/attachment-0001.htm>


More information about the sr-users mailing list