[SR-Users] Assistance with re.subst & newline

Daniel-Constantin Mierla miconda at gmail.com
Thu Dec 6 15:46:55 CET 2018


Hello,

just for the records, as I saw in the discussion thread that there is a
solution with a flag given to rtpengine, but can be useful for similar
situations -- better use sdp_remove_line_by_prefix() from sdpops rather
than subst regexp -- see:

  -
https://www.kamailio.org/docs/modules/devel/modules/sdpops.html#sdpops.f.remove_line_by_prefix

Cheers,
Daniel

On 06.12.18 13:17, Mark Hall wrote:
>
> Hi,
>
>  
>
> I am using rtpengine to proxy audio to/from media servers.
>
>  
>
> The outbound calls are being rejected by a couple of my carriers
> (although accepted by others), and the closest that I have been able
> to find for the reason is the inclusion of “a=rtcp:xxxxx” in the SDP
> generated by rtpengine.
>
>  
>
> To test further, I am trying to remove this line.  Rtpengine itself
> doesn’t have any options to remove it, so I am left with manipulating
> the generated SDP in Kamailio.
>
>  
>
> A sample of generated SDP is:
>
> a=maxptime:150
>
> a=rtpmap:0 PCMU/8000
>
> a=rtpmap:8 PCMA/8000
>
> a=rtpmap:18 G729/8000
>
> a=rtpmap:101 telephone-event/8000
>
> a=fmtp:18 annexb=no
>
> a=fmtp:101 0-16
>
> a=sendrecv
>
> a=rtcp:30939
>
> s=My Media Server
>
>  
>
> I am using
>
> rtpengine_manage("RTP/AVP ICE=remove");
>
> to generate the SDP to a variable ($avp(sdp))
>
>  
>
> Now, I am trying to just remove the whole a=rtcp line with re.subst
>
>  
>
> $avp(sdp)=$(avp(sdp){re.subst,|a=rtcp:[0-9]*\R||s});   *** Tried / as
> delimiter also, but | looks cleaner ***
>
> This should match the line and any CR/LF characters – BUT in results,
> nothing is changed (various online Regex testers show this match to be
> correct – I tried \r\n also).
>
>  
>
> If I do the same but without the \R, then the line is removed but not
> the CR/LF, leaving a gap in the SDP – which is invalid.
>
> $avp(sdp)=$(avp(sdp){re.subst,|a=rtcp:[0-9]*||s});
>
>  
>
> Gives:
>
> a=maxptime:150
>
> a=rtpmap:0 PCMU/8000
>
> a=rtpmap:8 PCMA/8000
>
> a=rtpmap:18 G729/8000
>
> a=rtpmap:101 telephone-event/8000
>
> a=fmtp:18 annexb=no
>
> a=fmtp:101 0-16
>
> a=sendrecv
>
>  
>
> s=My Media Server
>
>  
>
>  
>
> Can anyone see where I am going wrong, or suggest an alternative?
>
>  
>
> Kind Regards,
>
> Mark Hall
>
>  
>
>  
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference -- www.kamailioworld.com
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181206/3a1185fd/attachment.html>


More information about the sr-users mailing list