[SR-Users] [sr-user] textops module - search_append_body(re, txt) - append new line

Cockhootec Yahrabee cockootec at gmail.com
Sat May 3 12:58:23 CEST 2014

I am trying to append new field in SDP and I need to append new line but I
don't know how. I tried to google for solution but I didn't find anything.

I want to route my RTP and RTCP packet to port 5060 (this is for
development of my school project, I know that in the context of correct SIP
this has no sense but this is only experimental).

My sample kamailio.cfg code:

                                if (is_method("INVITE"))
                                        # route RTP packets to 5060
                                        if (search_body('m=audio [0-9]+'))
[0-9]+/m=audio 5060/g');

                                        # route RTCP packets to 5060
                                        if (search_body('a=rtcp:[0-9]+ IN
IP4 [0-9]+.[0-9]+.[0-9]+.[0-9]+'))
IN IP4 [0-9]+.[0-9]+.[0-9]+.[0-9]+/a=rtcp:5060 IN IP4');
[0-9]+ RTP/AVP [0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+', '
*{NEW_LINE_NEEDED_HERE}*a=rtcp:5060 IN IP4');

Could someone please help me resolve what should I replace the
{NEW_LINE_NEEDED_HERE} with to add new line after 'm=audio' field? Also If
you have some idea how should I optimize my regexp for finding
'm=audio'/'a=rtcp' fields I would appreciate your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20140503/07a32f5e/attachment.html>

More information about the sr-users mailing list