[SR-Users] JSON error - control character 0xd

David Dean just_bytesize at yahoo.co.uk
Sun Apr 21 20:15:22 CEST 2019


I'm trying to send an SDP from a SIP client to Janus using JSON over HTTP.
The problem is that Janus is erroring on the SDP content with the following error:

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

I tried using {s.escape.common} to escape any quotations, commas etc but it doesn't appear to replace the control characters with newlines.
Any suggestions on how best to remove these control characters so that Janus will accept the SDP over JSON?
Here is the relevant section of kamailio.cfg:

# HTTP: Request SDP for echo test plugin                sdp_get("$avp(sdp)");
                $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");


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190421/28ea1dd2/attachment.html>


More information about the sr-users mailing list