Hello!
There is a task to remove a fragment (*a=rtpmap:8 PCMA/8000#015#012*) from the SDP string generated by the rtpengine.
*v=0#015#012o=kw 1614043485 1614043486 IN IP4 185.19.237.77#015#012s=kw#015#012c=IN IP4 1.1.1.1#015#012t=0 0#015#012m=audio 31828 RTP/AVP 0 8 101#015#012a=silenceSupp:off - - - -#015#012a=direction:both#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=sendrecv#015#012a=rtcp:31829#015#012a=ptime:20#015#012*
The most logical option seems to be using the re.subst transformation, but so far no success. $avp(write_sdp_pv) = $(avp(write_sdp_pv){re.subst,/a=rtpmap:8 PCMA/8000%23015%23012//s});
Сan there be an alternative or am I doing something wrong with the re.subst?
Hello,
there should be a function to remove a line from sdp by matching on its prefix (in sdpops?!?), might be easier to use that one.
Cheers, Daniel
On 23.02.21 19:51, Denys Pozniak wrote:
Hello!
There is a task to remove a fragment (*a=rtpmap:8 PCMA/8000#015#012*) from the SDP string generated by the rtpengine.
/v=0#015#012o=kw 1614043485 1614043486 IN IP4 185.19.237.77#015#012s=kw#015#012c=IN IP4 1.1.1.1#015#012t=0 0#015#012m=audio 31828 RTP/AVP 0 8 101#015#012a=silenceSupp:off - - - -#015#012a=direction:both#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=sendrecv#015#012a=rtcp:31829#015#012a=ptime:20#015#012 /
The most logical option seems to be using the re.subst transformation, but so far no success. $avp(write_sdp_pv) = $(avp(write_sdp_pv){re.subst,/a=rtpmap:8 PCMA/8000%23015%23012//s});
Сan there be an alternative or am I doing something wrong with the re.subst?
--
BR, Denys Pozniak
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello!
Thanks for the answer. But if we abstract, it’s an SDP. How to transform a string containing # character?
пн, 1 мар. 2021 г. в 13:05, Daniel-Constantin Mierla miconda@gmail.com:
Hello,
there should be a function to remove a line from sdp by matching on its prefix (in sdpops?!?), might be easier to use that one.
Cheers, Daniel On 23.02.21 19:51, Denys Pozniak wrote:
Hello!
There is a task to remove a fragment (*a=rtpmap:8 PCMA/8000#015#012*) from the SDP string generated by the rtpengine.
*v=0#015#012o=kw 1614043485 1614043486 IN IP4 185.19.237.77#015#012s=kw#015#012c=IN IP4 1.1.1.1#015#012t=0 0#015#012m=audio 31828 RTP/AVP 0 8 101#015#012a=silenceSupp:off - - - -#015#012a=direction:both#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=sendrecv#015#012a=rtcp:31829#015#012a=ptime:20#015#012 *
The most logical option seems to be using the re.subst transformation, but so far no success. $avp(write_sdp_pv) = $(avp(write_sdp_pv){re.subst,/a=rtpmap:8 PCMA/8000%23015%23012//s});
Сan there be an alternative or am I doing something wrong with the re.subst?
--
BR, Denys Pozniak
Kamailio (SER) - Users Mailing Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Funding: https://www.paypal.me/dcmierla
Hi Denys,
not sure what you mean by ‘#’ character. The #015#012 in the dumped SDP is just a placeholder for \r\n, which is otherwise not printable.
So, it looks more like a regular expression question, not specific to Kamailio. You can apply regular expressions with the ‘re’ operation, there is also a regexp module I think.
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Denys Pozniak Sent: Monday, March 1, 2021 5:12 PM To: Daniel-Constantin Mierla miconda@gmail.com Cc: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Subject: Re: [SR-Users] Need help in transforming an SDP string through a re.subst
Hello!
Thanks for the answer. But if we abstract, it’s an SDP. How to transform a string containing # character?
пн, 1 мар. 2021 г. в 13:05, Daniel-Constantin Mierla <miconda@gmail.commailto:miconda@gmail.com>:
Hello,
there should be a function to remove a line from sdp by matching on its prefix (in sdpops?!?), might be easier to use that one.
Cheers, Daniel On 23.02.21 19:51, Denys Pozniak wrote: Hello!
There is a task to remove a fragment (a=rtpmap:8 PCMA/8000#015#012) from the SDP string generated by the rtpengine.
v=0#015#012o=kw 1614043485 1614043486 IN IP4 185.19.237.77#015#012s=kw#015#012c=IN IP4 1.1.1.1#015#012t=0 0#015#012m=audio 31828 RTP/AVP 0 8 101#015#012a=silenceSupp:off - - - -#015#012a=direction:both#015#012a=rtpmap:0 PCMU/8000#015#012a=rtpmap:8 PCMA/8000#015#012a=rtpmap:101 telephone-event/8000#015#012a=fmtp:101 0-16#015#012a=sendrecv#015#012a=rtcp:31829#015#012a=ptime:20#015#012
The most logical option seems to be using the re.subst transformation, but so far no success. $avp(write_sdp_pv) = $(avp(write_sdp_pv){re.subst,/a=rtpmap:8 PCMA/8000%23015%23012//s});
Сan there be an alternative or am I doing something wrong with the re.subst?
--
BR, Denys Pozniak
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.orgmailto:sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- www.asipto.comhttp://www.asipto.com
www.twitter.com/micondahttp://www.twitter.com/miconda -- www.linkedin.com/in/micondahttp://www.linkedin.com/in/miconda
Funding: https://www.paypal.me/dcmierla
--
BR, Denys Pozniak