<div dir="ltr">Andrew, <div><br></div><div>I just wanted to to add that I used an open library called JSMN ('jasmine') to decode JSON messages in a "C" application. This wasn't at all painful to use with the Freeswitch JSON-formatted events. This is another way of solving the problem.</div><div><br></div><div>Regards,</div><div>Martyn</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 October 2015 at 21:37, Andrew Keil <span dir="ltr"><<a href="mailto:andrew.keil@visytel.com" target="_blank">andrew.keil@visytel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nathan,<br>
<br>
Thanks for your response. I have since implemented a simple parser that converts any %xx to the ASCII character (which you are correct with my aim to simply make it more readable). I have tested this and it works fine. So if, in a future FreeSWITCH version, no %xx characters are used inside the values it will just work anyway.<br>
<br>
I take your point about the newline character.<br>
<br>
Andrew<br>
<div><div class="h5"><br>
<br>
-----Original Message-----<br>
From: <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org">freeswitch-users-bounces@lists.freeswitch.org</a>] On Behalf Of Nathan Neulinger<br>
Sent: Monday, 26 October 2015 2:16 PM<br>
To: FreeSWITCH Users Help <<a href="mailto:freeswitch-users@lists.freeswitch.org">freeswitch-users@lists.freeswitch.org</a>><br>
Subject: Re: [Freeswitch-users] Re- Hex values inside ESL "plain" event messages?<br>
<br>
A plain message couldn't safely (for parsing purposes) include all of the characters that would be completely valid in json.<br>
<br>
Take a newline for example. That would simply encode to \n in the text of a json message, but would completely screw up the plain format one.<br>
<br>
As for the selection of which characters get encoded, that I don't have any info on. Below I see colons and spaces inconsistently encoded. While probably not critical, it seems like a relatively safe choice.<br>
<br>
Simple matter - since the plain message can't possibly cover the entire character set - you have to support decoding, at which point, it shouldn't matter which ones are encoded for anything other than human readability.<br>
<br>
-- Nathan<br>
<br>
On 10/25/2015 05:24 PM, Andrew Keil wrote:<br>
> To FreeSWITCH users,<br>
><br>
> I just wanted to check if there is a reason why hex values are<br>
> included inside the ESL "plain" event messages, since when I use JSON<br>
> event messages they are correctly converted to the correct ASCII<br>
> character. I would prefer to use the plain messages since it is<br>
> quicker for my back-end in "C" to work with, however obviously I need to switch the hex characters back to ASCII (which is easy I know), however I wondered if this is just a historic thing kept in or whether it should be changed to output the ASCII values?<br>
><br>
> Any feedback will be of interest.<br>
><br>
> For example (HEARTBEAT) from a simple TELNET session to FreeSWITCH:<br>
><br>
> event plain HEARTBEAT<br>
><br>
> Content-Type: command/reply<br>
><br>
> Reply-Text: +OK event listener enabled plain<br>
><br>
> Content-Length: 901<br>
><br>
> Content-Type: text/event-plain<br>
><br>
> Event-Name: HEARTBEAT<br>
><br>
> Core-UUID: 92575721-6081-4b86-baed-c44e3bf0f3c8<br>
><br>
> FreeSWITCH-Hostname: visytel-laptop<br>
><br>
> FreeSWITCH-Switchname: visytel-laptop<br>
><br>
> FreeSWITCH-IPv4: 192.168.15.13<br>
><br>
> FreeSWITCH-IPv6: 2001%3A0%3A5ef5%3A79fd%3A2cd4%3A4228%3A876a%3Aad51<br>
><br>
> Event-Date-Local: 2015-10-26%2009%3A09%3A44<br>
><br>
> Event-Date-GMT: Sun,%2025%20Oct%202015%2022%3A09%3A44%20GMT<br>
><br>
> Event-Date-Timestamp: 1445810984231200<br>
><br>
> Event-Calling-File: switch_core.c<br>
><br>
> Event-Calling-Function: send_heartbeat<br>
><br>
> Event-Calling-Line-Number: 70<br>
><br>
> Event-Sequence: 512<br>
><br>
> Event-Info: System%20Ready<br>
><br>
> Up-Time:<br>
> 0%20years,%200%20days,%200%20hours,%201%20minute,%200%20seconds,%2019%<br>
> 20milliseconds,%20180%20microseconds<br>
><br>
> FreeSWITCH-Version: 1.5.15b~64bit<br>
><br>
> Uptime-msec: 60019<br>
><br>
> Session-Count: 0<br>
><br>
> Max-Sessions: 1000<br>
><br>
> Session-Per-Sec: 30<br>
><br>
> Session-Per-Sec-Max: 0<br>
><br>
> Session-Per-Sec-FiveMin: 0<br>
><br>
> Session-Since-Startup: 0<br>
><br>
> Session-Peak-Max: 0<br>
><br>
> Session-Peak-FiveMin: 0<br>
><br>
> Idle-CPU: 99.583980<br>
><br>
> Regards,<br>
><br>
> Andrew Keil<br>
><br>
><br>
><br>
> ______________________________________________________________________<br>
</div></div>> ___ Professional FreeSWITCH Consulting Services:<br>
<div class="HOEnZb"><div class="h5">> <a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
> <a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
><br>
> Official FreeSWITCH Sites<br>
> <a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
> <a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
> <a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
><br>
> FreeSWITCH-users mailing list<br>
> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-use" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-use</a><br>
> rs<br>
> <a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
><br>
<br>
--<br>
------------------------------------------------------------<br>
Nathan Neulinger <a href="mailto:nneul@mst.edu">nneul@mst.edu</a><br>
Missouri S&T Information Technology (573) 612-1412<br>
System Administrator - Architect<br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<br>
_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" rel="noreferrer" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://confluence.freeswitch.org" rel="noreferrer" target="_blank">http://confluence.freeswitch.org</a><br>
<a href="http://www.cluecon.com" rel="noreferrer" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" rel="noreferrer" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" rel="noreferrer" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div>