<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Your best bet is probably to run this through an embedded Python script or similar which exposes a chr() type function. <br><br><div id="AppleMailSignature" dir="ltr">—<div>Sent from mobile, with due apologies for brevity and errors.</div></div><div dir="ltr"><br>On Apr 21, 2019, at 4:14 PM, David Dean <<a href="mailto:just_bytesize@yahoo.co.uk">just_bytesize@yahoo.co.uk</a>> wrote:<br><br></div><blockquote type="cite"><div dir="ltr"><div class="ydpe7f80b7cyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div>I tried using <span>s.replace</span> to replace the control characters, but I don't think it recognises them:</div><div><br></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div class="ydpe7f80b7cyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div><span>$avp(sdp) = $(avp(sdp){s.replace,#015#012,\r\n});</span></div></div></blockquote><div class="ydpe7f80b7cyahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div><span><br></span></div><div>It's the "<span>#015#012" which is coming from <span>sdp_get("$avp(sdp)"); that is the problem.</span></span></div><div><span><span><br></span></span></div>
</div><div id="yahoo_quoted_6872529742" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Sunday, 21 April 2019, 20:40:34 BST, David Dean <<a href="mailto:just_bytesize@yahoo.co.uk">just_bytesize@yahoo.co.uk</a>> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div id="yiv0292142489"><div><div class="yiv0292142489ydpfb7ed2a1yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div></div>
<div>Agreed. Unfortunately Janus doesn't accept base64 at this time.</div><div><br clear="none"></div><div>I'll ask <span>Lorenzo whether he can add base64 support, but in the interim I need to find a way in Kamailio of parsing <span>$avp(sdp) as shell escaped plain text with the control characters replaced.</span></span></div><div><span><span><br clear="none"></span></span></div><div><span><span>Thanks.</span></span></div><div><span><span><br clear="none"></span></span></div><div><br clear="none"></div>
</div><div class="yiv0292142489yqt8698793037" id="yiv0292142489yqt06096"><div class="yiv0292142489yahoo_quoted" id="yiv0292142489yahoo_quoted_6652041361">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Sunday, 21 April 2019, 19:21:13 BST, Alex Balashov <<a href="mailto:abalashov@evaristesys.com">abalashov@evaristesys.com</a>> wrote:
</div>
<div><br clear="none"></div>
<div><br clear="none"></div>
<div>A common solution to these problems is to base64-encode SIP data, so as<br clear="none">to avoid any part of SIP grammar violating JSON encoding specs or<br clear="none">conflicting with a JSON delimiter. <br clear="none"><br clear="none">However, I'm not sure if whatever Janus is will accept that.<br clear="none"><div class="yiv0292142489yqt8742657391" id="yiv0292142489yqtfd68815"><br clear="none">On Sun, Apr 21, 2019 at 06:15:22PM +0000, David Dean wrote:<br clear="none"><br clear="none">> I'm trying to send an SDP from a SIP client to Janus using JSON over HTTP.<br clear="none">> The problem is that Janus is erroring on the SDP content with the following error:<br clear="none">> <br clear="none">> JANUS HTTP: Get SDP for echo plugin: {#012 "janus": "error",#012 "error": {#012 "code": 454,#012 "reason": "JSON error: on line 9: control character 0xd near '\"v=0'"#012 }#012} Result code 200<br clear="none">> <br clear="none">> I tried using {s.escape.common} to escape any quotations, commas etc but it doesn't appear to replace the control characters with newlines.<br clear="none">> Any suggestions on how best to remove these control characters so that Janus will accept the SDP over JSON?<br clear="none">> Here is the relevant section of kamailio.cfg:<br clear="none">> <br clear="none">> # HTTP: Request SDP for echo test plugin sdp_get("$avp(sdp)");<br clear="none">> $var(res) = http_connect("janus", "/janus/$var(JANUS-ID)/$var(ECHO-ID)", "application/json", "{ \"janus\" : \"message\", \"transaction\" : \"testtesttest99\", \"body\" : { \"audio\" : true }, \"jsep\" : { \"type\" : \"offer\", \"sdp\" : \"$(avp(sdp){s.escape.common})\" }}", "$avp(janus-pluginsession)"); xlog("L_INFO", "JANUS HTTP: Get SDP for echo plugin: $avp(janus-pluginsession) Result code $var(res)\n");</div><br clear="none">> <br clear="none">> <br clear="none"><br clear="none">> _______________________________________________<br clear="none">> Kamailio (SER) - Users Mailing List<br clear="none">> <a rel="nofollow" shape="rect" ymailto="mailto:sr-users@lists.kamailio.org" target="_blank" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br clear="none">> <a rel="nofollow" shape="rect" target="_blank" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Alex Balashov | Principal | Evariste Systems LLC<br clear="none"><br clear="none">Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) <br clear="none">Web: <a rel="nofollow" shape="rect" target="_blank" href="http://www.evaristesys.com/, ">http://www.evaristesys.com/, </a><a rel="nofollow" shape="rect" target="_blank" href="http://www.csrpswitch.com/">http://www.csrpswitch.com/</a><br clear="none"><br clear="none">_______________________________________________<br clear="none">Kamailio (SER) - Users Mailing List<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:sr-users@lists.kamailio.org" target="_blank" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><div class="yiv0292142489yqt8742657391" id="yiv0292142489yqtfd48460"><br clear="none"></div></div>
</div>
</div></div></div></div></div>
</div>
</div></div></blockquote><blockquote type="cite"><div dir="ltr"><span>_______________________________________________</span><br><span>Kamailio (SER) - Users Mailing List</span><br><span><a href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a></span><br><span><a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a></span><br></div></blockquote></body></html>