[SR-Users] s.replace Transformation and Newline
Carsten Bock
carsten at ng-voice.com
Mon May 18 19:21:52 CEST 2020
Sorry for the confusion - my initial example contained a typo. The right
version:
[...]
$sht(sdp=>$ci) = $(rb{s.replace,a=sendrecv,a=sendrecv\r\na=curr:qos local
none});
[...]
set_reply_body("$sht(sdp=>$ci)", "application/sdp");
send_reply("200", "OK");
[...]
It works like a charm, however I'm facing one small issue:
My SDP looks like this:
[...]
a=rtpmap:8 PCMA/8000
a=sendrecv\r\na=curr:qos local none
a=rtcp:34949
[...]
Thanks,
Carsten
P.S.: Never write emails between two meetings...
Daniel-Constantin Mierla <miconda at gmail.com> schrieb am Mo., 18. Mai 2020,
18:35:
> Hello,
>
> is not clear to me: so when you had it with one backslash, it was the two
> chars '\n' in sdp, when it was \\n was it with 2 backslashes (3 chars)?
>
> Cheers,
> Daniel
> On 18.05.20 17:58, Carsten Bock wrote:
>
> Hi Daniel,
>
> Unfortunately, I already had replaced that. While I had the two \\ in
> config, I also had two \\ in the SDP...
>
> Thanks,
> Carsten
>
>
> Daniel-Constantin Mierla <miconda at gmail.com> schrieb am Mo., 18. Mai
> 2020, 17:49:
>
>> Hello,
>>
>> I see you have two backslashes \\ for r and n. Have you tried with only
>> one?
>>
>> \\ is supposed to be \ character.
>>
>> Cheers,
>> Daniel
>> On 18.05.20 16:32, Carsten Bock wrote:
>>
>> Hi,
>>
>> I am trying the following:
>> - extract the message body
>> - replace some content
>> - store it in a hashtable
>> - send it out in a reply in later request
>>
>> I do the following:
>>
>> [...]
>> $sht(sdp=>$ci) = $(rb{s.replace,a=sendrecv,a=sendrecv\\r\\na=curr:qos
>> local none});
>> [...]
>> set_reply_body("$sht(sdp=>$ci)", "application/sdp");
>> send_reply("200", "OK");
>> [...]
>>
>> It works like a charm, however I'm facing one small issue:
>>
>> My SDP looks like this:
>> [...]
>> a=rtpmap:8 PCMA/8000
>> a=sendrecv\r\na=curr:qos local none
>> a=rtcp:34949
>> [...]
>>
>> It seems that s.replace is escaping characters.
>>
>> Anyone any ideas?
>>
>> Thanks,
>> Carsten
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> $var(x) = "abababa";
>> $(var(x){s.replace,a,c} => "cbcbcbc"
>> --
>>
>> Carsten Bock I CTO & Founder
>>
>> ng-voice GmbH
>>
>> Trostbrücke 1 I 20457 Hamburg I Germany
>> T +49 40 524 75 93-40 | M +49 179 2021244 I www.ng-voice.com
>>
>> Registry Office at Local Court Hamburg, HRB 120189
>> Managing Directors: Dr. David Bachmann, Carsten Bock
>>
>> _______________________________________________
>> Kamailio (SER) - Users Mailing Listsr-users at 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
>>
>> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda
> Funding: https://www.paypal.me/dcmierla
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200518/c2a6d59e/attachment.html>
More information about the sr-users
mailing list