Hi Klaus,
Thx for your suggestion. The workaround is working fine with Pseudo-Variable $rb instead of $mb ("$var(sdp) = $(rb{s.striptail,2});")
However, the broken body is generated by Kamailio with the filter_body() function. The server receives a multipart/mixed body and is filtering the SDP part of it with following config (excerpt): if (has_body("multipart/mixed")) { if (filter_body("application/sdp")) { remove_hf("Mime-Version"); remove_hf("Content-Type"); append_hf("Content-Type: application/sdp\r\n") } }
After filtering the SDP message, the message body terminates with double CRLF, which was "space" between the individual parts / to the uniqueBoundary. I tried before using "subst" with kamailio-like parameters for removing the blank line: if (subst('/(a=[a-z]+:.+)[\r\n]{4}$/\1\r\n/s')) { and was wondering, why this does not work. The "search_body()" function accepted the match pattern and so it could not be wrong at all: if (search_body("a=[a-z]+:.+[\r\n]{4}$")) {
Should this work with Kamailio?
Regards, Klaus
P.S. the body of the original SIP message looks as follows: [...] Content-Type: multipart/mixed;boundary=uniqueBoundary Mime-Version: 1.0 Content-Length: <length>
--uniqueBoundary Content-Type: application/sdp Content-Disposition: session;handling=required
v=0 o=CiscoSystemsSIP-GW-UserAgent 9550 3496 IN IP4 10.16.48.44 s=SIP Call c=IN IP4 10.16.48.44 t=0 0 m=audio 16386 RTP/AVP 8 19 c=IN IP4 10.16.48.44 a=rtpmap:8 PCMA/8000 a=rtpmap:19 CN/8000 a=ptime:20
--uniqueBoundary Content-Type: application/x-q931 Content-Disposition: signal;handling=optional Content-Length: 48
0802037C052104030010231803210303 6C0C2103313730343530353335317D02 11017E0D0A2E0D0765007322143504
--uniqueBoundary Content-Type: application/gtd Content-Disposition: signal;handling=optional
IAM, PRN,isdn*,,NET5*, USI,rate,c,s,c,1 USI,lay1,alaw TMR,00 CGN,04,,1,y,4,1704505351 UUS,0,1d4275050014804185000031362a640062f21001f62fbf CPC,09 FCI,,,,,,,y, GCI,67f9f408a73011e280056c205642ae68
--uniqueBoundary
-------- Original-Nachricht -------- Betreff:
Re: [SR-Users] 'subst' request for message body (SDP)
Datum:
Fri, 05 Jul 2013 17:01:56 +0200
Von:
Klaus Darilion klaus.mailinglists@pernau.atmailto:klaus.mailinglists@pernau.at
An:
Kamailio (SER) - Users Mailing List sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org
Kopie (CC):
Klaus Feichtinger klaus.lists@inode.atmailto:klaus.lists@inode.at
Is this broken body generated by Kamailio, or by some other entity?
If it is done by Kamailio with filter_body(), it should be fixed.
If done by some other entity, it should be fixed in the broken entity. I
have no idea why subst does not work, but as workaround you can try
something like:
$var(sdp) = $(mb{s.striptail,2});
set_body("$var(sdp)", "application/sdp");
regards
Klaus
On 05.07.2013 13:05, Klaus Feichtinger wrote:
Hello,
can anybody give me a hint, how I could delete the _empty_ (blank) last
line of the message body / SDP (it consists of #012#015 only)? This blank
line is the rest of the original MIME message, which was reduced to a
standard message with content SDP only by kamailio-3.3.4, which is
principally working fine.
I´ve tried using the textops functions "subst" and "subst_body", but they
do not behave as like as real SED. When I try this string manipulation
with SED, it is working fine with [sed '${/^$/d}']. But the subst
implementation does not support the additional parameters '${' / '}'.
Does anybody know how to delete the last line of the whole message?
regards,
Klaus
P.S. the end of the message looks like this:
[...]#015#012a=rtpmap:8 PCMA/8000#015#012a=ptime:20#015#012#015#012
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.orgmailto:sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
On 08.07.2013 12:47, Klaus Feichtinger wrote:
P.S. the body of the original SIP message looks as follows: [...] Content-Type: multipart/mixed;boundary=uniqueBoundary Mime-Version: 1.0 Content-Length: <length>
--uniqueBoundary Content-Type: application/sdp Content-Disposition: session;handling=required
v=0 o=CiscoSystemsSIP-GW-UserAgent 9550 3496 IN IP4 10.16.48.44 s=SIP Call c=IN IP4 10.16.48.44 t=0 0 m=audio 16386 RTP/AVP 8 19 c=IN IP4 10.16.48.44 a=rtpmap:8 PCMA/8000 a=rtpmap:19 CN/8000 a=ptime:20
--uniqueBoundary
This looks like there is CR LF CR LF at the end of the SDP. (empty line before --uniqueBoundary). Thus, I think Kamailio is correct and the double CRLF is already received by Kamailio.
regards Klaus